4Eyes Posted January 5, 2011 Posted January 5, 2011 (edited) Authenticity, With IE8 (don't have IE7 at the mom) it bombs in Func _IEAttachActiveTab($hWnd). See my ConsoleWrite. Sorry, can do only the most basic debugging as I can't follow most of your code. 4Eyes ;******************* Func _IEAttachActiveTab($hWnd) Local Const $OBJID_CLIENT = 0xFFFFFFFC Local Const $CHILDID_SELF = 0 Local Const $ROLE_SYSTEM_PAGETABLIST = 60 Local Const $STATE_SYSTEM_SELECTED = 2 Local $oAccObj, $oTabs, $oTab Local $tTabs, $tTab, $tSelfChild Local $tTabRole, $pTabRole, $tTabState, $pTabState ;~ Local $pBSTR, $sStr Local $iAccChildren, $iTabChildren, $iSelectedTab Local $hTab Local $aResult ; Get a handle to the tabs UI control. $hTab = ControlGetHandle($hWnd, "", "[CLASS:DirectUIHWND]") ; Ok to here $oAccObj = _AutoItObject_WrapperCreate(_AccessibleObjectFromWindow($hTab, $OBJID_CLIENT, $sIID_IAccessible), $dtagIAccessible) $aResult = $oAccObj.get_accChildCount(0) ConsoleWrite("$aResult = " & $aResult & @CRLF) ; Shows $aResult = 0 Edited January 6, 2011 by 4Eyes
4Eyes Posted January 6, 2011 Posted January 6, 2011 Juvigy, Your code does something I want which is to list the URL's of each tab in each instance of IE, that is I had 2 IE 8's open and it showed the url's for each tab in the first and the url of the sole tab in the 2nd. Nice! Thanks, 4Eyes
Authenticity Posted January 6, 2011 Posted January 6, 2011 Authenticity, With IE8 (don't have IE7 at the mom) it bombs in Func _IEAttachActiveTab($hWnd). See my ConsoleWrite. Sorry, can do only the most basic debugging as I can't follow most of your code. 4Eyes <code snipped> Thanks for taking your time to test this miserable attempt. This one is tested on IE8. Works on IE7 hopefully: #include <Constants.au3> #include <IE.au3> #include <WinAPI.au3> Local $oIE Local $hIEFrame = WinGetHandle("[CLASS:IEFrame]") Local $hChild = _WinAPI_GetWindow($hIEFrame, $GW_CHILD) Local $hIEServer, $hTmp Local $sClass While $hChild $sClass = _WinAPI_GetClassName($hChild) If $sClass = "Frame Tab" And BitAND(WinGetState($hChild), 2) Then $hTmp = ControlGetHandle($hChild, "", "[CLASS:TabWindowClass]") $hTmp = ControlGetHandle($hTmp, "", "[CLASS:Shell DocObject View]") $hIEServer = ControlGetHandle($hTmp, "", "[CLASS:Internet Explorer_Server]") ExitLoop EndIf $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) WEnd If $hIEServer Then $oIE = __IEControlGetObjFromHWND($hIEServer) ConsoleWrite(_IEPropertyGet($oIE, "title") & @CRLF) Else ConsoleWrite("! failed" & @CRLF) EndIf
4Eyes Posted January 6, 2011 Posted January 6, 2011 (edited) Authencity, No attempt is miserable, however, it still doesn't work properly. I open IE8 with 2 tabs. 1st is Google, 2nd is www.hp.com. Prog works for 1st tab, but if 2nd is active I get this: C:\Program Files\AutoIt3\Include\IE.au3 (3620) : ==> The requested action with this object has failed.: Return $oIE.document.parentwindow Return $oIE.document.parentwindow^ ERROR As the code is now something I have more chance of understanding, I will try to find the issue. [Edit] - found issue (but not fixed) is with the call to __IEControlGetObjFromHWND(). The passed var $hIEServer appears to be valid (a large hex number), but as you can see it falls over. Thanks for your efforts. 4Eyes Edited January 6, 2011 by 4Eyes
Authenticity Posted January 6, 2011 Posted January 6, 2011 Mind to run and post the output of this script? expandcollapse popup#include <Constants.au3> #include <String.au3> #include <WinAPI.au3> Local $hIEFrame = WinGetHandle('[CLASS:IEFrame]') Local $avChildren _WinListChildren($hIEFrame, $avChildren) ConsoleWrite(_WinAPI_GetClassName($hIEFrame) & "(" & $hIEFrame & ') - "' & ControlGetText($hIEFrame, "", 0) & '"' & @CRLF) For $i = 1 To $avChildren[0][0] ConsoleWrite(_StringRepeat(" ", $avChildren[$i][1]) & "|--" & _ _WinAPI_GetClassName($avChildren[$i][0]) & "(" & $avChildren[$i][0] & ') - "' & _ ControlGetText($avChildren[$i][0], "", 0) & '" [' & WinGetState($avChildren[$i][0]) & "]" & @CRLF) Next Func _WinListChildren($hParent, ByRef $avArr, $iDepth = 0) If UBound($avArr, 0) <> 2 Then Local $avTmp[10][2] = [[0]] $avArr = $avTmp EndIf Local $hChild = _WinAPI_GetWindow($hParent, $GW_CHILD) If $hChild Then $iDepth += 2 While $hChild If $avArr[0][0]+1 > UBound($avArr, 1)-1 Then ReDim $avArr[$avArr[0][0]+10][2] $avArr[$avArr[0][0]+1][0] = $hChild $avArr[$avArr[0][0]+1][1] = $iDepth $avArr[0][0] += 1 _WinListChildren($hChild, $avArr, $iDepth) $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) WEnd ReDim $avArr[$avArr[0][0]+1][2] EndIf EndFunc Just the tree output.
4Eyes Posted January 9, 2011 Posted January 9, 2011 Authenticity, Here it is. Has IE8 open with www.google.com.au in first tab and www.hp.com in second. The output refers back to the active tab, but not both. 4Eyes IEFrame(0x00110328) - "Google - Windows Internet Explorer" |--BrowserFrameGripperClass(0x00110348) - "" [7] |--WorkerW(0x00290396) - "Navigation Bar" [7] |--ReBarWindow32(0x000F03FA) - "" [7] |--TravelBand(0x00140380) - "" [7] |--ToolbarWindow32(0x0007034E) - "" [7] |--Address Band Root(0x000D0350) - "" [7] |--AddressDisplay Control(0x00090402) - "" [7] |--Edit(0x000804DC) - "http://www.google.com.au/" [7] |--ToolbarWindow32(0x0007032A) - "Address Combo Control" [7] |--ToolbarWindow32(0x00120462) - "Page Control" [7] |--UniversalSearchBand(0x000904D6) - "" [7] |--Search Control(0x000D04B2) - "" [7] |--Static(0x000C04CC) - "Google au" [5] |--Edit(0x00080492) - "Google au" [7] |--ToolbarWindow32(0x000B049E) - "Search Combo Control" [7] |--ToolbarWindow32(0x000704E0) - "Search Control" [7] |--CommandBarClass(0x000604DE) - "" [7] |--ReBarWindow32(0x000A0458) - "" [7] |--CommandToolbarBand(0x000504E2) - "" [7] |--ToolbarWindow32(0x000504D2) - "Command Bar" [7] |--TabBandClass(0x00060470) - "" [7] |--DirectUIHWND(0x000904CE) - "" [7] |--FavBandClass(0x000C0446) - "" [7] |--ToolbarWindow32(0x000A0448) - "Favorites Command Bar" [7] |--Frame Tab(0x000804B6) - "" [7] |--InternetToolbarHost(0x00090406) - "ITBarHost" [7] |--WorkerW(0x000504BC) - "Menu Bar" [7] |--ReBarWindow32(0x000604A0) - "" [7] |--ToolbarWindow32(0x0006048E) - "" [7] |--DeskBandEIClass(0x0007048A) - "tbFree.dll" [7] |--EI CToolbarWrapperWnd Window Class(0x00020418) - "" [7] |--ToolbarWindow32(0x0005052E) - "" [7] |--EI Window Class(0x00020632) - "" [7] |--EI Radio Window Class(0x00010570) - "" [7] |--Button(0x00010572) - "" [7] |--Button(0x00010574) - "" [7] |--Button(0x00010576) - "" [5] |--Static(0x00010578) - "" [7] |--Button(0x0001057C) - "" [7] |--Button(0x0001057E) - "" [7] |--Button(0x00010586) - "" [7] |--Button(0x00010588) - "" [5] |--Button(0x0001058A) - "" [5] |--Button(0x0001058C) - "" [5] |--Button(0x0001058E) - "" [5] |--EI Search Box(0x00070534) - "" [7] |--Edit(0x000604EE) - "Search the Web " [7] |--Button(0x0002063A) - "" [7] |--TabWindowClass(0x000804A6) - "Google - Windows Internet Explorer" [7] |--msctls_statusbar32(0x00060438) - "" [7] |--ToolbarWindow32(0x000604CA) - "" [7] |--ToolbarWindow32(0x000404D8) - "Zoom Level" [7] |--msctls_progress32(0x000604C8) - "" [5] |--Shell DocObject View(0x00050518) - "" [7] |--Internet Explorer_Server(0x000304FE) - "" [7] |--Frame Tab(0x000204E4) - "" [1] |--InternetToolbarHost(0x000105B2) - "ITBarHost" [5] |--WorkerW(0x000105B4) - "Menu Bar" [5] |--ReBarWindow32(0x000105B6) - "" [5] |--ToolbarWindow32(0x000105BA) - "" [5] |--DeskBandEIClass(0x000105BE) - "tbFree.dll" [5] |--EI CToolbarWrapperWnd Window Class(0x000105D2) - "" [5] |--ToolbarWindow32(0x000105D4) - "" [5] |--EI Window Class(0x00020654) - "" [5] |--EI Radio Window Class(0x000105F6) - "" [5] |--Button(0x000105F8) - "" [5] |--Button(0x000105FA) - "" [5] |--Button(0x000105FC) - "" [5] |--Static(0x000105FE) - "" [5] |--Button(0x00010602) - "" [5] |--Button(0x00010604) - "" [5] |--Button(0x0001060C) - "" [5] |--Button(0x0001060E) - "" [5] |--Button(0x00010610) - "" [5] |--Button(0x00010612) - "" [5] |--Button(0x00010614) - "" [5] |--EI Search Box(0x00030416) - "" [5] |--Edit(0x000604F4) - "Search the Web " [5] |--Button(0x0008053C) - "" [5] |--TabWindowClass(0x00020420) - "HP - Australia | Laptop Computers, Desktops , Printers, Servers and more - Windows Internet Explorer" [5] |--msctls_statusbar32(0x000105C0) - "" [5] |--ToolbarWindow32(0x000105CC) - "" [5] |--ToolbarWindow32(0x000105CA) - "Zoom Level" [5] |--msctls_progress32(0x000105CE) - "" [5] |--Shell DocObject View(0x000105C8) - "" [5] |--Internet Explorer_Server(0x0002055A) - "" [5]
DigitalDave99 Posted March 14, 2011 Posted March 14, 2011 I was looking for this exact thing to track users internet usage, I found code to do it in Firefox but not well in IE.Follow the below post the final code returns each tab's contents as they users makes them active. Authenticity,
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