×

Global Variables

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.

Available Global Variables

  1. Shortcut Input
  2. Clipboard
  3. Current Date
  4. Ask

Shortcut Input

Shortcut input can be used to retrieve whatever input was sent into the Shortcut. Shortcut input can be any of the following

  1. App Store Apps
  2. Articles
  3. Contacts
  4. Dates
  5. Email Addresses
  6. Files
  7. Images
  8. iTunes Prodcuts
  9. Locations
  10. Map Links
  11. Media
  12. PDFs
  13. Phone Numbers
  14. Rich Text
  15. Safari Web Pages
  16. Text
  17. URLs

Usage

//Inside Text
Text("Hello ${Shortcut Input}")

//Assiging a variable to the shortcut input
var input = Shortcut Input

Clipboard

This global variable will get the current item in the clipboard.

Usage

//Inside Text
Text("Hello ${Clipboard}")

//Assiging a variable to the current clipboard
var clippy = Clipboard

Current Date

This global variable will get the current date.

Usage

//Inside Text
Text("Hello ${Current Date}")

//Assiging a variable to the current Current Date
var bestDayEver = Current Date

Ask

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.

Usage

//Ask the user there name
Text("Hello ${Ask}")

//Assiging a variable to a varaible the user should input
var bestDayEver = Ask

Global Variables within a string

Check out the Strings documentation to see how to place a global variable into a string