User Tools

Site Tools


manual:Variables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
manual:Variables [2018/03/13 22:43]
JMichaelTX Clarify Local vs Instance Variables
manual:Variables [2018/04/26 17:15]
JMichaelTX Revise section on the Variables Panel
Line 6: Line 6:
 | **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**,​ Permanent variables | • Available to macros but not displayed.\\ • Not directly accessible via AppleScript.\\ Displayed in password fields in Prompt For User Input actions. |
-| **Instance** Variables (v8+) | • Restricted ​ to a specific execution sequence.\\ • Available to Macro where it was createdAND Sub-Macros ​in 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.\\ • 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]] |
 | **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\\ • 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]] |
 | **[[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 139: Line 139:
 Variables values can be accessed from scripts you execute with Keyboard Maestro via environment variables, and from AppleScript using AppleScript commands to the Keyboard Maestro Engine, and from web browser JavaScript you execute with Keyboard Maestro via the document.kmvar dictionary, see the [[Scripting]] section for more details. Variables values can be accessed from scripts you execute with Keyboard Maestro via environment variables, and from AppleScript using AppleScript commands to the Keyboard Maestro Engine, and from web browser JavaScript you execute with Keyboard Maestro via the document.kmvar dictionary, see the [[Scripting]] section for more details.
  
-You can get and set Keyboard Maestro Variables in these types of scripts:+You can get and set Keyboard Maestro Variables ​(Global, Local, and Instance) ​in these types of scripts:
   * [[:​AppleScript|AppleScripts]]   * [[:​AppleScript|AppleScripts]]
   * [[action:​Execute_a_JavaScript_For_Automation#​GetSet_Keyboard_Maestro_Variables|JavaScript for Automation (JXA)]]   * [[action:​Execute_a_JavaScript_For_Automation#​GetSet_Keyboard_Maestro_Variables|JavaScript for Automation (JXA)]]
-  * [[action:​Execute_a_JavaScript_in_Google_Chrome|JavaScript in Safari or Google Chrome]]\\  +  * [[action:​Execute_a_JavaScript_in_Google_Chrome|JavaScript in Safari or Google Chrome]] (**Get only**)\\ 
-  * (Browser JavaScript can only GET Keyboard Maestro Variables. ​ They cannot be set there+
   * [[action:​Custom_HTML_Prompt#​Using_JavaScript|JavaScript in Custom HTML Prompts]] ​   * [[action:​Custom_HTML_Prompt#​Using_JavaScript|JavaScript in Custom HTML Prompts]] ​
-  * [[action:​Execute_a_Shell_Script|Shell Scripts]]+  * [[action:​Execute_a_Shell_Script|Shell Scripts]] ​(**Get only**)
   * [[action:​Execute_a_Swift_Script|Swift Scripts]]   * [[action:​Execute_a_Swift_Script|Swift Scripts]]
  
Line 169: Line 168:
 Fields that expect just a variable show a small BUTTON{{{V}}} in the field while editing it, and you can use Type Completion to complete variable names in such fields. Fields that expect just a variable show a small BUTTON{{{V}}} in the field while editing it, and you can use Type Completion to complete variable names in such fields.
  
-===== Accessing in the Preferences Window ​=====+===== View Your Entire List of Variables ​=====
  
-Variables are created on demand, but you can add, delete, see or change global variables in the [[Windows#​Preferences_Variables_Pane|Variables preference pane]].+You can add, delete, see or change global variables in the [[Windows#​Preferences_Variables_Pane|Variables preference pane]] ​that have been created by your macros and scripts. ​ There are no variable preferences to be set here.  This is sometimes called the "​Variables Panel" or "​Variables Tab" in Keyboard Maestro Preferences.
  
 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.
  
manual/Variables.txt · Last modified: 2023/09/29 04:44 by peternlewis