This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
manual:Variables [2018/04/26 17:15] JMichaelTX Revise section on the Variables Panel |
manual:Variables [2019/06/14 02:52] peternlewis |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Variables ====== | ====== Variables ====== | ||
- | Keyboard Maestro includes variables with three different scopes of allowed access, in order of scope, with broadest scope first: | + | Like most programming languages, Keyboard Maestro allows you to create Variables to store data for use later on in the same Macro, or in other Macros. |
+ | |||
+ | Variables can be set from many actions. You can set variables to specific [[manual:Tokens| tokenised]] text, to the result of a [[manual:Calculations| calculations]], from user input, from the Keychain, by searching other variables, from the [[token:CurrentClipboard| clipboard]] or [[token:NamedClipboard|Named Clipboards]], as the result of [[:Scripting|scripts]], and from many other sources. | ||
+ | |||
+ | ===== Scope ===== | ||
+ | |||
+ | |||
+ | Keyboard Maestro includes variables with different breadth or scopes, in order of scope, with broadest scope first: | ||
^ Scope ^ Availability ^ | ^ Scope ^ Availability ^ | ||
| **Global**, Permanent variables | • Available Everywhere, including Scripts and Preferences. | | | **Global**, Permanent variables | • Available Everywhere, including Scripts and Preferences. | | ||
- | | **Password**, Permanent variables | • Available to macros but not displayed.\\ • Not directly accessible via AppleScript.\\ Displayed in password fields in Prompt For User Input actions. | | + | | **Password**, Semi-permanent variables | • Available to macros but not displayed.\\ • Not directly accessible via AppleScript.\\ • Concealed in password fields in Prompt For User Input actions.\\ • Not saved to disk. | |
- | | **Instance** Variables (v8+) | • Restricted to a specific execution sequence.\\ • Available to the Macro where it was created AND Sub-Macros of that Macro, for a given execution instance of the main macro.\\ • So these Variables are private to each execution of the same Macro, even when running simultaneously.\\ • Available to [[action:Prompt_for_User_Input|Prompt For User Input]]\\ • As of v8.0.3, is available to scripts (when used in an Execute Script Action), [[action:Custom_HTML_Prompt|HTML Prompt]] | | + | | **Instance** Variables (v8+) | • Restricted to a specific execution sequence.\\ • Available to the Macro where it was created and Sub-Macros of that Macro, for a given execution instance of the main macro.\\ • These Variables are private to each execution of the same Macro, even when running simultaneously.\\ • Available to [[action:Prompt_for_User_Input|Prompt For User Input]]\\ • As of v8.0.3, is available to scripts (when used in an Execute Script Action).\\ • Available in the [[action:Custom_HTML_Prompt|Custom HTML Prompt]] (v8.0.3+).\\ • Available via AppleScript with the instance specifier. | |
- | | **Local** Variables (v8+) | • Restricted to Macro where it was created\\ • //Not// Available to any of its Sub-Macros\\ • Available to [[action:Prompt_for_User_Input|Prompt For User Input]]\\ • As of v8.0.3, is available to scripts (when used in an Execute Script Action), [[action:Custom_HTML_Prompt|HTML Prompt]] | | + | | **Local** Variables (v8+) | • Restricted to Macro where it was created\\ • //Not// Available to any of its Sub-Macros\\ • Same availability as Instance Variables. | |
| **[[manual:Dictionaries|Dictionary]]**, Permanent, global in scope. | • Available Almost Everywhere, including Scripts, but //not// Preferences.\\ • Dictionaries consist of the //Dictionary Name//, One or more pairs of //Key Name//, and //Value//\\ • Although Dictionaries are like //Variables//, they are kept in a separate category called //[[manual:Dictionaries|Dictionaries]]//. | | | **[[manual:Dictionaries|Dictionary]]**, Permanent, global in scope. | • Available Almost Everywhere, including Scripts, but //not// Preferences.\\ • Dictionaries consist of the //Dictionary Name//, One or more pairs of //Key Name//, and //Value//\\ • Although Dictionaries are like //Variables//, they are kept in a separate category called //[[manual:Dictionaries|Dictionaries]]//. | | ||
Line 173: | Line 180: | ||
Local and Instance Variables are _not_ accessible from either the Preferences Window or from Scripting. | Local and Instance Variables are _not_ accessible from either the Preferences Window or from Scripting. | ||
- |