The simpliest macro is just a text like "Hello World!". When "played back", keystrokes to produce given text are sent so that the text is "typed" to the target application (usually application that is active - i.e., receiving keyboard focus). Such simple macros are used to quicklly insert often used pieces of text (phrases, e-mail addresses, paragraphs, etc.) to different applications and documents. However, macros can also contain some commands. If there is a command within the macro then it is automatically recognized and executed.
Commands have its special syntax that makes it easier to recognize them within the whole macro text. The command usually looks like this:
("param1", param2, ...)
Parameter can be:
- Static text (constant)
- Combination of a static text and variables. Variable used in a combination with static text must be enclosed in % chars (“a text %vVariable% text continues…). For example, to create a file with name based on the current date you can use this: (“c:\myfiles\%_vCurrDate_Year%-%_vCurrDate_MM%-%_vCurrDate_DD%.doc”,0). This will create c:\myfiles\2000-08-19.doc file.
Expressions have this syntax: EXPR(expression) or EXPRXX(expression) where XX specifies how many digits follow after decimal point (real numbers). Expressions can be used as a parameter for almost all commands (see examples below).
Expressions support all basic mathematical operations and supports brackets.
Example1: (EXPR(%_vScreenWidth%/2), EXPR(%_vScreenHeight%/2))
The expressions support also time arithmetic's. The time must be in appropriate format which is "YYYY.MM.DD HH:MM:SS". The difference between two times is "time span" that has this format "Days HH:MM:SS". The time span is also used to add/subtract amount of time to/from given time. This operations are supported:
"Days HH:Mi:SS" = "YYYY.MM.DD HH:Mi:SS" - "YYYY.MM.DD HH:Mi:SS"
"YYYY.MM.DD HH:Mi:SS" = "YYYY.MM.DD HH:Mi:SS" + "Days HH:Mi:SS"
"YYYY.MM.DD HH:Mi:SS" = "YYYY.MM.DD HH:Mi:SS" - "Days HH:Mi:SS"
"Days HH:Mi:SS" = "Days HH:Mi:SS"+"Days HH:Mi:SS"
"Days HH:Mi:SS" = "Days HH:Mi:SS"-"Days HH:Mi:SS"
Example3: ("vTomorrowDate=EXPR(%_vCurrDateTime_ForCalc%+1 0:0:0)","") What date will be 1 day later (next day)?
Example4: ("vDate=EXPR(%_vCurrDateTime_ForCalc%-10 13:45:10)","") What date was before 10 days, 13 hours, 45 minutes and 10 seconds?
Example5: ("vTimeSpan=EXPR(%_vCurrDateTime_ForCalc%-2005.11.21 13:45:00)","") How much time left since 2005/11/21, 13:45:00?
There are these limitations on time input: 1970 <= YYYY <= 3000; 1 <= MM <= 12; 1 <= DD <= 31; 0 <= HH <= 23; 0 <= Mi <= 59; 0 <= SS <= 59
There are also commands that have no parameters. Such commands look like this: . An example of such command can be that cause F1 key is pressed, that cause that Windows "Run dialog" is opened, etc.
Each command can be visually edited so that it is not necessary to know the command syntax - just put cursor on the command and use "Edit command" button. There are 150+ commands designed to accomplish variety Windows automation tasks.
Special keys (like 'Enter', 'Page Down', etc.) use the same syntax as commands with no parameters:
Very important macro command is command. This command tells the macro language engine that only commands should be executed and the rest of the macro text should be ignored. This command is usually the first macro command in the macros that only consist of macro commands and their purpose is not inserting any text (send keystrokes).