Quick Macro Commands


Tips:Press CTRL+F , find command
Keyboard
Commands

Software simulate mode
[KeyPress] [KeyDown] [KeyUp]
Hardware simulate mode
[KeyPressH] [KeyDownH] [KeyUpH]
Keyboard control command
[WaitKey]

[GetLastKey]

 

Mouse
Commands

Software simulate mode
[LeftClick] [RightClick] [MiddleClick]
[LeftDoubleClick] [LeftDown] [LeftUp]
[RightDown] [RightUp]  
[MoveTo] [MoveR] [MouseWheel]
Hardware simulate mode
[LeftClickH] [RightClickH] [MiddleClickH]
[LeftDoubleClickH]    
[LeftDownH] [RightDownH]  
[LeftUpH] [RightUpH]  
[MoveRH]    
Mouse control commands
[WaitClick] [GetLastClick]
Other mouse commands
[SaveMousePos] [RestoreMousePos]
[LockMouse] [UnlockMouse]

Control
Commands

Logic and repeat commands
[If] [Goto] [Rem]
[While] ... [EndWhile] [For] ... [EndFor] [EndScript]
Color control command
[IfColor]
Sub
[Sub] . [Return] [Gosub]  

Other
Commands

[Delay] [MessageBox] [SayString]
[Import]

[VBSBegin] ...[VBSEnd]

[VBS]
[VBSCall]

[Plugin]

[UserVar]
[PutAttachment] [//]  

VBScrit
Commands

[VBSCall Delay] [VBSCall FindCenterColor]

[VBSCall FindColor]
[VBSCall FindColorEx

[VBSCall FindPic]

[VBSCall GetCursorPos]
[VBSCall GetPixelColor]
[VBSCall GetScreenResolution]
[VBSCall InputBox]
[VBSCall MessageBox] [VBSCall ReadMemory] [VBSCall RunApp]
[VBSCall SayString] [VBSCall SetCursorPos] [VBSCall GetCursorShape]

[KeyPress]
Format: KeyPress {Virtual key code} {Times}
Description: Simulate the key press action: First press down the key and then release.
Usually we have two actions on the keyboard: "press down" and "release".
A sequence of the two actions can be taken as a complete "key press" action.

[KeyDown]
Format: KeyDown {Virtual key code} {Times}
Description: Simulate the key press down action
Notice: Some key can combine with others after pressed down, such as "Alt/Ctrl/Shift".
Therefore, when Alt key pressed down, the consequent key press will become a key combination, such as "Alt+A".
You should release the pressed key in time, otherwise your keyboard action will be impacted.

[KeyUp]
Format: KeyUp {Virtual key code} {Times}
Description: Simulate the key release up action

[KeyPressH]
Format: KeyPressH {Virtual key code} {Times}
Description: First press down the key and then release, similar with the command KeyPress, but uses the hardware simulation mode.
In some special cases, the common mode can not work. Please try the hardware simulation.

[KeyDownH]
Format: KeyDownH {Virtual key code} {Times}
Description: Simulate the key press down action, similar with KeyDown, but uses the hardware simulation mode.
In some special cases, the common mode can not work. Please try the hardware simulation.

[KeyUpH]
Format: KeyUpH {Virtual key code} {Times}
Description: Simulate the key release action, similar with KeyUp, but uses the hardware simulation mode.
In some special cases, the common mode can not work. Please try the hardware simulation.

[LeftClick]
Format: LeftClick {Times}
Description: Simulate the left mouse button click on current cursor position.

[RightClick]
Format: RightClick {Times}
Description: Simulate the right mouse button click on current cursor position.

[MiddleClick]
Format: MiddleClick {Times}
Description: Simulate the middle mouse button click on current cursor position.

[LeftDoubleClick]
Format: LeftDoubleClick {Times}
Description: Simulate the left mouse button double click on current cursor position.

[LeftDown]
Format: LeftDown {Times}
Description: Simulate the left mouse button press down action.

[LeftUp]
Format: LeftUp {Times}
Description: Simulate the left mouse button release action.

[RightDown]
Format: RightDown {Times}
Description: Simulate the right mouse button press down action.

[RightUp]
Format: RightUp {Times}
Description: Simulate the right mouse button release action.

[LeftClickH]
Format: LeftClickH {Times}
Description: Simulate the left mouse button click on current cursor position, but uses the hardware simulation mode.
In some special cases, the common mode can not work. Please try the hardware simulation.

[RightClickH]
Format: RightClickH {Times}
Description: Simulate the right mouse button click on current cursor position, but uses the hardware simulation mode.
In some special cases, the common mode can not work. Please try the hardware simulation.

[MiddleClickH]
Format: MiddleClickH {Times}
Description: Simulate the middle mouse button click on current cursor position, but uses the hardware simulation mode.
In some special cases, the common mode can not work. Please try the hardware simulation.

[LeftDoubleClickH]
Format: LeftDoubleClickH {Times}
Description: Simulate the left mouse button double click on current cursor position, but uses the hardware simulation mode.
In some special cases, the common mode can not work. Please try the hardware simulation.

[LeftDownH]
Format: LeftDownH {Times}
Description: Simulate the left mouse button press down action, but uses the hardware simulation mode.
In some special cases, the common mode can not work. Please try the hardware simulation.

[LeftUpH]
Format: LeftUpH {Times}
Description: Simulate the left mouse button release action, but uses the hardware simulation mode.
In some special cases, the common mode can not work. Please try the hardware simulation.

[RightDownH]
Format: RightDownH {Times}
Description: Simulate the right mouse button press down action, but uses the hardware simulation mode.
In some special cases, the common mode can not work. Please try the hardware simulation.

[RightUpH]
Format: RightUpH {Times}
Description: Simulate the right mouse button release action, but uses the hardware simulation mode.
In some special cases, the common mode can not work. Please try the hardware simulation.

[MoveTo]
Format: MoveTo {X coordinates} {Y coordinates}
Description: Move mouse cursor to position (X coordinates,Y coordinates).
Example:
MoveTo 100 200
Move mouse cursor to position (100,200).
MoveTo intX intY
Move mouse cursor to position (intX,intY).

[MoveR]
Format: MoveR {X distance} {Y distance}
Description: Relatively move mouse cursor with (X distance,Y distance)
Example:
The cursor position is currently (100,100).
After this command executes:
MoveR 200 300
The cursor position becomes (100+200,100+300), it is the coordinates of (300,400) in the screen.

[MouseWheel]
Format: MouseWheel {Units}
Description: Rotate the mouse wheel. If the 'Units' is positive, it will rotate upward; otherwise downward.
Only the operating system Windows 2000 or upper can be supported.
Example:
MouseWheel 1
Rotate the mouse wheel upward for one unit.

[MoveRH]
Format: MoveR {X distance} {Y distance}
Description: Relatively move mouse cursor with (X distance,Y distance),but uses the hardware simulation mode.
In some special cases, the common mode can not work. Please try the hardware simulation.

[SaveMousePos]
Format: SaveMousePos
Description: Save the current cursor position

[RestoreMousePos]
Format: RestoreMousePos
Description: Move the cursor to last saved position

[LockMouse]
Format: LockMouse
Description: Lock the mouse cursor position. User can not move cursor using physical mouse, while the macro can move it.
Example: Use this command on the start of your macro script, to avoid the macro confusion from a involuntary touch of the mouse.

[UnlockMouse]
Format: UnlockMouse
Description: Release the lock of the mouse cursor position by LockMouse command.
If you have used LockMouse command without corresponding UnlockMouse, the UnlockMouse will be executed automatically at the end of the macro running.

[WaitKey]
Format:WaitKey {Optional: variable name}
Description: Macro will pause untill any keyboard action. As an option, you can save the pressed key code to the variable.

[GetLastKey]
Format:GetLastKey {Optional: variable name}
Description: Macro will save the last pressed key to the variable without pause.

[WaitClick]
Format: WaitClick {Optional: variable name}
Description: Macro will pause untill any mouse button pressed. As an option, you can save the pressed button code to the variable.
Example: WaitClick last_click
VBSCall MessageBox("You have pressed " & last_click)

[GetLastClick]
Format: GetLastClick {Optional: variable name}
Description: Macro will save the last pressed mouse button to the variable without pause.

[Delay]
Format: Delay {Time}
Description: Macro delays for a period of time and then continues. The delayed time is specified by the parameter in milliseconds
Notice:
1 second = 1000 milliseconds
1 minute = 60000 milliseconds
1 hour = 3600000 milliseconds

[MessageBox]
Format: MessageBox {Expression}
Description: Macro pauses, and a message box pops up. The text on the message box is specified by the parameter. After user click 'OK' button, the macro continues.

[SayString]
Format: SayString {Expression}
Description: Type the text specified by the parameter in the current focused input box.
Example:
SayString "Hello, world"
SayString x+y

[Sub]
Format:
Sub {Subprogram name}

Return
Description: Define a subprogram which can be called in the macro script.

[Return]
Format:
Sub {Subprogram name}

Return
Description: Define a subprogram which can be called in the macro script.

[Gosub]
Format:
GoSub {Subprogram name}
Description: Call a defined subprogram

[Rem]
Format: Rem {Text}
Description: Define a named marker as the target of Goto command.

[If]
Format:
If {Expression}

ElseIf

Else

EndIf
Description: Judge the expression, and execute the statements in condition branch.

[IfColor]
Format:
IfColor {X coordinates} {Y coordinates} {color} {conditon}

ElseIf

Else

EndIf
Description: Judge whether the color of the point in (X coordinates,Y coordinates) is equal/not equal/approximately equal to the specified color, and execute the statements in condition branch.

[Else]
Format: If {Expression}…ElseIf…Else…EndIf
or IfColor {X coordinates} {Y coordinates} {color} {conditon}…ElseIf…Else…EndIf
Description: Combine with the command If or IfColor to compose a condition branch block.

[ElseIf]
Format: If {Expression}…ElseIf…Else…EndIf
or IfColor {X coordinates} {Y coordinates} {color} {conditon}…ElseIf…Else…EndIf
Description:Combine with the command If or IfColor to compose a condition branch block.

[EndIf]
Format: If {Expression}…ElseIf…Else…EndIf
or IfColor {X coordinates} {Y coordinates} {color} {conditon}…ElseIf…Else…EndIf
Description:Combine with the command If or IfColor to compose a condition branch block.

[While]
Format:While {Expression}...EndWhile
Description: The common used loop block, repeat executing the statements between While and EndWhile until expression is not true.

[EndWhile]
Format:While {Expression}...EndWhile
Description: Combine with the command While to compose a loop block.

[For]
Format: For {Times}...EndFor
Description: The simple loop block, repeat executing the statements between For and EndFor some specified times.

[EndFor]
Format:For {Times}...EndFor
Description: Combine with the command For to compose a loop block.

[Goto]
Format: Goto {Marker}
Description: Unconditional jump to the defined marker(by Rem command) and execute from the marker.

[EndScript]
Format: EndScript
Description: Stop the macro running.

[Import]
Format: Import {VBScript file}
or Import {Plug-in DLL file}
Description: Import a VBScript file or plug-in dll file. After imported, the functions in the VBScript file or plug-in can be used directly without VBSCall or Plugin command.
If you want to call a function in VBScript file or plug-in in VBScript block, you must use the Import command. The VBSCall or Plugin command is not supported.

Example:
Import "stdlib.vbs"
name=InputBox("Input your name please")

[VBSBegin]
Format: VBSBegin...VBSEnd
Description: Compose a VBScript block. You can use any VB Script statements(including condition branch, sub program call in VB Script) in the VBScript block, most of the Quick Macro commands are also supported in VBScript block.

[VBSEnd]
Format: VBSBegin...VBSEnd
Description: Compose a VBScript block. You can use any VB Script statements(including condition branch, sub program call in VB Script) in the VBScript block, most of the Quick Macro commands are also supported in VBScript block.

[VBS]
Format: VBS {VB Script statement}
Description: Execute a single line VB Script statement. The keyword 'VBS' can be omitted.
Notice: Only the single line VB Script statement is supported in this command. The multi-line VB Script statements such as If...EndIf,While...Wend are not supported.

[VBSCall]
Format: VBSCall {Extern VB Script function}
Description: Execute an extern VB Script function in a VB Script file. The mostly used VB Script file is the standard library 'stdlib.vbs', it includes many useful functions such as finding color or finding picture in the screen.

[Plugin]
Format: Plugin {Plug-in name}.{Plug-in function}
Description: Call a function provided by a plug-in. Several plug-in files with complex functions will be included in Quick Macro.

[UserVar]
Format: UserVar {variable name}={default value} {comments}
Description: This command will provide a setup interface for the macro user.
Example:
UserVar var1=30 Use the red pill when the health value is lower than x%
UserVar var2=30 Use the blue pill when the magic value is lower than x%
The macro user can set the value of var1 and var2 in 'Macro properties', to define the working threshold for a auto-supply macro

[PutAttachment]
Format:PutAttachment ;Optional: path;
Description: Extract the macro attachment files to the specified path. The path can be relative or absolute.
The path can be omitted, in that case, the attachment files will be extracted to the folder of Quick Macro.

[//]
Note

------Stdio vbscript function-------

[VBSCall Delay]
VBSCall Delay(iMilliSecond)

[VBSCall FindCenterColor]
This function allows you to find the specified color from the center in a certain area of the screen and save the found coordinates into a varialbe
format
VBSCall Call FindCenterColor(left,top,right,bottom,c,x,y)
Find the point with the color of c from center to outside inside the area and save the coordinates into variables x and y
left,top,right,bottom are integers or integer variables,describing the left,top,right and bottom boundary lines
Color is character string like "0000FF". If not to get variable, don't forget to put it in double quotation marks
If the color has not been found, then the values for x and y will be put -1
for example
VBSCall Call FindCenterColor(0,0,800,600,"0000FF",x,y)
If x>=0 and y>=0
MoveTo x y
EndIf Find the point with the color of red ("0000FF") inside the area (0,0,800,600). If found, then move the mouse to this point

[VBSCall FindColor]
This function allows you to find the specified color in a certain area of the screen and save the found coordinates into a variable
format
VBSCall Call FindColor(left,top,right,bottom,c,x,y)
Find the points with the color of c from left to right and from top to bottom inside the area and save them into variables x and y
left,top,right,bottom are integers or integer variables,describing the left,top,right and bottom boundary lines
Color is character string like "0000FF". If not to get variable,don't forget to put it in double quotation marks
If the color has not been found,then the values for x and y will be put -1
for example
VBSCall Call FindColor(0,0,800,600,"0000FF",x,y)
If x>=0 and y>=0
MoveTo x y
EndIf Find the point with the color of red ("0000FF") inside the area (0,0,800,600). If found, then move the mouse to this point

[VBSCall FindColorEx]
This function will allow you fuzz find the specified color in a certain area of the screen and save the found coordinates into variables
format
VBSCall Call FindColorEx(left,top,right,bottom,c,type,similar,x,y)
Find the point with the color of c inside the area and save the coordinates into variables x and y
left,top,right,bottom are integers or integer variables,describing the left,top,right and bottom boundary lines
Color is character string like "0000FF". If not to get variable, don't forget to put it in double quotation marks
type indicates find mode. 0 indicates find from top to bottom, from left to right; 1 indicates find from center to outside
similar indicated similarity, only select decimals between 0.3 and 1. The greater the numerical value is,the stricter it requires for similarity. It is recommended to select 0.8
If the color has not been found,then the values for x and y will be put -1
for example
VBSCall Call FindColorEx(0,0,800,600,"0000FF",1,0.8,x,y)
If x>=0 and y>=0
MoveTo x y
EndIf Find the point with the color close to red ("0000FF") from the center inside the area (0,0,800,600). If found,then move the mouse to this point

[VBSCall FindPic]
This function allows you to find the picture with the specified similarity in a certain area of the screen and save the coordinates into variables.
format
VBSCall Call FindPic(left,top,right,bottom,filename,similar,x,y)
Find the bmp file named filename from left to right and then from top to bottom inside the area and save the found coordinated into variables x and y
left,top,right,bottom are integers or integer variables, describing the left,top,right and bottom boundary lines of the area
filename is a picture in bmp format. You need to pick it by yourself. 24-bit is preferable. Set the edge a single color
similar indicates similarity, select decimals between 0.5 and 1. The greater the numerical value is, the stricter it requires for picture similarity and the faster the speed is. It is recommended to select 0.9
If the picture has not been found, then the values for x and y will be put -1
It is recommended to use the picture with single-color edge as shown in the following picture. The QQ picture on the right works much better than the one on the left

for example
VBSCall Call FindPic(0,0,1023,767,"1.bmp",0.9,x,y)
If x>=0 and y>=0
MoveTo x y
EndIf Find inside the area (0,0,1023,767) the place similar to the picture in file 1.bmp. If found, then move the mouse to this place

[VBSCall GetCursorPos]
This function allows you get the current mouse position and save it into a variable
format
VBSCall Call GetCursorPos(x,y)
x and y are integer variable, representing x coordinate and y coordinate of the current mouse respectively
You can name a variable at will, not just limited to x and y
for example
VBSCall Call GetCursorPos(mx,my) Put x coordinate and y coordinate of the current mouse position into variables mx and my

[VBSCall GetPixelColor]
This function allows you to get the point color of the specified position and save it into a variable
format
color=GetPixelColor(x,y)
Save the color of the point (x,y) into character string varible color
x and y are integers or integer variables
for example
VBSCall Call GetCursorPos(x,y)
color=GetPixelColor(x,y)
VBSCall Call MessageBox(color) get the current point color and popup a message box to display it

[VBSCall GetScreenResolution]
VBSCall GetScreenResolution(cx,cy)
Save the screen resolutioni to cx and cy variable

[VBSCall InputBox]
This function allows a popup "Input" message box for script users to input some characters
format
x=InputBox(Words prompting the user, for example "Please input password")
Save the information input by the user into variable x
If the prompt information is not a variable, don't forget to put it in double quotation marks
for example
x=InputBox("Please input password")
MessageBox(x) Let users input password and display it

[VBSCall MessageBox]
This function will allow a popup message box in your script and the text in the message box can be variables!
format
VBSCall Call MessageBox(text in message box)
If the text in the message box is not a variable,don't forget to put it in double quotation marks
for example
VBSCall Call MessageBox(CStr(i))Change variable i content into character string and display it

[VBSCall ReadMemory]
This function allows you to get the value of the specified memory address of the current active program and save it to variables
format
VBSCall Call ReadMemory(the memory address expressed in hexadecimal integer,read type,value)
Memory address is hexadecimal integer like &H400000,which can be found in game modification tools. Don't forget to add &H which indicates hexadecimal
"read type" can be 0,1 or 2,indicating read one byte, one integer and one long integer respectively
The value read can be stored in the value of long integer variables
for example
VBSCall Call ReadMemory(&h400000,2,val)
MessageBox(CStr(val)) Read a long integer from memory address 400000 and display it

[VBSCall RunApp]
With this function, you can boot a local program or open a file very conveniently
format
VBSCall Call RunApp(the program or file to be run)
If the program path is not a variable, don't forget to put it in double quotation marks
for example
VBSCall Call RunApp("notepad.exe") Run Windows notepad program

[VBSCall SayString]
SayString(Prompt)

[VBSCall SetCursorPos]
VBSCall SetCursorPos(CursorX,CursorY)

[VBSCall GetCursorShape]
This function allows you to get current cursor shape character and save as an integer variable
format
shape=GetCursorShape(Reserved:please keep zero)
Get current cursor shape character as an integer, which usually be used for comparation
for example
VBSCall shape=GetCursorShape(0)
If shape=old_shape
VBSCall MessageBox(shape)
EndIf
Get current cursor shape and compare with variable old_shape the end line(Don't skip over this line)