User Tools

Site Tools


documentation:Variables

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
documentation:Variables [2016/05/30 06:24] peternlewisdocumentation:Variables [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-====== Variables ====== 
- 
-Keyboard Maestro includes permanently stored variables that you can use or set in many actions, as well as in [[Calculations]] or [[Text Tokens]] which can be used in almost any field in Keyboard Maestro. 
- 
-Variable names must start with a letter, and then can contain letters, numbers, spaces, or underscores.  Variable names are case insensitive, but their case is remembered. Variable names should not include a function or operator name with spaces around it (eg " MOD " , so "A MOD B" would not be a valid variable, although "MODULE" would be fine). 
- 
-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, though their consequences can easily be extracted, eg with the Set Clipboard to Text action.  The Prompt For User Input dialog will display such variables in a password field. 
- 
-Variable values are text, but they can contain comma separated numbers, and can then be accessed as arrays (eg Variable~~Name[1]).  Mouse positions, window frames and the like can then be stored and manipulated in variables, and you can access the fields with "struct" like forms like Variable~~Name.width (field names include: x, y, left, right, top, bottom, width, height, midx, midy, and fuzz). 
- 
-Variables values can be accessed from shell scripts or JavaScript for Applications via environment variables, and from AppleScript via environment variables or using AppleScript commands to the Keyboard Maestro Engine, and from JavaScript using the document.kmvar dictionary, see the [[Scripting]] section. 
- 
-You can also set a variable value to CODE{{{%Delete%}}} to avoid having it show up in variable popup menus.  This is also a good idea to do after a variable has contained sensitive information (like a password) or a large value (like a file or web page contents). 
- 
-There are various variables used by Keyboard Maestro to convey information, including: 
- 
-| Alert Button | the name of the button clicked in an alert | 
-| Result Button | the name of the button clicked in a Prompt For User Input dialog | 
- 
-Note that these variables can easily be overwritten by other actions, so you need to use caution when depending on them. 
- 
-The following special variables were: 
- 
-| Mounted Volume Name | replaced by the %TriggerValue% token | 
-| Mouse Click Result | replaced by the %ActionResult% token | 
-| Press Button Result | replaced by the %ActionResult% token | 
-| Select Menu Result | replaced by the %ActionResult% token | 
-| USB Device Name | replaced by the %TriggerValue% token | 
- 
-You can add a variable to an action using the [[Menus#Edit_Insert_Function_Variable|Variable command]] in the [[Menus#Edit_Insert_Function|Insert Function sub-menu]] in the [[Menus#Edit|Edit menu]] or [[Menus#Edit_Insert_Token_Variable|Variable command]] in the [[Menus#Edit_Insert_Token|Insert Token sub-menu]] in the [[Menus#Edit|Edit menu]], or by selecting from the popup menu next to some variable fields, or by using Type Completion. 
- 
-Variables are created on demand, but you can add, delete, see or change variables in the [[Windows#Preferences_Variables_Pane|Variables preference pane]], and you can read and write variables from AppleScript, see the [[Scripting]] section. 
  
documentation/Variables.1464589456.txt.gz · Last modified: by peternlewis

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki