Jump to content

Internet explorer "properties"


Recommended Posts

Gentlemen, Please help!

I wish to open an IE session, browse to a page & inspect the properties. All this I can do!

#include <IE.au3>
Local $oIE = _IECreate("bbc.co.uk")

_IELoadWait($oIE)

Sleep(2000)

Send("!f")
Sleep(500)
Send("r")

Sleep(1000)

 

 

What I can't do is use autoIt to extract the text to a file.

What's failed so far...

_IEPropertyGet - can't see which, if any option to use.

WinGetText - returns the text of the buttons.

ControlGetText - Returns blank.

_IEDocRead - the text of the main HTLM page

_IEAction - can't see which, if any option to use.

 

Is this even Possible?

 

Thanks

Pete

 

The AutoIt help file should be interrogated.The Editor should be SciTe.The forums should have been searched.

Link to comment
Share on other sites

  • Moderators

@System Tester What exactly are you trying to get (URL? Connection? etc.) There is almost surely an easier way to get what you're after, if we know precisely the information you're trying to cull from the Properties page.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • 2 weeks later...

https://www.autoitscript.com/wiki/FAQ faq 31 part on iuiautomation

simplespy will give you pieces of code you can play with to get your end result

;~ *** Standard code maintainable ***
#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

_UIA_setVar("oP1","Title:=Yahoo Search - Web Search - Internet Explorer;controltype:=UIA_WindowControlTypeId;class:=IEFrame")   ;Yahoo Search - Web Search - Internet Explorer
_UIA_setVar("oP2","Title:=;controltype:=UIA_PaneControlTypeId;class:=Frame Tab")    ;
_UIA_setVar("oP3","Title:=ITBarHost;controltype:=UIA_PaneControlTypeId;class:=InternetToolbarHost") ;ITBarHost
_UIA_setVar("oP4","Title:=Menubalk;controltype:=UIA_PaneControlTypeId;class:=WorkerW")  ;Menubalk
_UIA_setVar("oP5","Title:=;controltype:=UIA_PaneControlTypeId;class:=ReBarWindow32")    ;
_UIA_setVar("oP6","Title:=Toepassing;controltype:=UIA_MenuBarControlTypeId;class:=ToolbarWindow32") ;Toepassing

;~ $oUIElement=_UIA_getObjectByFindAll("Bestand.mainwindow", "title:=Bestand;ControlType:=UIA_MenuItemControlTypeId", $treescope_subtree)
_UIA_setVar("oUIElement","Title:=Bestand;controltype:=UIA_MenuItemControlTypeId;class:=") ;ControlType:=UIA_MenuItemControlTypeId;classname:=")

;~ Actions split away from logical/technical definition above can come from configfiles 

;~_UIA_Action("oP1","highlight")
_UIA_Action("oP1","setfocus")
;~_UIA_Action("oP2","highlight")
_UIA_Action("oP2","setfocus")
;~_UIA_Action("oP3","highlight")
_UIA_Action("oP3","setfocus")
;~_UIA_Action("oP4","highlight")
_UIA_Action("oP4","setfocus")
;~_UIA_Action("oP5","highlight")
_UIA_Action("oP5","setfocus")
;~_UIA_Action("oP6","highlight")
_UIA_Action("oP6","setfocus")

_UIA_action("oUIElement","highlight")
;~_UIA_action("oUIElement","click")

Some elements you can skip but something like below works on my dutch internetexplorer 11. You have to change some titles most likely

Bestand --> File and Eigenschappen ---> Options unclear for me what to change Toepassing to most likely Application

;~ *** Standard code maintainable ***
#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

_UIA_setVar("oP1","controltype:=UIA_WindowControlTypeId;class:=IEFrame")    ; Internet Explorer
_UIA_setVar("oP2","Title:=;controltype:=UIA_PaneControlTypeId;class:=Frame Tab")    ;
_UIA_setVar("oP3","Title:=ITBarHost;controltype:=UIA_PaneControlTypeId;class:=InternetToolbarHost") ;ITBarHost
_UIA_setVar("oP4","Title:=Menubalk;controltype:=UIA_PaneControlTypeId;class:=WorkerW")  ;Menubalk

_UIA_setVar("oP5","Title:=;controltype:=UIA_PaneControlTypeId;class:=ReBarWindow32")    ;
_UIA_setVar("oP6","Title:=Toepassing;controltype:=UIA_MenuBarControlTypeId;class:=ToolbarWindow32") ;Toepassing

;~ $oUIElement=_UIA_getObjectByFindAll("Bestand.mainwindow", "title:=Bestand;ControlType:=UIA_MenuItemControlTypeId", $treescope_subtree)
_UIA_setVar("oUIElement","Title:=Bestand;controltype:=UIA_MenuItemControlTypeId;class:=") ;ControlType:=UIA_MenuItemControlTypeId;classname:=")
_UIA_setVar("oUIElement2","Title:=Eigenschappen;controltype:=UIA_MenuItemControlTypeId;class:=") ;ControlType:=UIA_MenuItemControlTypeId;classname:=")

;~ Actions split away from logical/technical definition above can come from configfiles

_UIA_Action("oP1","highlight")
_UIA_Action("oP1","setfocus")
_UIA_Action("oP2","highlight")
_UIA_Action("oP2","setfocus")
_UIA_Action("oP3","highlight")
_UIA_Action("oP3","setfocus")

;~ _UIA_Action("oP4","highlight")
;~ _UIA_Action("oP4","setfocus")
;~ _UIA_Action("oP5","highlight")
;~ _UIA_Action("oP5","setfocus")

_UIA_Action("oP6","highlight")
_UIA_Action("oP6","setfocus")

_UIA_action("oUIElement","highlight")
_UIA_action("oUIElement","click")
_UIA_action("oUIElement2","click")


;~ *** Standard code maintainable ***
;~ #include "UIAWrappers.au3"
;~ AutoItSetOption("MustDeclareVars", 1)
_UIA_setVar("oP1","Title:=.*Internet Explorer;controltype:=UIA_PaneControlTypeId;class:=Alternate Modal Top Most")  ;C:\Users\Elwin\Documents\UIA\LOG\20160926-001619460.XML - Internet Explorer
;~ _UIA_setVar("options.mainwindow","title:=((Options)|(Eigenschappen));classname:=#32770")
_UIA_setVar("options","title:=((Options)|(Eigenschappen));classname:=#32770")
;~ Actions split away from logical/technical definition above can come from configfiles

_UIA_Action("oP1","highlight")
_UIA_Action("options","highlight")
_UIA_Action("options","setfocus")
$UIA_oUIELEMENT=_UIA_Action("options","object")

    Local $oAutomationElementArray
    Local $pElements, $iLength, $i
    Local $dumpStr
    Local $tmpStr

$UIA_oUIELEMENT.FindAll($treescope_subtree, $UIA_oTRUECondition, $pElements)
$oAutomationElementArray = ObjCreateInterface($pElements, $sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray)

;~  If there are no childs found then there is nothing to search
If _UIA_IsElement($oAutomationElementArray) Then
;~ All elements to inspect are in this array
    $oAutomationElementArray.Length($iLength)
    consolewrite($iLength & " objects found")
    For $i = 0 To $iLength - 1; it's zero based
        $oAutomationElementArray.GetElement($i, $UIA_pUIElement)
        $UIA_oUIElement = ObjCreateInterface($UIA_pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement)
        $tmpStr = "Title is: <" & _UIA_getPropertyValue($UIA_oUIElement, $UIA_NamePropertyId) & ">" & @TAB _
                 & "Class   := <" & _UIA_getPropertyValue($UIA_oUIElement, $UIA_ClassNamePropertyId) & ">" & @TAB _
                 & "controltype:= " _
                 & "<" & _UIA_getControlName(_UIA_getPropertyValue($UIA_oUIElement, $UIA_ControlTypePropertyId)) & ">" & @TAB _
                 & ",<" & _UIA_getPropertyValue($UIA_oUIElement, $UIA_ControlTypePropertyId) & ">" & @TAB _
                 & ", (" & Hex(_UIA_getPropertyValue($UIA_oUIElement, $UIA_ControlTypePropertyId)) & ")" & @TAB _
                 & ", acceleratorkey:= <" & _UIA_getPropertyValue($UIA_oUIElement, $UIA_AcceleratorKeyPropertyId) & ">" & @TAB _
                 & ", automationid:= <" & _UIA_getPropertyValue($UIA_oUIElement, $UIA_AutomationIdPropertyId) & ">" & @TAB
;~      $tmpStr = _UIA_EncodeHTMLString($tmpStr)

        $dumpStr = $dumpStr & "<elementinfo>" & $tmpStr & "</elementinfo>"
        consolewrite($dumpStr)
    Next

Else
    consolewrite( "<fatal>***** FATAL:???? _UIA_DumpThemAll no childarray found ***** </fatal>")
EndIf

With the spy you then can further determine which elements you want or by looking in uiaWrappers as examples you can see if you want to search directly with the direct interfaces of iuiautomation.

 

Edited by junkew
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...