Ticket #201: error.au3

File error.au3, 1.5 KB (added by Rayburn, on Apr 2, 2008 at 8:00:55 PM)
Line 
1#include <IE.au3>
2AutoItSetOption("WinTitleMatchMode",2)
3
4Dim $tmp2,$tmp3,$tmp4,$tmp6,$tmp7,$tmp8,$tmp9,$z=0
5
6AttachToIEObject()
7
8Func AttachToIEObject()
9Do
10 $tmp3 = 0
11 While $tmp3 = 0 ; loop until an Internet Explorer window is active
12 $tmp3 = WinActive("Windows Internet Explorer")
13 Sleep(2000)
14 WEnd
15if $tmp3 = 1 Then ; if IE is active
16 $tmp4 = WinGetHandle("Windows Internet Explorer") ; get the handle of the IE window
17 If IsHWnd($tmp4) Then ; if it's valid,
18 $tmp6 = ControlGetHandle($tmp4,"","[CLASS:TabWindowClass]") ; get the handle of the tab that is in focus
19 EndIf
20 If IsHWnd($tmp6) Then ; if the tab window is valid,
21 $tmp7 = ControlGetHandle($tmp6,"","[CLASS:Shell DocObject View]") ; get the handle of the Shell DocObject
22 EndIf
23 If IsHWnd($tmp7) Then ; if it's valid
24 $tmp8 = ControlGetHandle($tmp7,"","[CLASS:Internet Explorer_Server]") ; finally get the handle to the IE control
25 ; we had to crawl down from the parent IE window
26 ; to get this handle so that we get the tab the user
27 ; is working in
28 EndIf
29If IsHwnd($tmp4) And IsHWnd($tmp6) And IsHWnd($tmp7) And IsHWnd($tmp8) Then ; if all of the above handles are valid,
30$tmp9 = __IEControlGetObjFromHWND($tmp8) ; get the object of the IE control (THIS IS WHERE IT ALWAYS FAILS IN 3.2.10.0)
31 ; It always works in 3.2.8.1
32; Rest of the code is removed for the bug report file
33EndIf
34EndIf
35
36Until $z = 1 ; loop forever
37EndFunc
38
39