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
manual:Variables [2023/09/29 04:44]
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: ​
Line 91: Line 93:
   * For Example: ​ `%Variable%myList1[i]:​%`,​ where the colon `:` is the delimiter used in the Variable Array.   * For Example: ​ `%Variable%myList1[i]:​%`,​ where the colon `:` is the delimiter used in the Variable Array.
   * Of course, the Variable Array, //myList1// in this case, //must// use the same custom delimiter.   * Of course, the Variable Array, //myList1// in this case, //must// use the same custom delimiter.
 +  * The delimiter can be any sequence of characters excluding the percent (%) character, eg `%Variable%myList1[i]---%` or `%Variable%myList1[i]-KMSPLIT-%` or `%Variable%myList1[i]\n%` as long as the array variable uses the same delimiter.
  
 **Simple Example of Variable Array** **Simple Example of Variable Array**
manual/Variables.1695977042.txt.gz · Last modified: 2023/09/29 04:44 by peternlewis