UVK scripting commands - Managed windows list |
Each time you call ->WaitWindow(), the corresponding window is added to an internal managed windows list.
This list can hold up to 32 windows, and is reset everytime you insert the <Run> keyword, or a new run command under the <Run> keyword.
The managed windows list is accessed through an index, starting at 1. The index is based in the ->WaitWindow() calls, being the first call Window 1, the second call Window 2, and so on.
For instance, let's say you want to automate a program named VirusScanner.exe, which displays in its main window, a button with a ClassNN Button1. Clicking that button starts the scan. When the scan ends, the application opens the log with notepad, and shows a message box. You want to close the notepad window, and click the button with ClassNN Button1 (OK) in the message box. Then you want to click a button with ClassNN Button2 (Remove selected), in the main window, and wait for the process to end. Your automation code would look like this:
<Run>
VirusScanner.exe
;Now we wait for a window belonging to the
process we just created.
;This is the Window 1
->WaitWindow()
;Now we wait for the Button1 and click it
->WaitControl(Button1)
->ClickControl(Button1)
;Now
we wait for the notepad window and close it.
;This is the Window 2
->WaitWindow(1000, [CLASS:Notepad])
->CloseWindow()
;Now we wait for the message box and click the OK button.
;This is the window 3
->WaitWindow()
->WaitControl(Button1)
->ClickControl(Button1)
;Now we click the Button2 in the Window 1 and wait for the process to
close
->ClickControl(Button2,1)
->WaitProcessClose()
Now, if you wanted to automate a new application from the same script, you just enter the new command you want to run and automate, and the managed windows list is automatically reset, meaning, a new call to ->WaitWindow() would be Window 1 again.
You can reset the list by specifying the <Run> keyword again.
Back to the list