GetWindowPos


 

GetWindowPos>window_title,X,Y

 

Locates the window specified in window_title and retrieves its upper left screen coordinates.  X and Y are variables in which to store the coordinates.  window_title may be a variable or literal.

 

If the WIN_USEHANDLE variable is set to 1 window_title must be a window handle.

 

The window_title may contain the * symbol at the end to indicate a substring match.  

 

If the last character of the window title specified is an asterisk (*), Macro Scheduler will attempt to setfocus to the first window whose title matches the text entered exactly. If it cannot make an exact match it then looks at all windows and sets focus to the first one it finds whose title contains the entered text (using a case-insensitive search). This solves the problem with applications such as Word or Netscape 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 Macro Scheduler to only look for an exact match.

 

A Regular Expression can be used in window_title if WIN_REGEX is set to 1.

 

Abbreviation : GWP

See also: GetActiveWindow, CloseWindow, GetWindowSize

 

Example

 

GetWindowPos>My Computer,XWindowPos,YWindowPos

 

The following example achieves the same result as the MouseMoveRel command, moving to the point 10,10 relative to Notepad :

 

GetWindowPos>notepad*,npX,npY

Add>npX,10

Add>npY,10

MouseMove>npX,npY