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.
- Christian Scheuer @chrscheuer2018-07-27 12:01:09.684Z
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 });
- SSteve @stevef
Brilliant, thanks!