No internet connection
  1. Home
  2. How to

Possible to Check Caps Lock Status or Paste Text as caps?

By Steve @stevef
    2018-07-27 09:29:48.305Z

    I have a popup text input which I would like to be capitalised text when insert to a track name. Obviously I can hold shift and type or put caps lock on, but the amount of times I forget is large, and have to go back an do again. I know there is a key press for Caps lock which I can use, but that is useless if caps lock is already one of course.

    So is there a) any way to check the status of the caps locks or b) a way to take the text from the popup text window and capitalise it before inserting into the track name?

    Thanks.

    Solved in post #2, click to view
    • 2 replies
    1. Hi @stevef

      You have access to the full range of Javascript string manipulation functions in SF's javascript. So, if you have a variable with a string, you can use the method toUpperCase() on it to return a version of the string in all caps.

      Example:

      var text = sf.interaction.popupText({ popupIdentifier: 'text' }).text;
      var textInAllCaps = text.toUpperCase();
      
      //Now insert/type this text somewhere:
      sf.keyboard.type({ text: textInAllCaps });
      
      ReplySolution
      1. SSteve @stevef
          2018-07-27 12:09:28.649Z

          Brilliant, thanks!