Commands & Syntax >

www.perfectkeyboard.com

 

System Variables

 

System variables provide information that can be used in macro.  System variables content is set by program automatically and cannot be changed.


List of system variables:

Window Related

 

_vActiveWindow
 _vActiveWindow_HWND
 _vActiveWindowChild

Title of the currently active window.
 HWND of the currently active window.
 Title of the currently active child window (dialog box, toolbox, document window).

_vActiveWindowChild_HWND

HWND of the currently active child window (dialog box, toolbox, document window).

_vActiveWindowPrev
 _vActiveWindowPrev_HWND

Title of the previously active window.
HWND of the previously active window .

_vWinFromMouseCur
 _vWinFromMouseCur_HWND

Title of main window with mouse over.
HWND of main window with mouse over

_vChildWinFromMouseCur

Title of child window (dialog box, toolbox, document window) with mouse over.

_vChildWinFromMouseCur_HWND

HWND of child window (dialog box, toolbox, document window) with mouse over.

_vKeybdFocusWindow

Title of the window that is currently receiving keyboard input.

_vKeybdFocusWindow_HWND

HWND of the window that is currently receiving keyboard input.

_vKeybdFocusControl

Title of the window control that is currently receiving keyboard input.

_vKeybdFocusControl_HWND

HWND of the window control that is currently receiving keyboard input.

_vWinRectX1, _vWinRectY1,
 _vWinRectX2, _vWinRectY2,
 _vWinWdt,
 _vWinHgt,
 _vWinTitle,
 _vWinState,
 _vWinActive,
 _vWinClass ,
 _vWinHWND

 Attributes of the window retrieved using <wininfo> command.

_vMonitorCount
 _vMonitorPrimary
 _vMonitorWorkAreaX_MNum
  

Number of monitors
 Primary monitor number (1 or higher).
 Upper left X coordinate of a monitor work area. (Replace MNum by monitor number such as 1 - _vMonitorWorkX_1)

_vMonitorWorkAreaY_MNum
 _vMonitorWorkAreaCX_MNum
 _vMonitorWorkAreaCY_MNum
 _vMonitorScreenX_MNum
 _vMonitorScreenY_MNum
 _vMonitorScreenCX_MNum
 _vMonitorScreenCY_MNum
  

Upper left Y coordinate of a monitor work area.
 Width of a monitor work area.
 Height of a monitor work area.
 Upper left X coordinate of a monitor screen.
 Upper left Y coordinate of a monitor screen.
 Width of a monitor screen.
 Height of a monitor screen.

Date & Time Related

 

_vCurrDate_DefaultShort

Windows default short date format.

_vCurrDate_DefaultLong

Windows default long date format.

_vCurrDate_Day

Day of the current date (e.g., 9 if the date is 02/09/2000).

_vCurrDate_DD

Day of the current date in the DD format (e.g., 09)

_vCurrDate_DayName

Name of the day of the current date (e.g., Sunday, Monday, etc.).

_vCurrDate_DayOfWeek

Day of the week (e.g, 1 for Sunday, 2 for Monday, …, 7 for Saturday).

_vCurrDate_Month

Month of the current date (e.g., 02 if the date is 02/19/2000).

_vCurrDate_MM

Month of the current date in the MM format (e.g., 02).

_vCurrDate_Year

Year of the current date (e.g., 2000 if the date is 02/19/2000).

_vCurrDate_YY

Year of the current date in the YY format (e.g., 00).

_vCurrDate_MonthName

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 elapsed from the last reboot.

_vCurrDateTime_ForCalc

The macro language natively supports time calculations, however, the time needs to be in appropriate format which is "YYYY.MM.DD HH:MM:SS" (read more here).  This system variable contains current time in this format.

.

 

Files & Folders:

 

_vDirDateTime

Contains a string with current time and "Dir" prefix that can be used for file/directory naming.
 Example: "Dir_2007_11_24_~14~45~03"

_vFileDateTimeTXT

Contains a string with current time and "File" prefix and ".txt" extension that can be used for files naming.
 Example: "File_2007_11_24_~14~45~03.txt"

_vFileDateTimeDAT

Contains a string with current time and "File" prefix and ".dat" extension that can be used for files naming.
 Example: "File_2007_11_24_~14~45~03.dat"

_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 favorites 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.

_vFolder_AdminTools

Contains path to the admin tools folder.

_vFolder_BitBucket

Contains path to the recycle bin folder.

_vFolder_CDBurnArea

Contains path to the folder where files to be burned are stored.

_vFolder_CommonAdminTools

Contains path to the folder with admin tools for all users.

_vFolder_CommonAltStartup

Contains path to the folder corresponding with nonlocalized Startup program group for all users.

_vFolder_CommonDocuments

Contains path to the documents folder for all users.

_vFolder_CommonMusic

Contains path to the music folder for all users.

_vFolder_CommonPictures

Contains path to the pictures folder fro all users.

_vFolder_CommonTemplates

Contains path to the templates folder for all users.

_vFolder_CommonVideo

Contains path to the videos folder for all users.

_vFolder_Fonts

Contains path to the fonts folder.

_vFolder_InternetCache

Contains path to the IE cache folder.

_vFolder_MyDocuments

Contains path to the documents folder for logged user.

_vFolder_MyMusic

Contains path to the music folder for logged user.

_vFolder_MyPictures

Contains path to the pictures folder for logged user.

_vFolder_MyVideo

Contains path to the videos folder for logged user.

_vFolder_Resources

Contains path to the resource data folder.

_vReportDateTimeTXT

Contains a string with current time and "Report" prefix and ".txt" extension that can be used for files naming.
 Example: "Report_2007_11_24_~14~45~03.dat"

 

 

Drag & Drop:

The variables described here are only accessible after user drops file(s) on macro toolbar button. (Macro toolbars are only available in MacroToolbar and Macro Toolworks products.)  The variables allow to further process (delete, copy, rename, etc.) the file(s) dropped.
  

_vDropFile_FileFullPath

Full path to the file dropped.

_vDropFile_FileName

File name of the file dropped.

_vDropFile_FileDir

Directory of the file dropped.

_vDropFile_Num

The number of files dropped

 

 

Special Characters

 

_vCmdDelayKeyMs

Delay in milliseconds after each keystroke in macro. The default value is 0 (no delay). Setting this variable allows to slow down execution of keystrokes.

_vKeyReturn

'Return' (new line) key (use this key to add a new line to a text in variable).  Is equivalent to \r\n codes.

_vKeyNewLine

Contains equivalent to \n code (new line).

_vKeyCR

Contains equivalent to \r code (carriage return).

_vKeyTab

'Tab' key (use this key to add 'tab' to a text in variable).

_vQuoteChar

“ character (use this key to add “ to a text).

_vKeySpace

“space” character

_vKeyPercent

% character

_vKeyBigger

> character

_vKeySmaller

< character

_vKeyBracketL

( character

_vKeyBracketR

) character

_vKeySqBracketL

[ character

_vKeySqBracketR

] character

 _vKeyComma

, character 

 

 

Mouse & Keyboard Related

 

_vCmdDelayMouseMs

Delay in milliseconds after each mouse event (such as mouse button down, mouse move, mouse double-click, etc.) in macro. The default value is 5. Setting this variable allows to slow down (speed up) execution of mouse events.

_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.

_vCursorPosX

X-position (in absolute coordinates) of blinking cursor that is showing when editing text. If the cursor is not present or its position cannot be retrieved then the value is "0".

_vCursorPosY

Y-position (in absolute coordinates) of blinking cursor that is showing when editing text. If the cursor is not present or its position cannot be retrieved then the value is "0".

_vIsCapsLockON

Is set to YES if CapsLock is on.  Otherwise the variable contains NO.

_vIsNumLockON

Is set to YES if NumLock is on.  Otherwise the variable contains NO.

_vIsScrollLockON

Is set to YES if ScrollLock is on.  Otherwise the variable contains NO.

_vMouseCursorShape

Current shape of the mouse cursor. Can be one of these:
ARROW
BEAM
WAIT
CROSS
UPARROW
SIZENWSE
SIZENESW
SIZEWE
SIZENS
SIZEALL
NO
HAND
APPSTARTING
HELP

Clipboard Related

 

_vClpFormats

Contains comma separated list of formats of data currently saved in clipboard.

_vClpSize

Contains size of clipboard data.

_vClpText

Contains text clipboard data (if currently available). 

_vClpSequenceNumber

Contains clipboard sequence number that is increased any time the clipboard content is changed.

_vClpTextHistoryEnable

If this variable is set to "YES" (must be set by a macro) then the below _vClpText0, _vClpText1, etc. contains historical clipboard data.

._vClpText0, _vClpText1,...,_vClpText9

Contains historical clipboard textual data. _vClpText0 contains the newest data while _vClpText9 contains the oldest data. The content of the _vClpText0,...,_vClpText9 variables change always when new text data is copied to clipboard. The historical data is only collected if _vClpTextHistoryEnable is set to "YES".

Macro Flow Related

 

_vCanceled

The variable is set to 1 if a command (<form_show>, <extmacro>, <listbox>, <varset>, <var_oper>) si canceled  by user.  Otherwise the variable contains 0.

_vLoopCounter

Loop counter (see <begloop> and <endloop> commands). Starts from 1.

_vLoopCounter0

Loop counter (see <begloop> and <endloop> commands). Starts from 0.

_vIsConnectedToInternet

If the computer is connected to the Internet the variable value is equal to YES otherwise it is NO.

_vErr

If an error occurs during macro execution, the error description is saved in this variable.

_vIsExecOnlyCommands

After <cmds> command is executed, this variable content is YES. By default and after <keys> command is executed it is NO.

_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".

_vMacroParameter

This variable contains parameter that is passed to macro started using following commands:

 <run>
 <extmacro>
 <remote_macro_call>

 [Note: Unlike  other system variables, the value of this variable can be changed using <varset> command.]

_vMacroResult

This variable contains result returned from macro started using following commands:

 <run>
 <extmacro>
 <remote_macro_call>

 [Note: Unlike  other system variables, the value of this variable can be changed using <varset> command.]

_vMacroFileLoaded

Full path to the macro file currently loaded in the program.

It is also possible to write to this variable in order to force the program to load other macro file:
 <varset>("_vMacroFileLoaded=c:\....\otherfile.4tw","")
 Note: The other file is loaded when there is no macro currently executing.

_vMacroSharedFileLoaded

Full path to the shared macro file currently loaded in the program.

_vMacroFileFolder

Folder where the currently loaded macro file resides.  It is ended by \.

_vRunningMacroName

Contains name of the currently running macro.

_vRunningMacroId

Contains Id of the currently running macro.

_vMsgButton

The variable contains YES if "Yes" button was clicked in the <msg> command, otherwise it contains NO.

_vIsMacroEnabled_MACRONAME

 Such system variable exist for each macro.  The variable contains "1" if the macro is enabled, otherwise it is "0".  For example, if the macro name is "MyMacro1" then the associated system variable is "_vIsMacro_Enabled_MyMacro1".

_vIsGroupEnabled_MACRONAME

 Such system variable exist for each macro group.  The variable contains "1" if the macro group is enabled, otherwise it is "0".  For example, if the name of macro group is "FileMacros" then the associated system variable is "_vIsGroupEnabled_MyMacro1".

_vDoesVariableExist_VARIABLE

 Such system variable exist for each variable.  The variable contains "1" if the variable exists, otherwise it is "0".  For example, if the name of a variable is "vMyData" then the associated system variable is "_vDoesVariableExist_vMyData".

_vWaitForImage_PosX

This variable contains X position of the image that was found on the screen during <waitfor>(...IMAGE_ON_SCREEN...) command.

_vWaitForImage_PosY

This variable contains Y position of the image that was found on the screen during <waitfor>(...IMAGE_ON_SCREEN...) command.

 

 

Power Status (laptop)

 

_vPowerAcStatus

This variable is:

"1" if there is a power connected to the laptop

"0" if the power is is not connected to the laptop

"unknown" if the status is unknown (not laptop)

 _vPowerBatteryLifePercent

This variable contains either the percentage of battery charge remaining (value in the range 0 to 100) or "unknown" if status is unknown (not laptop).

_vPowerBatteryLifeSeconds

This variable contains either the number of seconds of the battery charge remaining or "unknown" if status is unknown (not laptop).

 

 

Other:

 

_vLastWebPageLoaded
_vLastAppExitCode

This variable contains URL of the web page last opened using <www_open> or <www_fillform>..
Exit code of last application that was executed by <execappex> command with parameter "wait for exited".

_vLastExecutedFileProcessId

_vOS_UserDefaultLanguageID

Process Id of the last file opened using <execappex> command.

Contains the language identifier of the current  Windows user locale.

_vOS_SystemDefaultLanguageID

Contains the language identifier of the Windows system locale.

_vStrEmpty

Empty string (use this variable to assign empty string to a variable).

_vIsScreensaverRunning

YES if screen saver is running.

_vIsScreensaverEnabled

YES if screen saver is enabled.

_vOperatingSystemVersion

Operating system version.

_vScreenWidth

Screen width in pixels.

_vScreenHeight

Screen height in pixels.

_vThisProgramVersion

Contains #THIS_PROGRAM# internal version.