Trigger function key press from Stream Deck
Hey, I'm trying to trigger a function key (F3) from a deck. Anyone know how to write the function keys in to script?
Cheers!
- Chris Shaw @Chris_Shaw2020-11-13 18:04:08.712Z
This is quite easy. You can use a macro to generate the script you need.
Here is the macro:
Then you use the Convert to Script button tho get the script:
sf.keyboard.press({ keys: "f3", });
- In reply toSam_Burden⬆:Chris Shaw @Chris_Shaw2020-11-13 18:08:10.207Z
Then you can create a new deck and drag either the macro or the script to the desired button on your deck.
- SIn reply toSam_Burden⬆:Sam Burden @Sam_Burden
Hey Chris, Thanks for this.
This is how I had tried it and your explination makes total logical sense. It's just not working for me for some reason.
My goal is to create a button that triggers the 'Show Desktop' feature in 'Mission Control' on OSX. I'm not sure if there maybe some deeper script required for this but a straight up key press doesn't seem to work for me.
Any thoughts?
Chris Shaw @Chris_Shaw2020-11-17 17:50:18.809Z
This may be the reason - If you followed the system optimization recommendations from AVID when you set up PT, then you probably disabled Mission Control. You can check in System Preferences > Mission Control or Sys Prefs > Keyboard > Shortcuts. PT requires f12 for record.
- SSam Burden @Sam_Burden
Thanks Chris, sorry for the slow reply.
Yes I did check all of that but it is still not working. Could it be because I'm using a Macbook Pro with touchbar? I'm using it in clamshell mode with a bluetooth keyboard.
Best,
SamChris Shaw @Chris_Shaw2020-12-03 22:18:57.349Z
Unfortunately I don't have access to a MBP with a touch bar so I can't definitively answer this.
- SSam Burden @Sam_Burden
No worries Chris, I'll have to settle for a new finder window for the desktop at the moment!
Thanks for your help.
SamChris Shaw @Chris_Shaw2020-12-04 03:04:45.401Z
Just curious. Can you open mission control with the touchbar? if so, create a blank macro and try assigning it to the same key - does it assign f2 or something else?
- SSam Burden @Sam_Burden
It just seems to me that SoundFlow just isn't triggering the Functions keys.
I have done the following:
- Opened System Prefs > Mission Control and set 'Show Desktop' as 'F11'.
- Opened System Prefs > Keyboard and checked 'Use F1, F2 etc. as standard function keys.
- Set up a new script as you suggested with the following:
sf.keyboard.press({
keys: "f11",
});When triggering, the SoundFlow icon flashes blue in my menu bar, indicating that the script is running but nothing else happens.
What's strange is that setting a script to press F12 works for initiating record in Pro Tools. So there seems to be some disconnect between SoundFlow and the system commands...
Cheers,
SamChris Shaw @Chris_Shaw2020-12-04 16:49:31.776Z
@chrscheuer - any ideas?
Christian Scheuer @chrscheuer2020-12-04 20:01:40.676Z
I don't think that the way SoundFlow tells macOS to simulate a keystroke, means that macOS will see your F3 as a Mission Control invocation. It will see it as a regular F3 press.
You'd have to look for some way to start Mission Control through other means – for example if you find a way to do it from Terminal, you can use the
sf.system.exec
action.Christian Scheuer @chrscheuer2020-12-04 20:03:01.455Z
Yea, you can just do:
sf.system.exec({ commandLine: `open -a "Mission Control"` });
Christian Scheuer @chrscheuer2020-12-04 20:04:13.839Z
The reason is when you're assignining macOS shortcuts in System Preferences, they don't work like any other app, they take priority and work in weird ways different from how SoundFlow normally interacts with other things.
- SSam Burden @Sam_Burden
Thanks Christian!
That opens Mission Control, but is there a way to clear straight to the desktop view?
I found this post relating to it and can make it work in terminal by pasting:
"/Applications/Mission\ Control.app/Contents/MacOS/Mission\ Control 1"
But I can't quite get it working when incorporating it in to your code.https://apple.stackexchange.com/questions/105361/terminal-commands-for-application-windows-and-show-desktop-in-mountain-lion
Thanks again for your help guys,
SamChristian Scheuer @chrscheuer2020-12-07 18:22:04.917Z
I'm on Catalina and Big Sur, and the command you showed doesn't work there, so I'm not sure how to help, unfortunately.