No internet connection
  1. Home
  2. How to

Wait for Keyboard Input = "Return" key press

By Ingo Pusswald @ingo_luftrausch
    2020-11-28 21:48:10.415Z

    Hi,
    Is it possible to wait for a specific key press, like the "return" key?

    Need it for "wait till password is entered" to proceed.

    Thank!

    • 8 replies
    1. Dustin Harris @Dustin_Harris
        2020-11-29 05:00:18.391Z

        I’m not sure SoundFlow can hook a keyboard command like that, but you can have it recognize the window you’re entering the password in and continue when that window is closed. Does that help?

        1. Ingo Pusswald @ingo_luftrausch
            2020-11-29 09:02:47.493Z

            Thanks Dustin,
            its for entering Terminal command lines one after another. I couldn't find any UI element nor menu item that can be used as triggers for SF.

            I tried to modify “Wait for Streamdeck button” but failed.

            1. Dustin Harris @Dustin_Harris
                2020-11-29 11:32:23.511Z

                You could get the password as a variable from a prompt then pass that into the terminal command?
                let pwd = prompt(‘Please Enter Your Password’)

                1. Ingo Pusswald @ingo_luftrausch
                    2020-11-29 11:44:26.929Z

                    Hm,

                    I want to publish that package and I don't wanna mess around with admin passwords....

                    Its about renice for Pro Tools and caffeinate:

                    Launch ProTools
                    Launch Terminal
                    Get pid of ProTools
                    Enter renice command into Terminal with pid
                    -> and now the AdminPW is required....

                    Afterwards I want to apply caffeinate -I and -D for HDDs and Displays

                    So when you launch ProTools with this Command you get all the power of your system it can provide, no matter what...

                    1. Generally, SF shouldn't be used for automating password entry, as it's inherently insecure.

                      What you can do instead is to use your macOS Keychain. Make a login item, and then use Terminal commands to read that password inline in the command. I found some tutorials on how to do this online a while back for some different automation.
                      But the gist is – keep the password stuff out of SF if you can.

                      1. Dustin Harris @Dustin_Harris
                          2020-11-30 16:21:59.846Z

                          Oh that is super cool...

                2. In reply toingo_luftrausch:
                  Dustin Harris @Dustin_Harris
                    2020-11-29 16:00:54.582Z

                    Maybe someone else will chime in with another idea, but the only way I can think of doing it is getting the password as a variable and passing that onto a system.exec({}) method to run the terminal command. But I admittedly a JavaScript beginner :)

                    1. Ingo Pusswald @ingo_luftrausch
                        2020-11-29 16:14:00.339Z

                        I did use your suggestion, and its working!

                        The first version of the package is in the store. Would be nice to get your feedback! (Search for luftrausch)