Hi all,
I use the following vbscript routine to make windo-eyes wait until the correct 
window is active, before setting an object reference to my window of choice. I 
wrote the first routine rapidly using do until loop and sleep commands and this 
never fails. However, thinking that using the StartTimer object would be a much 
better aproach I rewrote the routine to use this object, and now instead of 30 
children in the active window I now have three, or sometimes 4. I have to write 
such a routine as if this software is not registered you get a trial days 
counter window and options to purchase the software. this is not the same 
window as I am wanting to script for. I am scripting for baygenie pro auction 
sniping software.
Now follows the first routine and the one that works:

Begin VBScript

Function ChecWindow()
Dim CheckWinObj
Set CheckWinObj = ActiveWindow
Do Until(Left(CheckWinObj.Title, 32)) = "BayGenie eBay Auction Sniper Pro"
Sleep 200
Set CheckWinObj = ActiveWindow
Loop
Set CheckWinObj = Nothing
ActiveWindow.Redraw
Sleep 200
Speak "loop ended"
End Function

Out put:
 
children count 30
1 tooltips_class32
2 IME
3 ReBarWindow32
4 AfxMDIFrame70u
5 msctls_statusbar32
6 MSCTFIME UI
7 ToolbarWindow32
8 #32770
9 AfxMDIFrame70u
10 AfxFrameOrView70u
11 Button
12 Static
13 Static
14 SysTreeView32
15 #32770
16 ReBarWindow32
17 AfxFrameOrView70u
18 MFCGridCtrl
19 ToolbarWindow32
20 #32770
21 Shell Embedding
22 Button
23 Edit
24 Button
25 ComboBox
26 Button
27 Static
28 Static
29 Shell DocObject View
30 Internet Explorer_Server
This is correct.
Now for the second routine written with the StartTimer object.

Begin VBScript

Function ChecWindow()
Dim CheckWinObj
Set CheckWinObj = ActiveWindow
If(Left(CheckWinObj.Title, 32)) = "BayGenie eBay Auction Sniper Pro" Then
Speak "timer ended"
Set CheckWinObj = Nothing
ActiveWindow.Redraw
Sleep 200
Else
StartTimer 200, "ChecWindow"
end If
End Function

Output 
children 4
1 Static
2 Shell Embedding
3 Shell DocObject View
4 Internet Explorer_Server

I don't understand.
Warm regards.
Martin Webster.

Reply via email to