The Basics
Importing Libraries
Traditional Variables
Magic Variables
Global Variables
Strings
Declared Metadata
Property Modifier
Key Modifier
Type Casting
If & Else Statments
Repeat & Repeat Each
Functions & Macros
Menus
Global variables, like magic variables are not mutable. These variables are available anywhere in a shortcut, and are used like any other variable that you would normally declare. They can be used within text, by using the
${}
syntax just like any other variable.
Shortcut input can be used to retrieve whatever input was sent into the Shortcut. Shortcut input can be any of the following
//Inside Text
Text("Hello ${Shortcut Input}")
//Assiging a variable to the shortcut input
var input = Shortcut Input
This global variable will get the current item in the clipboard.
//Inside Text
Text("Hello ${Clipboard}")
//Assiging a variable to the current clipboard
var clippy = Clipboard
This global variable will get the current date.
//Inside Text
Text("Hello ${Current Date}")
//Assiging a variable to the current Current Date
var bestDayEver = Current Date
This variable will tell shortcuts that it needs to ask the user for the value it should represent. So if you wanted to ask the user their name to say hello, you could put ask into a string with the text hello in front of it.
//Ask the user there name
Text("Hello ${Ask}")
//Assiging a variable to a varaible the user should input
var bestDayEver = Ask
Check out the Strings documentation to see how to place a global variable into a string