No internet connection
  1. Home
  2. How to

Trigger function key press from Stream Deck

By Sam Burden @Sam_Burden
    2020-11-13 15:24:16.645Z

    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!

    • 15 replies
    1. 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",
      });
      
      
      1. In reply toSam_Burden:

        Then you can create a new deck and drag either the macro or the script to the desired button on your deck.

        1. S
          In reply toSam_Burden:
          Sam Burden @Sam_Burden
            2020-11-17 17:03:22.127Z

            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?

            1. 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.

              1. SSam Burden @Sam_Burden
                  2020-12-03 22:09:28.174Z

                  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,
                  Sam

                  1. Unfortunately I don't have access to a MBP with a touch bar so I can't definitively answer this.

                    1. SSam Burden @Sam_Burden
                        2020-12-03 22:24:20.136Z

                        No worries Chris, I'll have to settle for a new finder window for the desktop at the moment!
                        Thanks for your help.
                        Sam

                        1. 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?

                          1. SSam Burden @Sam_Burden
                              2020-12-04 11:37:29.511Z

                              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,
                              Sam

                              1. @chrscheuer - any ideas?

                                1. 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.

                                  1. Yea, you can just do:

                                    sf.system.exec({ commandLine: `open -a "Mission Control"` });
                                    
                                    1. 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.

                                      1. SSam Burden @Sam_Burden
                                          2020-12-07 17:15:38.205Z

                                          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,
                                          Sam

                                          1. 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.