Quual Posted May 3, 2011 Share Posted May 3, 2011 I have 2 instances of the same windows gadget running and I want to get the the text ($oIE.document.body.innerhtml) from those windows. I know very little about gadgets, but they appear to be running in an embedded IE window (similar to an HTA). I can get the HWNDs for both host windows, but then I get stuck. A Copy of the script I'm working on expandcollapse popup#include <IE.au3> Local $vGadgetHWNDs, $oIE, $hWinHostIE $vGadgetHWNDs = GetList('[Class:SideBar_HTMLHostWindow]') If IsArray($vGadgetHWNDs) Then ConsoleWrite('DebugOutput : Window Count ' & $vGadgetHWNDs[0] & @TAB & $vGadgetHWNDs[1] & @TAB & $vGadgetHWNDs[2] & @LF) $oIE = _IEAttach($vGadgetHWNDs[1],'HWND') If IsObj($oIE) Then ConsoleWrite('DebugOutput : HWND method : object name=' & ObjName($oIE)) Else ConsoleWrite('DebugOutput : HWND method : not an object') EndIf $oIE = _IEAttach('[Class:Internet Explorer_Server]','title') If IsObj($oIE) Then ConsoleWrite('DebugOutput : Title method 1 : object name=' & ObjName($oIE)) Else ConsoleWrite('DebugOutput : Title method 1 : not an object') EndIf $oIE = _IEAttach('[Class:SideBar_HTMLHostWindow]','title') If IsObj($oIE) Then ConsoleWrite('DebugOutput : Title method 2 : object name=' & ObjName($oIE)) Else ConsoleWrite('DebugOutput : Title method 2 : not an object') EndIf $hWinHostIE = _IEAttach($vGadgetHWNDs[1], "embedded") ; causes a error and stops the script ;$hWinHostIE = _IEAttach($vGadgetHWNDs[1],'dialogbox') ; causes same error EndIf Func GetList($sTitle) Local $vHWNDs[1]=[0], $vList = WinList($sTitle) If IsArray($vList) Then For $i = 1 to $vList[0][0] If IsVisible($vList[$i][1]) Then $vHWNDs[0] += 1 ReDim $vHWNDs[$vHWNDs[0] + 1] $vHWNDs[$i] = $vList[$i][1] EndIf Next EndIf Return $vHWNDs EndFunc Func IsVisible($HWND) If BitAnd( WinGetState($HWND), 2 ) Then Return 1 Return 0 EndFunc A copy of the Console output when I run the script >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "E:\MyScripts\WinList.au3" /autoit3dir "C:\Program Files (x86)\AutoIt3" /UserParams +>22:10:31 Starting AutoIt3Wrapper v.2.0.1.24 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64) >Running AU3Check (1.54.19.0) from:C:\Program Files (x86)\AutoIt3 +>22:10:31 AU3Check ended.rc:0 >Running:(3.3.6.1):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "E:\MyScripts\WinList.au3" DebugOutput : Window Count 4 0x00000000005F050C 0x0000000000280F7E --> IE.au3 V2.4-0 Warning from function _IEAttach, $_IEStatus_NoMatch DebugOutput : HWND method : not an object --> IE.au3 V2.4-0 Warning from function _IEAttach, $_IEStatus_NoMatch DebugOutput : Title method 1 : not an object --> IE.au3 V2.4-0 Warning from function _IEAttach, $_IEStatus_NoMatch DebugOutput : Title method 2 : not an object C:\Program Files (x86)\AutoIt3\Include\IE.au3 (3620) : ==> The requested action with this object has failed.: Return $oIE.document.parentwindow Return $oIE.Document^ ERROR ->22:10:31 AutoIT3.exe ended.rc:1 >Exit code: 1 Time: 1.434 A copy of what Au3Info Tool says about the gadget. >>>> Window <<<< Title: Class: SideBar_HTMLHostWindow Position: 2493, 903 Size: 128, 172 Style: 0x96010000 ExStyle: 0x00080080 Handle: 0x00000000005F050C >>>> Control <<<< Class: Internet Explorer_Server Instance: 1 ClassnameNN: Internet Explorer_Server1 Name: Advanced (Class): [CLASS:Internet Explorer_Server; INSTANCE:1] ID: Text: Position: 0, 0 Size: 128, 172 ControlClick Coords: 66, 134 Style: 0x56000000 ExStyle: 0x00000000 Handle: 0x00000000005B04B0 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now