GetCaretPos
GetCaretPos>X,Y,Relative
GetCaretPos retrieves the X, Y coordinates of the text caret (text cursor) of the foreground window. The coordinates are returned in the variables provided. Set Relative to 0 to return absolute screen coordinates, or 1 to return coordinates relative to the window.
Abbreviation: GTP
GetCaretPos Example
SetFocus>notepad*
WaitReady>0
GetCaretPos>XCaret,YCaret,0
MouseMove>XCaret,YCaret
GetCursorPos
GetCursorPos>X,Y[,cursorType]
Returns the X and Y coordinates of the current mouse cursor position. X and Y are variables in which to store the coordinates. The optional cursorType return variable can be used to return the cursor type.
Abbreviation : GCP
GetCursorPos Example
GetCursorPos>XCursor,YCursor Message>Current Position : %XCursor%,%YCursor%LClick
LClick
Simulates a left button mouse click at the current point on the screen.
The following commands will produce the same result :
LDown LUpAbbreviation : LCl
LDblClick
LDblClick
Simulates a left mouse button double click at the current point on the screen.
The following will achieve the same result :
LClick LClickor
LDown LUp LDown LUpAbbreviation : LDb
LDown
LDown
Simulates a press of the left mouse button. This is like pressing the mouse button down but not releasing it. It is half of a click.
Issuing this command and then using MouseMove would implement dragging. Use LUp to complete the operation.
Abbreviation : LDo
LUp
LUp
Releases the left mouse button. It is the latter half of a click.
MClick
MClick
Simulates a middle button mouse click at the current point on the screen.
The following commands will produce the same result :
MDown MUpAbbreviation : MCl
MDblClick
MDblClick
Simulates a middle mouse button double click at the current point on the screen.
The following will achieve the same result :
MClick MClickor
MDown MUp MDown MUpAbbreviation : MDb
MDown
MDown
Simulates a press of the middle mouse button. This is like pressing the mouse button down but not releasing it. It is half of a click.
Abbreviation : MDo
MouseMove
MouseMove>X,Y
Moves the mouse cursor to screen position X,Y. 0,0 is the upper left hand corner of the screen. The maximum limits are determined by your screen resolution settings. Variables containing the coordinates can be used in the command.
To help determine a particular point on the screen, the macro window has a cursor monitor which updates as you move the cursor. See Creating Scripts.
Abbreviation : Mou
MouseMove Example
If position 504,252 is within the area taken up by a button, the following script would cause that button to be clicked :
MouseMove>504,252
LClick
MouseMoveRel
MouseMoveRel>X,Y
Moves the mouse cursor to the position X,Y relative to the upper left corner of the window currently in focus. 0,0 will be the upper left hand corner of the active window. Variables containing the coordinates can be used in the command.
The advantage of this command over the MouseMove command, is that this will not fail when the window changes its position or resizes, or if the screen resolution is changed.
Abbreviation : MMR
MouseMoveRel Example
If position 40,50 is a point relative to the current window, on a button, the following script would cause that button to be clicked :
MouseMoveRel>40,50
LClick
MouseOver
MouseOver>window_title,button/object_caption
Attempts to position the mouse cursor over the specified button (or object) of the specified window.
window_title can contain an asterisk (*) as with all other window functions. For buttons that have a hot key associated with them, and represented on the button by an underscored letter, pass a & character before that letter. e.g.: for a button called 'Close', send &Close.
If the last character of the window title specified is an asterisk (*), script will attempt to locate the first window whose title matches the text entered exactly. If it cannot make an exact match it then looks at all windows and stops at the first one it finds whose title contains the entered text. This solves the problem with applications such as Word or Explorer which change their titles depending on the document loaded. It is best to try to provide an exact (including case) window title to ensure the correct window is found, as many applications have multiple invisible windows with similar names. Specifying text without a trailing asterisk will force script to only look for an exact match.
window_title can end with an asterisk to indicate a substring match. WF_TYPE, WIN_USEHANDLE and WIN_REGEX directives are also accepted. See SetFocus for a more detailed explanation of how the asterisk, WF_TYPE, WIN_USEHANDLE and WIN_REGEX can be used to define how the window is located.
Abbreviation : MVR
MouseOver Example
RunProgram>rundll32.exe shell32.dll,Control_RunDLL TimeDate.cpl
WaitWindowOpen>Date and Time Properties
...
MouseOver>Date/Time*,OK
LClick
MUp
MUp
Releases the middle mouse button. It is the latter half of a click.
Abbreviation : MDo
RClick
RClick
Simulates a right button mouse click at the current point on the screen.
The following commands will produce the same result :
RDown RUpAbbreviation : RCl
RDblClick
RDblClick
Simulates a right mouse button double click at the current point on the screen.
The following will achieve the same result :
RClick RClickor
RDown RLUp RDown RUpAbbreviation : RDb
RDown
RDown
Simulates a press of the right mouse button. This is like pressing the mouse button down but not releasing it. It is half of a click.
Abbreviation : RDo
RUp
RUp
Releases the right mouse button. It is the latter half of a click.
Toolbar
Toolbar>window_title,toolbar_index,button_index
Positions the mouse cursor over the specified toolbar button of the specified window. Works only with toolbar objects of class ToolbarWindow32.
toolbar_index and button_index are integer values and begin at zero, where a toolbar_index of 0 indicates the first toolbar created on the window, and 1 the next and so on. Use Tools/View System Windows to find objects of class ToolbarWindow32 belonging to a window, and/or experiment to determine which index should be used.
Many modern menu systems are actually ToolbarWindow32 class objects rather than menu objects. Internet Explorer uses a ToolbarWindow32 for it's main menu.
window_title can contain an asterisk (*) as with all other window functions.
If the last character of the window title specified is an asterisk (*), script will attempt to locate the first window whose title matches the text entered exactly. If it cannot make an exact match it then looks at all windows and stops at the first one it finds whose title contains the entered text. This solves the problem with applications such as Word or Explorer which change their titles depending on the document loaded. It is best to try to provide an exact (including case) window title to ensure the correct window is found, as many applications have multiple invisible windows with similar names. Specifying text without a trailing asterisk will force script to only look for an exact match.
Abbreviation : TBR
Toolbar Example
Toolbar>Internet Explorer*,0,2
LClick
Comments
0 comments
Please sign in to leave a comment.