This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
manual:Variables [2024/08/12 23:29] peternlewis |
manual:Variables [2025/03/01 22:08] (current) peternlewis [Variable Arrays] |
||
---|---|---|---|
Line 23: | Line 23: | ||
| **Global**, permanent variables | • Accessible basically everywhere, including Scripts.\\ • Permanently stored on your Mac drive. \\ • Available for read/write in any Macro or Action, not just the Macro where the Variable was created. \\ * Persist between logins and restarts of your Mac. \\ • You can also see and edit variables in the Preferences.\\ • You can see global variables in the [[Windows#Value_Inspector_Window |Value Inspector]]. | | | **Global**, permanent variables | • Accessible basically everywhere, including Scripts.\\ • Permanently stored on your Mac drive. \\ • Available for read/write in any Macro or Action, not just the Macro where the Variable was created. \\ * Persist between logins and restarts of your Mac. \\ • You can also see and edit variables in the Preferences.\\ • You can see global variables in the [[Windows#Value_Inspector_Window |Value Inspector]]. | | ||
| **Password**, semi-permanent variables | • Name must begin or end with “PW” or “password” (case insensitive).\\ • Stored only in memory. \\ • 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. | | | **Password**, semi-permanent variables | • Name must begin or end with “PW” or “password” (case insensitive).\\ • Stored only in memory. \\ • 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|Instance Variables]]**, local to a specific macro execution instance | • Name must begin with “instance” (case insensitive).\\ • 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.\\ • Accessible by [[action:Prompt_for_User_Input|Prompt For User Input]]\\ • Accessible by scripts (when used in an Execute Script Action).\\ • Accessible by [[action:Custom_HTML_Prompt|Custom HTML Prompt]].\\ • Accessible by AppleScript with the `instance` specifier. | | + | | **Instance Variables**, local to a specific macro execution instance | • Name must begin with “instance” (case insensitive).\\ • 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.\\ • Accessible by [[action:Prompt_for_User_Input|Prompt For User Input]]\\ • Accessible by scripts (when used in an Execute Script Action).\\ • Accessible by [[action:Custom_HTML_Prompt|Custom HTML Prompt]].\\ • Accessible by AppleScript with the `instance` specifier. | |
- | | **[[#Local_Variables|Local Variables ]]**, local to a specific macro | • Name must begin with "local" (case insensitive)\\ • Restricted to the specific Macro it is in.\\ • //Not// available to any of its Sub-Macros\\ • Same accessibility as Instance Variables. | | + | | **Local Variables**, local to a specific macro | • Name must begin with "local" (case insensitive)\\ • Restricted to the specific Macro it is in.\\ • //Not// available to any of its Sub-Macros\\ • Same accessibility as Instance Variables. | |
Macros can create or read existing variables, which persist and are permanently stored (except Local and Instance variables which are transient, and Password variables which are never saved to disk). | Macros can create or read existing variables, which persist and are permanently stored (except Local and Instance variables which are transient, and Password variables which are never saved to disk). | ||
Line 81: | Line 81: | ||
* By default the comma `,` is the delimiter (see below for setting a custom delimiter). | * By default the comma `,` is the delimiter (see below for setting a custom delimiter). | ||
* "`<IndexNumber>`" is an integer indicating the index (starting with 1) of the array value within the Variable Array. | * "`<IndexNumber>`" is an integer indicating the index (starting with 1) of the array value within the Variable Array. | ||
+ | * Negative indices start from the end of the array. | ||
+ | * Zero index returns the count. | ||
* This index can be determined using any [[manual:Calculations|Calculation]], including simply a Variable Name, like `i`. | * This index can be determined using any [[manual:Calculations|Calculation]], including simply a Variable Name, like `i`. | ||
* Examples: | * Examples: |