Window name wildcards
WinTask does not use wildcard techniques for finding at replay a window with a name finishing by any set of characters.
WinTask uses its own algorithm described below for example with Wordpad:
The script
UseWindow("WORDPAD.EXE|RichEdit20W|Document - WordPad|1",1)
SendKeys("hello")
types hello in document called Document if wordpad has been launched before. Let's imagine now, that Wordpad is launched but a document called My_text is opened. The script should be now:
UseWindow("WORDPAD.EXE|RichEdit20W|My_text - WordPad|1",1)
SendKeys("hello")
What happens if you replay the first script on wordpad opened with my_text loaded ?
By default, WinTask looks for a window with the exact same name ; after #ActionTimeout/9 seconds (default value for #ActionTimeout is 30 secs, so after 3.33 secs), WinTask starts to truncate the window name by its rightmost characters until first character of the window class is found. In our example, the window will be found as the window name is identical at the beginning (WORDPAD.EXE|RichEdit20W|). The drawback of this method is that it slows down the script execution.
For avoiding to waste time searching for an approaching window name, you can directly truncate the window name in the code. So if your code is :
UseWindow("WORDPAD.EXE|RichEdit20W|",1)
SendKeys("hello")
the window name starting with WORDPAD.EXE|RichEdit20W| is found immediately at replay whatever characters are behind RichEdit20W.
If the window name includes an order number to make the window unique within the application (when there are several objects of the same kind in the same window), you can still truncate the window name but you must keep the order number preceeded with the | character. For example if 2 comboboxes have the window names:
"ROBOHTML.EXE|ComboBox|RoboHELP HTML - WinTask |1"
and
"ROBOHTML.EXE|ComboBox|RoboHELP HTML - WinTask |2"
you can truncate like that: "ROBOHTML.EXE|ComboBox||1" (note the double || character).
Finally, note too that setting up #UseExact to 1 forces WinTask to find at replay only a window with the exact window name as the one recorded in the script.