open and close deck on my Mac display
Title
open and close deck on my Mac display
What do you expect to happen when you run the script/macro?
I'd like to have a hotkey to open and close (Ideally toggle) a deck that is showing on my Mac Monitor (My Device). I can easily open it with the Open Deck action but I'm not able to close it. When I use a close window action it doesn't work
Are you seeing an error?
What happens when you run this script?
I can open the deck on my monitor but I'm not close it (via soundflow)
How were you running this script?
I used a Stream Deck button
How important is this issue to you?
5
Details
{ "inputExpected": "I'd like to have a hotkey to open and close (Ideally toggle) a deck that is showing on my Mac Monitor (My Device).\nI can easily open it with the Open Deck action but I'm not able to close it. \nWhen I use a close window action it doesn't work", "inputIsError": false, "inputWhatHappens": "I can open the deck on my monitor but I'm not close it (via soundflow)", "inputHowRun": { "key": "-MpfwmPg-2Sb-HxHQAff", "title": "I used a Stream Deck button" }, "inputImportance": 5, "inputTitle": "open and close deck on my Mac display" }
Source
//Macro converted to script
sf.decks.get('user:ckz1ds1y3000yma10izf0m0hp:ckz1hww9j000awu10gz009yof').open({
device: sf.devices.localMachine,
openMode: "OpenOrCreate",
});
Links
User UID: 5249dKwRoBaUJMe17l0F6Y0JKLz2
Feedback Key: sffeedback:5249dKwRoBaUJMe17l0F6Y0JKLz2:-Muus8YtFZZNWhUviuXP
- In reply toLes_Cooper⬆:Kitch Membery @Kitch2022-02-02 20:37:28.339Z
Hi @Les_Cooper,
Here is how to show a deck on your Mac display;
- Create a new macro and add the "Open Deck (Show on Device)" Macro Action.
- Set the "Deck" property to the deck that you would like to display.
- set the "Device" property to "This Machine"
- Assign a trigger of your choice.
Right now there is no simple way to toggle a deck on your mac but I'll see if I can create a script to do so when I get a moment :-)
Rock on!
- In reply toLes_Cooper⬆:Kitch Membery @Kitch2022-02-02 20:46:45.709Z
Hi again @Les_Cooper,
This script should do the trick;
const deckCommandId = 'Add your Decks Command ID here'; const deck = sf.decks.get(deckCommandId); if (deck.getAllLoadedInstances()[0] === undefined || !deck.getAllLoadedInstances()[0].isVisible) { deck.open({ device: sf.devices.localMachine, }); sf.ui.frontmostApp.appActivateMainWindow({ onError: "Continue" }); } else { deck.getAllLoadedInstances()[0].close(); sf.ui.frontmostApp.appActivateMainWindow({ onError: "Continue" }); }
To get the Decks "Command ID",
- Select the Deck in the "Command Name" list in SoundFlow
- Open the "Command Menu" and select "Copy Command ID"
- Paste the Command ID into the script;
Let me know if that works for you :-)
- LLes Cooper @Les_Cooper
Hey Kitch. Thanks very much for this!
I'm having a bit of trouble getting it to run and I'm wondering if this is a syntax problem on my part.
I'm adding thisconst deckCommandId = user:ckz1ds1y3000yma10izf0m0hp:ckz1lk1ag000pwu10jo1wrd5q
Kitch Membery @Kitch2022-02-02 22:01:11.432Z
Hi @Les_Cooper,
The Command ID needs to be in quotes like this;
const deckCommandId = "user:ckz1ds1y3000yma10izf0m0hp:ckz1lk1ag000pwu10jo1wrd5q";
Hopefully that will fix the issue :-)
- LIn reply toLes_Cooper⬆:Les Cooper @Les_Cooper
Hey Kitch.
Thanks, this is starting to come together!I'm wondering if there is any way to make this script update the deckCommandID dynamically via a variable based on whichever deck is in focus on the Streamdeck.
The idea would be that I could have a single script that I can fire from any active deck that mirrors it my mac display with toggle on/off.Kitch Membery @Kitch2022-02-02 22:15:31.831Z
That might be doable. I'll take a look when I get the chance. :-)
- LLes Cooper @Les_Cooper
Thank you!
Just an update,
I did have the script working but after I run the script once, I get a strange behavior where my decks disconnect and I get a 'no connection to backend'Kitch Membery @Kitch2022-02-02 22:32:18.253Z
I think I know what's happening, but best hold off on using the script then till I get a chance to test it out.