WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

FAQs - Frequently Asked Questions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Using Partial Window Names

Keywords:  partial windowname window name 

Question:

Why are my WinBatch functions using a windowname as a parameter failing?

Answer:

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 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)".

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". Furthermore, 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)".

When using partial windownames as parameters, you can specify the full name if you wish, but in most circumstances, it isn't necessary. Remember that the case (upper or lower) of the title is significant. If the case is not correct, a match will not be made. Notes Reference Step by step guide to learning WIL

Example:

WinWaitExist("Information Window",-1)
here's how the ~'s work. They kind of mean the opposite thing when they are on the begininng or the end
WinWaitExist("Info",-1)
Match a Window beginning with "Info". Anything is permissable after the "Info".
WinWaitExist("~Info",-1)
Match a Window with "Info" *anywhere* in the title.
WinWaitExist("Info~",-1)
Exact Match for exact window title of "Info"
WinWaitExist("~Info~",-1)
Window title must end with "Info". "Info" must bt the last 4 characters of the window title. Anything is allowed in front.

At the beginning of the window title, ~ means that skipping characters is OK.

At the end of the title it means the title must "stop here".

Hint:

In Windows 95, Windownames have changed slightly. In the older versions of Windows, the filename appeared after the executable name in the title bar. "Notepad - Untitled"

In Windows 95, the names are reversed. For example: "Untitled - Notepad" is now the norm. Remember to use your, "~", tilde character to alleviate this problem. ie. "~Notepad".


Article ID:   W13003
Filename:   Using Partial Windownames.txt
File Created: 2001:05:01:11:30:10
Last Updated: 2001:05:01:11:30:10