Partial Window Names

 

When using partial window names as parameters, you can specify the full name if you wish, but in most circumstances, it isn't necessary. Specify enough characters so that the "partial-windowname" matches only one existing window. If it matches more than one window, the most recently accessed window which it matches will be used. The windowname "" may be used as a shorthand way of referring to the WIL parent application window. Remember that the case (upper or lower) of the title is significant. If the case is not correct, a match will not be made.

There are a total of four distinct ways to define a partial window name. Decide which option is best for your particular needs.

Window Name

A partial windowname can be the first few defining characters of a window title. For example, WinShow("Notepad") would match any window whose title begins with "Notepad".

Exact Match

Those WIL functions which take a partial windowname as a parameter can be directed to accept only an exact match by ending the window name with a tilde (~).

A tilde (~) used as the last character of the window name indicates that the name must match the window title through to the end of the title. For example, WinShow("Note~") would only match a window whose title was "Note"; it would not match "Notepad".

Match Any Window

A tilde (~) used as the first character of the window name, will match any window containing the specified string anywhere in its title. For example, WinShow("~Notepad") will match a window title of "(Untitled) - Notepad" and a window title of "My Notepad Application", as well as a window title of "Notepad - (Untitled)".

Window Name Ends With…

A tilde (~) used as the first and last character of the window name, will match any window containing the specified string anywhere in its title, except at the beginning. For example, WinShow("~Notepad~") will match a window title of "Notepad" and a window title of "(Untitled) -Notepad", but will not match a window title of "Notepad - (Untitled)".

Note:  All functions that accept a partial window name also accept a Windows ID.

 

 

§         Notes

§         Reference

§         Step by step guide to learning WIL