No internet connection
  1. Home
  2. How to

Keyboard Trigger Conditions

By John Michael Caldwell @johnmcald
    2021-08-06 18:03:50.674Z

    Hi, I'm trying to create a command that let's me press a keyboard button down > select the grabber tool > key release / or not down any longer > select insert tool.

    I don't see these types of conditions in the trigger selection menu under keyboard press. Maybe there's a way to script this or no?

    Thanks for any help,

    • 6 replies
    1. J
      John Michael Caldwell @johnmcald
        2021-08-23 22:21:26.937Z

        Does SoundFlow support something like event.codes and listening to keyip or keydown values?

        On javascript.info I came across something similar to what I'm looking for, I think. This is the script:

        sf.addEventListener('keydown', function(event) {
          if (event.code == 'KeyZ' && (event.ctrlKey || event.metaKey)) {
            alert('Undo!')
          }
        });
        
        

        I seem to get an error with the addEventListener portion of the script but if I remove it I get errors at the "event" portions.

        Technically looking for a way a script can listen to the key input from the trigger so that when I press the key it does one thing and when the ket is released it does another.

        1. samuel henriques @samuel_henriques
            2021-08-24 09:02:34.736Z

            You can do this with the modifier keys and set an if/else.

            But using this for what you want will make it impossible to navigate regions with any of the selector options.

            You could set a trigger to change toggle the tools or a trigger for each tool.

            1. In reply tojohnmcald:

              The code above is for browser-based events management in Javascript, so it wouldn't work like that in SF.

              SoundFlow currently doesn't have support for having separate actions happen on key down and key up events, unfortunately.

              1. There's a slight chance this could be hacked through a HID trigger, but I don't know if it would work.

                1. JJohn Michael Caldwell @johnmcald
                    2021-08-24 20:25:28.363Z

                    Thanks @chrscheuer, I'll give it a shot, maybe I'll tinker with using a different device, something other than the keyboard, to do this, as well.

                    1. Anything that sends MIDI SF reads very detailed. A foot pedal could be used for example ;)