Macro Scheduler 15




Returns the window handle of the window specified by it's window title.


Window handles are assigned when a window is created by the system so they change from session to session.  Using window handles is more reliable than using window titles which are not unique and may require substring matching.  You can use GetWindowHandle to retrieve the window handle and then refer to it subsequently in other window commands when you need to access that window by setting WIN_USEHANDLE to 1.  See also GetActiveWindow which can return the handle of the currently active window.


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 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 (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: GWH

See also: GetActiveWindow