Commands & Syntax >

Macro Command Syntax

ww.MacroToolworks.com

There are commands without parameters and commands that can have parameters.

 

Commands Without Parameters

Macro commands without parameters have this syntax:

 

<command_without_parameters>

 

An example can be "<clpempty>" that clears clipboard content.

Note: Keyboard keys such as "Page Down" have also the same syntax (<pgdn>), however, if <cmds> command ("Macro execution: Ignore free text, execute ONLY COMMANDS") is in effect then the keys are not played back.

 

Commands With Parameters

Macro commands with parameters have this syntax:

 

<command_wit_parameters>("param1", param2, ...)

Command parameter can be:

 

1.Static text (constant)
  

2.Variable
  

3.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: <filecreate>(“c:\myfiles\%_vCurrDate_Year%-%_vCurrDate_MM%-%_vCurrDate_DD%.doc”,0).  This will create c:\myfiles\2000-08-19.doc file.
  

4.Expression
 

Specific Parameters

There are commands that takes parameters that have specific syntax.

 

HWND

This type of parameter identifies an application window. Windows-specific commands such as <actwin> takes this type of parameter. HWND is a unique handle Windows internally uses to identify each window.  The HWND can be retrieved by some commands (<wininfo>, <win_enumerate>) or is provided by some system variables (_vKeybdFocusWindow_HWND, _vActiveWindow_HWND, _vActiveWindowPrev_HWND).  While some other window attributes like window title or window class are not unique (there can be other windows with the same title or class) the HWND is unique.

Window Identifier Path (WIP)

Window Identification Path (WIP) is a sequence of information that allows to uniquely identify Window. The WIP is used as a parameter for many windows commands such as <win_findimage>, <win_captureimage>, <winclose>, etc. The user does not has to enter the WIP manually when editing a window command in visual editor. The user rather put mouse cursor on the window he/she wants to use and the WIP is created automatically. The WIP contains a hierarchical structure (parent/child) of the windows. Each window is defined by window title, window class and X, Y position (X,Y position is used for window identification only if there are multiple windows with the same window title and window class).

It is possible to use wildcards (* and ?) within a WIP. There are examples how "Notepad" window is activated:

<actwin>("[A*.txt - Notepad|Notepad|#0|#0]",0,0,"no")
- this command activates Notepad windows with titles such as "Audrey.txt - Notepad", "Aaron.txt - Notepad", "Abbey.txt - Notepad"

<actwin>("[B*.txt - Notepad|Notepad|#0|#0]",0,0,"no")
- this command activates Notepad windows with titles such as "Bred.txt - Notepad", "Boris.txt - Notepad", "Bradley.txt - Notepad"

<actwin>("[*.txt - Notepad|Notepad|#0|#0]",0,0,"no")
- this command activates Notepad windows with titles such as "Audrey.txt - Notepad", "Bradley.txt - Notepad", "Jane.txt - Notepad"

<actwin>("[Untitled - Notepad|Notepad|#0|#0]",0,0,"no")
- this command activates only Notepad window with title "Untitled - Notepad"

<actwin>("[*Notepad|Notepad|#0|#0]",0,0,"no")
- this command activates Notepad windows with titles such as "Audrey.txt - Notepad", "Untitled - Notepad", "page.html - Notepad"

XmlDocumentHandle

This is a unique number that identifies an open Xml file. It is obtained as a result of some Xml related commands.

XmlElementHandle

This is a unique number that identifies an Xml document element. It is obtained as a result of some Xml related commands.

Workbook Identifier

This is a unique number that identifies an open Excel workbook. It is obtained as a result of some Excel related commands.