Action
Shortcut: UPPERCASE
Send the selected text in the editor to Shortcuts as input to a “UPPERCASE” shortcut. Replaces the text in the editor with the result text from the Shortcut.
Requires you install the example UPPERCASE shortcut.
This is meant as an example action to demonstrate how to call a shortcut and get a result via the Shortcut
script object
To change the name of the shortcut being called, right-click on the action in the action list and “Configure” the action.
Steps
-
configurationKey
name Shortcut Name
key shortcutName
-
script
// load shortcut name let shortcutName = "UPPERCASE" if (context.configuredValues["shortcutName"]) { shortcutName = context.configuredValues["shortcutName"] } // get input text let selectedText = editor.getSelectedText() const [st, len] = editor.getSelectedRange() let shortcut = Shortcut.create(shortcutName, selectedText) if (shortcut.run()) { if (shortcut.result) { editor.setSelectedText(shortcut.result) editor.setSelectedRange(st, shortcut.result.length) } } else { console.log(`Shortcuts Error: ${JSON.stringify(shortcut.response)}`) context.fail() }
Options
-
After Success Default Notification Info Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.