Adjust variables in Shortcuts on Mac
The variable editor appears when you click a variable in the shortcut editor, allowing you to access controls to set the content type, choose which details of the content to extract, rename the variable, or reveal the action that generated the variable.
Change a variable’s content type
Shortcuts automatically detects the type of content stored in a variable and uses that content as the variable’s default content type. You can force the variable to change content types.
In the Shortcuts app on your Mac, double-click a shortcut.
In the shortcut editor, click a variable token.
The variable editor appears. The Type pop-up menu indicates the content type used by the variable. For example, the Contents of Webpage variable displays URL as its variable type.
Click the Type pop-up menu and then select a new content type for the variable in the list that appears.
Σημείωση: If you choose a custom content type, Shortcuts uses its Content Graph technology to convert the content of the variable to the selected variable type. For example, if you have a variable that stores a URL, you can change its content type from URL to Article. Shortcuts will automatically fetch details about the article at that URL.
Choose a variable’s content details
In the Shortcuts app on your Mac, double-click a shortcut.
In the shortcut editor, click a variable token.
The variable editor appears. The properties offered by the specific content type are listed below the variable’s title and content type. This list represents all of the available metadata associated with your content, allowing you to choose which property to use as the output of the variable.
For example, an Image variable offers properties such as Width, Height, Date Taken, Location, and Camera Make. Each content type offers its own set of properties.
Each content type has a default property that’s automatically extracted if nothing else is chosen.
Click a property in the list.
The variable token is updated to indicate your preference.
Συμβουλή: You can manually grab properties from any action’s output by using the Get Details actions, such as Get Details of Safari Webpage or Get Details of Images. Browsing these actions is also a helpful way to explore which details you can extract for each content type.
Rename a variable
In the Shortcuts app on your Mac, double-click a shortcut.
In the shortcut editor, click a variable token.
The variable editor appears.
Enter the new name for the variable in the Variable Name field.
All instances of the variable are renamed.
Reveal the action that generated a variable
In longer shortcuts that contain multiple variables, you can use the Reveal button to show the original action that produced a variable.
In the Shortcuts app on your Mac, double-click a shortcut.
In the shortcut editor, click a variable token.
The variable editor appears.
Click Reveal.
The shortcut editor scrolls up and highlights the source action of the variable.
Click to return to the shortcut editor or click Go Back to return to the variable editor.
Once you’ve grasped how to add, place, and adjust variables, you’ll begin to see how variables make your shortcuts much more dynamic. You can reuse content multiple times, easily extract particular details from the content, and place that content anywhere in your shortcut.
Variables let you make shortcuts that are capable of adapting to a variety of situations, adjusting content on the fly while still yielding the results you want.
Συμβουλή: If you’re just getting started with variables, it may be helpful to experiment with an existing shortcut that includes variables. Add a shortcut from the Gallery, then reorder the actions or add new variables to see how the shortcut is affected.