Macro is just a piece of text that can contain some commands. If the macro doesn't contain any command then it is just inserted to the currently active application as a plain text. It is the simpliest case. Such macros are usualy frequently used pieces of text like phrases, your address, your e-mail etc. If there is a command within the macro then it is automatically recognized and interpreted by the given way (all the other macro text that is not recognized as a command is just a text that is inserted into the active application).
Commands have its special syntax that
makes it easier to recognize them within the whole macro text. The command usually
looks like this:
<some_command>("param1", param2, ...)
There are also commands that have no parameters. Such commands look like this:
<command_noparam>
Each command can be visually edited so that it is not necessary to know the
command syntax. There are 100+ commands designed to accomplish variaty Windows
automation tasks. The commands cover these areas: time & date, files,
directories, internet, networking, windows,clipboard, macro flow control, text formatting
and more.
Special keys (like 'Enter', 'Page Down',
etc.) use the same syntax:
<enter>
<pgdn>
There is also a support for variables implemented. There are three basic types of variables:
All the variables (except system variables) can be used
also as an array without any special declaration. For the array, this syntax is
used:
varVariableName[index]
If a variable with the given index (for example, varName[10]) doesn't have a value
assigned yet the default value is empty string.
Text & Keys | I |
. |
Printable keys
(characters), such as a-z, A-Z, 0-9, etc., can be typed into the macro directly.
There is not a special command or syntax for inserting text. For special keys see the
table below: . |
||||
<back> | Back | <enter> | Enter (return) | |
<shift> | Shift | <ctrl> | Ctrl | |
<alt> | Alt | <capslock> | Caps Lock | |
<esc> | Escape | <pgup> | Page up | |
<pgdn> | Page down | <end> | End | |
<home> | Home | <left> | Left arrow key | |
<up> | Up arrow key | <down> | Down arrow key | |
<right> | Right arrow key | <insert> | Insert | |
<delete> | Delete | <tab> | Tab | |
<F1>-<F12> | F1 - F12 function keys | <break> | Break | |
<clear> | Clear | <select> | Select | |
<execkey> | Execute key | <lwinkey> | Left Windows key | |
<rwinkey> | Right Windows key | <appskey> | Application key | |
<scroll> | Scroll | <numlock> | Num Lock | |
<numpad0> - <numpad9> | Numpad keys 0 - 9 | <numpad+> | Numpad + key | |
<numpad*> | Numpad * key | <numpad-> | Numpad - key | |
<numpad/> | Numpad / key | <printscreen> | Print Screen |
. | |
Time & Date | I |
. |
<time> | Insert time | <ct:m> | Insert minute | |
<date> | Insert date | <ct:mlz> | Insert minute (with leading zero) | |
<td:d> | Insert day | <ct:h24lz> | Insert hour (24 hours base, leading zero) | |
<td:dlz> | Insert day (with leading zero) | <ct:h12lz> | Insert hour (12 hours base, leading zero) | |
<td:m> | Insert month | <ct:ampm> | Insert "am/pm" | |
<td:mlz> | Insert month (with leading zero) | <ct:AMPM> | Insert "AM/PM" | |
<td:y> | Insert year | |||
<ct:h24> | Insert hour (24 hours base) | |||
<ct:h12> | Insert hour (12 hours base) |
. | |
File | I |
. |
<execappex> | Start (execute) application | <filedel> | Delete file(s) | |
<fileopen> | Open file | <fileinfo> | Get file info (size, time, etc.) | |
<filecreate> | Create new file | <data_load> | Load text data from file | |
<filecopy> | Copy file(s) | <data_save> | Save text data to file | |
<filemove> | Move file(s) |
. | |
Directory | I |
. |
<dircreate> | Create directory (folder) | <dirmove> | Move directory | |
<diropen> | Open directory | <dirdel> | Delete directory | |
<dircopy> | Copy directory |
. | |
Internet | I |
. |
<wwwopen> | Open web page | <email> | Create e-mail | |
FTP | ||||
<ftp_getfile> | Download file from FTP server | <ftp_createdir> | Create new directory on FTP server | |
<ftp_putfile> | Upload file to FTP server | <ftp_deldir> | Delete directroy on FTP server | |
<ftp_delfile> | Delete file | |||
<ftp_renamefile> | Rename file on FTP server |
. | |
Networking | I |
. |
<netcondrive> | Connect network drive | <netcondrivedlg> | Connect network drive dialog window | |
<netdiscondrive> | Disconnect network drive | <netdiscondrivedlg> | Disconnect network drive dialog window |
.. | |
Window | I |
. |
<actwin> | Activate window | <winstate> | Change window state | |
<winmove> | Move window | <winclose> | Close window | |
<winresize> | Resize window | |||
Desktop Windows | ||||
<winminall> | Minimize all windows (no parameters) | <wintile_v> | Tile windows vertically (no parameters) | |
<wintile_h> | Tile windows horizontally (no parameters) | <wincascade> | Cascade windows (no parameters) |
.. | |
Clipboard | I |
. |
<clpsave> | Save clipboard data to file | <clpempty> | Empty clipboard (no parameters) | |
<clpload> | Load clipboard data from file | <clpput> | Put text data to clipboard | |
<clppastetext> | Paste text |
. | |
System | I |
. |
<findfilesdlg> | Find file dialog window (no parameters) | <scrsavestart> | Start default screen saver (no parameters) | |
<findcompdlg> | Find computer dialog window (no parameters) | <shutdown> | Shutdown computer | |
<rundlg> | Run dialog window (no parameters) | <setsystime> | Set system time | |
<contextmenu> | Show context menu (no parameters) | <setsysdate> | Set system date | |
<recbinempty> | Empty recycle bin (no parameters) | <beep> | Play sound | |
<post_win_msg> | Post Windows Message (PostMessage API call) |
. | |
Message | I |
. |
<msg> | Show a message window. | <msgoff> | Close message window (no parameters). This command is used to close a message window with no OK button. |
. | |
Mouse | I |
. |
<mm> | Move mouse cursor | <mousemove_relative_win> | Mouse move is relative to active window (no parameters). | |
<mousemove_absolute> | Mouse move is in absolute screen coordinates (no parameters). | <mousemove_relative_win> | Mouse move is relative to current mouse position (no parameters). | |
<mlbd> | Mouse left button down (no parameters) | <mmbu> | Mouse middle button up (no parameters) | |
<mlbu> | Mouse left button up (no parameters) | <mrbd> | Mouse right button down (no parameters) | |
<mmbd> | Mouse middle button down (no parameters) | <mrbu> | Mouse right button up (no parameters) |
. | |
Variables | I |
. |
<varset> | Declare and set variable | <var_load> | Load variable value from file | |
<varchng> | Modify (change) variable value | <var_save> | Persist (save) variable to file | |
<varout> | Output (print) variable to destination application |
.. | |
Macro Flow Control | I |
. |
Calls | ||||
<run> | Run other macro (item) | <listbox> | Show selection list box window to choose from multiple macros | |
<extmacro> | Run macro from external file | |||
If-Else | ||||
<if> | If - compare variables | <if_clp> | If clipboard is empty | |
<if_win> | If window is opened,active, etc. | <else> | Starts oposite branch to <if...> branch. | |
<if_file> | If file exists, is bigger than, etc. | <endif> | Closes the IF section. Each <if...> must be close by <endif> | |
<if_dir> | If directory exists | |||
Go to | ||||
<goto> | Jump to a predefined (by <label>) point in the macro | <label> | Point in the macro where it is possible to jump using <goto> | |
Loop | ||||
<begloop> | Begin loop | <endloop> | End loop (no parameters). See <begloop>. | |
Wait/Pause | ||||
<pause> | Pause macro for users input | <waitfor> | Wait for special event to occur (window close, key press, etc.) | |
<wx> | Wait X milliseconds | |||
Other | ||||
<faston> | Send keystrokes fast | <commands_only_on> | Consider only commands in macro | |
<fastoff> | Send keystrokes slow (see <faston>). | <commands_only_off> | Consider whole the macro text (see <commands_only_on) | |
<exitmacro> | Stop macro execution (no parameters). |
. | |
Text Formatting | I |
. |
<text> | Format text |
. | |
Forms | I |
. |
<form_item> | Define form item | <form_show> | Show form window |
Windows: | ||
_vActiveWindow | Contains title of the currently active window | |
._vActiveWindowPrev | Contains title of the previously active window | |
Macro Flow Control: | ||
_vLoopCounter | Loop counter (see <begloop> and <endloop> commands). | |
. | ||
Date & Time: | ||
_vCurrDate_Day | Contains day of the current date (e.g., 19 if the date is 02/19/2000). | |
_vCurrDate_DayOfWeek | Contains day of the week of the current date (Sunday is 1, Monday is 2, etc.). | |
_vCurrDate_Month | Contains month of the current date (e.g., 02 if the date is 02/19/2000). | |
_vCurrDate_Year | Contains year of the current date (e.g., 2000 if the date is 02/19/2000). | |
_vCurrDate_DayName | Contains name of the day of the current date (e.g., Saturday if the date is 02/19/2000). | |
_vCurrDate_MonthName | Contains name of the month of the current date (e.g., February if the date is 02/19/2000). | |
_vCurrDate_DDMMYYYY | Contains current date in DD/MM/YYYY form. | |
_vCurrDate_MMDDYYYY | Contains current date in MM/DD/YYYY form. | |
_vCurrTime_Hour12 | Contains hour of the current time (e.g., 2 if the current time is 2:15:00 PM). | |
_vCurrTime_Hour24 | Contains hour of the current time (e.g., 14 if the current time is 2:15:00 PM). | |
_vCurrTime_Minute | Contains minute of the current time (e.g., 15 if the current time is 2:15:00 PM). | |
_vCurrTime_Second | Contains second of the current time (e.g., 0 if the current time is 2:15 PM). | |
_vCurrTime_AMPM | Contains PM/AM of the current time (e.g., PM if the current time is 2:15 PM). | |
_vCurrTime_Total | Contains the number of milliseconds ellapsed from the last reboot. | |
. | ||
Files & Folders: | ||
_vFolder_AppData | Contains path to the application data folder. | |
_vFolder_CommonDesktop | Contains path to the all users desktop folder. | |
_vFolder_CommonPrograms | Contains path to the all users start menu programs folder. | |
_vFolder_CommonStartMenu | Contains path to the all users start menu folder. | |
_vFolder_Cookies | Contains path to the cookies folder. | |
_vFolder_Desktop | Contains path to the desktop folder. | |
_vFolder_Favourites | Contains path to the favourites folder. | |
_vFolder_Personal | Contains path to the personal folder. | |
_vFolder_Programs | Contains path to the start menu programs folder. | |
_vFolder_Recent | Contains path to the recent files folder. | |
_vFolder_SendTo | Contains path to the "send to" folder. | |
_vFolder_StartMenu | Contains path to the start menu folder. | |
_vFolder_Startup | Contains path to the start menu start up folder. | |
_vFolder_Templates | Contains path to the templates folder. | |
_vFolder_Windows | Contains path to the windows folder. | |
_vFolder_System | Contains path to the system folder. | |
_vFolder_Temp | Contains path to the temporary folder. | |
Keyboard & Mouse: | ||
_vLastMouseClick | Contains last mouse click event in the
<waitfor> command: <mlbu> - left button click <mmbu> - middle button click <mrbu> - right button click |
|
_vLastKey | Contains last key pressed in the <waitfor> command. | |
_vMousePosX | Mouse cursor position in the screen coordinates - X. | |
_vMousePosY | Mouse cursor position in the screen coordinates - Y. | |
_vKeyReturn | 'Return' (new line) key (use this key to add a new line to a text in variable). | |
_vKeyTab | 'Tab' key (use this key to add 'tab' to a text in variable). | |
. | ||
Drag & Drop: | ||
_vDropFile_FileFullPath | Full path to the file dropped on the MacroToolbar. | |
_vDropFile_FileName | File name of the file dropped on the MacroToolbar. | |
_vDropFile_FileDir | Directory of the file dropped on the MacroToolbar. | |
_vDropFile_Num | The number of files dropped | |
. | ||
Other: | ||
_vStrEmpty | Empty string (use this variable to assign empty string to a variable). | |
_vWinStarting | If the program is set to automatically start on windows startup then the _vWinStarting contains "YES" when the program is starting on windows startup. Otherwise the value is "NO". | |
. | ||
Example: | <#> This macro shows how to use
system variables <#> <execappex>("notepad.exe","","",0,0) Active window title: <varout>("_vActiveWindow",0) Current mouse position: (<varout>("_vMousePosX",0), <varout>("_vMousePosY",0)) System folders: <varout>("_vFolder_AppData",0) <varout>("_vFolder_CommonDesktop",0) <varout>("_vFolder_CommonPrograms",0) <varout>("_vFolder_CommonStartMenu",0) <varout>("_vFolder_Cookies",0) <varout>("_vFolder_Desktop",0) <varout>("_vFolder_Favourites",0) <varout>("_vFolder_Personal",0) <varout>("_vFolder_Programs",0) <varout>("_vFolder_Windows",0) <varout>("_vFolder_System",0) |