Variables
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| Variables [2017/09/06 05:40] – peternlewis | Variables [2017/09/26 05:17] (current) – removed peternlewis | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Keyboard Maestro Variables ====== | ||
| - | Keyboard Maestro [[manual: | ||
| - | |||
| - | ===== Key Facts about Variables ===== | ||
| - | |||
| - | Keyboard Maestro has four types of variables, distinguished based on their name. | ||
| - | |||
| - | * [[# | ||
| - | * [[# | ||
| - | * [[# | ||
| - | * Variables — All other variables. | ||
| - | |||
| - | As described in the [[manual: | ||
| - | |||
| - | * Each Macro may create Variables and read existing Variables. | ||
| - | * Variables persist, permanently stored on your Mac (much like a file) until deleted. | ||
| - | * Variables are global, fully accessible (create, read, write, delete) by: | ||
| - | * All other Macros. | ||
| - | * Future or simultaneous executions of some macro. | ||
| - | * Scripts. | ||
| - | * AppleScript. | ||
| - | * //Keyboard Maestro Editor Preferences// | ||
| - | * **All Keyboard Maestro variables can contain only plain text**. | ||
| - | * However, you can use variables that contain numbers in calculations in [[https:// | ||
| - | |||
| - | |||
| - | ===== Setting Variables ===== | ||
| - | |||
| - | Variables are usually created and set by [[: | ||
| - | |||
| - | |||
| - | The most common Action to set a variable is, well, [[action: | ||
| - | |||
| - | {{ : | ||
| - | |||
| - | There are a number of other [[: | ||
| - | * [[action: | ||
| - | * [[actions: | ||
| - | * [[action: | ||
| - | |||
| - | In addition to these, there are a number of more complex Actions that can also set a variable. | ||
| - | |||
| - | When setting a variable, you will be using a text field in most cases. :!: Be aware that [[: | ||
| - | ===== Using Variables ===== | ||
| - | |||
| - | There are many Macro Actions that can use variables. | ||
| - | |||
| - | ==== Variable Tokens ==== | ||
| - | |||
| - | The // | ||
| - | where `< | ||
| - | |||
| - | For Example, using the [[action: | ||
| - | |||
| - | {{ : | ||
| - | |||
| - | You can (v7.2+) access a variable as if it is a comma separated array of text using the notation // | ||
| - | |||
| - | You can also use a short form of just //%Variable Name%// to include variables as long as the variable exists and has a value and there is no corresponding text token, although generally it is better and clearer to use the longer form // | ||
| - | |||
| - | You can also access variables in a token field numerically using the [[token: | ||
| - | |||
| - | ==== Variables in Calculations ==== | ||
| - | |||
| - | Variables can be used in calculations if their value holds a number or a numeric expression that can be evaluated. | ||
| - | |||
| - | ===== Using Variables in Scripts ===== | ||
| - | |||
| - | You can get and set Keyboard Maestro Variables in these types of scripts: | ||
| - | * [[: | ||
| - | * [[: | ||
| - | * [[action: | ||
| - | * (Browser JavaScript can only GET Keyboard Maestro Variables. | ||
| - | * [[action: | ||
| - | * [[action: | ||
| - | * [[action: | ||
| - | |||
| - | And you can generally access Keyboard Maestro variables anywhere else via [[: | ||
| - | |||
| - | Click on the above links for example scripts. | ||
| - | |||
| - | ===== Password Variables ===== | ||
| - | |||
| - | Variables with names that start or end with “Password” or “PW” are considered passwords – their values will not be stored (except in memory) and they cannot be read directly by shell scripts or AppleScripts, | ||
| - | |||
| - | You should set their values immediately after you are done with the password to reduce any change of erroneous access. | ||
| - | |||
| - | ===== Local Variables ===== | ||
| - | |||
| - | Variables with names that start with “Local ” or a double-struck L (𝕃) are considered local (v8+) to a specific instance of a specific macro. Each time the macro is run, they will start empty and no other macro will see or be able to change values. | ||
| - | |||
| - | ===== Instance Variables ===== | ||
| - | |||
| - | Variables with names that start with “Instance ” or a double-struck I (𝕀) are considered local (v8+) to a specific execution sequence. Each time the macro is run, they will start empty but their value can be seen and changed by other macros within the same execution sequence (for example, if you execute a macro using the Execute Macro action, that macro can see and change the instance variable). Since two instances of a macro can be running at the same time, this is useful to ensure they each have their own version of the variable. | ||
| - | |||
| - | |||
| - | |||
| - | ===== See Also ===== | ||
| - | |||
| - | ---- | ||
| - | |||
| - | === Actions === | ||
| - | |||
| - | * [[action: | ||
| - | * [[action: | ||
| - | * [[: | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== Forum ==== | ||
| - | |||
| - | - [[https:// | ||
| - | - [[https:// | ||
| - | |||
| - | - [[https:// | ||
| - | - [[https:// | ||
Variables.1504676412.txt.gz · Last modified: by peternlewis
