No internet connection
  1. Home
  2. How to

Get Text from Popup input for Pasting

By Steve @stevef
    2018-12-31 21:25:42.899Z

    Hi. Is there any way to get the text from a user input dialogue to be able to paste it in Cubase? For example, a popup asks for the track name, and that is used to paste the name into a duplicated track. So basically I need it to be able to either copy to the clipboard for pasting, or is there a way to output the text another way?

    Thanks.

    Solved in post #8, click to view
    • 7 replies
    1. Hi @stevef. Have you seen the sf.clipboard functions? They should be able to do this.
      @JesperA has worked quite a bit with clipboard and cubase. We should support both copy pasting and keyboard typing out of the box.

      1. SSteve @stevef
          2019-01-01 00:57:25.790Z

          Yes, but I just keep getting an error that the popup text input can’t be used as a string so can’t get it in to the clipboard.

          1. You're most likely missing to access the specific property of the result of the popup call. Can you share the code?

            1. All actions in SF return an object consisting of multiple properties. I don't remember exactly which property to access for the popup text but if you type a dot after the call you should get code completion to help you access the right result property

        • In reply tostevef:

          Hey Steve.

          Here's some key elements for you:
          var input = sf.interaction.popupText({ title: 'Text for popup window' }).text;
          sf.clipboard.setText({text: input})

          Then just create a scripts that starts with the above, then duplicate the track, rename it, and paste the above with sf.keyboard.press({keys: 'cmd+v'})

          You can also go the other way, if you want to get the text/title from an existing track:
          sf.keyboard.press({keys: 'cmd+c'}); //copies selected text
          var input = sf.clipboard.getText().text; //adds the text to the variable.

          Now you can use the text within soundflow, modify it etc.
          If you want it to persist between scripts, instead of input use globalstate.input.

          You might also wanna check out this video. I've attached scripts to it: https://www.youtube.com/watch?v=Ad2HujsvijI&index=2&list=PLS5FeGiB8oQ57BnC88QPwBar0XpOkcF2e
          But some parts/elements are already a bit dated, but using same technics as above

          1. Btw. the videos was prior sf.interaction, so in those script I'm using applescript popup as input. But maybe check the one for adding Audio, as I'm splitting up a text for multiple things.

            1. In reply toJesperA:
              SSteve @stevef
                2019-01-01 09:40:59.494Z

                Brilliant, thanks @JesperA! This solved it - sf.clipboard.setText({text: input}) - I was almost there, just didn't't get the formatting of the part in brackets right. All works now.

                Reply1 LikeSolution