Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/02/2021 in all areas

  1. Automate all windows and browser applications with one UDF function library. Based on the microsoft automation API this library high level supports Recognition of conttrols from EDGE, Chrome, FF, Opera, Safari and Windows native apps Small testing framework to split object repository from coding away Introduction Quickstart - Getting started quickly Simple scripts With this module you can automate all applications/programs that support ui automation and/or accesibility api from microsoft you can recognize more controls than AutoIT can recognize "out of the box" you can use concepts from other testing frameworks like http://download.freedesktop.org/ldtp/doc/ldtp-tutorial.pdf http://safsdev.sourceforge.net/Default.htm coded ui testing from microsoft Some of those controls / applications are chrome browser (partly mainwindow has to be done with MSAA for navigating) chrome://accessibility in the adress bar of chrome or start with "--force-renderer-accessibility" silverlight controls Ribbon control controlbars of Excel/Word IE and FF browsers Windows Media Player Windows clock AFX .. controls (partly) .... Based on the initial AIO Object I now have made the interface file to work with objCreateInterface function which is in the latest beta's automate clicking and querying basic information It gives you a lot of basic information to be able to automate clicking, querying basic information where it goes further in certain situations than AutoIt is identifying Starting threads for background on the ui automation api of microsoft (not for starters) http://en.wikipedia.org/wiki/Microsoft_UI_Automation http://msdn.microsoft.com/en-us/library/ms747327.aspx Previous threads in general help/support Interface AutoItObject IUIAutomation ObjCreateInterface and struct tagPoint in method ElementFromPoint Be aware that API is not allways installed under XP/Vista see http://support.microsoft.com/kb/971513 Within Windows 7 and Windows 8 it should be preinstalled by default. Be aware on 32 and 64 bits way of running your script #AutoIt3Wrapper_UseX64=Y or N Basic example of usage / showing and retrieving the default information, will post multiple examples later Hover your mouse to an area of interest and press ctrl+w and information will be shown in the edit box of the form Simple spy demo (see simplespy.au3 or use latest ZIP attachment for latest version) Main features Recognize windows and html controls for the major browsers Logical and physical description for controls (UI mapping, Application map) Simple repository logic to abstract logical and physical descriptions Store Runtime Type Information in RTI. variables Rubberbanding/highlighting of objects Simple spy to help in making / identifying the physical description Support of regular expression(s) in identifying objects recognize objects on multiple properties supported properties: name ,title, automationid, classname, class, iaccessiblevalue, iaccessiblechildId, controltype, processid, acceleratorkey The actions provided so far "leftclick", "left", "click", "leftdoubleclick", "leftdouble", "doubleclick", _ "rightclick", "right", "rightdoubleclick", "rightdouble", _ "middleclick", "middle", "middledoubleclick", "middledouble", "mousemove", "movemouse" "setvalue","settextvalue" "setvalue using keys" "setValue using clipboard" "getvalue" "sendkeys", "enterstring", "type", "typetext" "invoke" "focus", "setfocus", "activate" "close" "move","setposition" "resize" "minimize", "maximize", "normal", "close", "exist", "exists" "searchcontext", "context" "highlight" "getobject","object" "attach" "capture","screenshot", "takescreenshot" "dump", "dumpthemall" "propertyvalue", "property" match on multiple properties like: name:=((Zoeken.*)|(Find.*)); ControlType:=Button; acceleratorkey:=Ctrl+F Support for 117 different properties see $UIA_propertiesSupportedArray in uiawrappers like for example title, regexptitle, class, regexpclass, iaccessiblevalue, iaccessiblechildid, name, accesskey, automationid, classname IAccessible, IAccessible2, ISimpleDom interfaces debuglogging to a file log.txt (no output in scitewindow) Examples Example 1 Iterating thru the different ways of representing the objects in the tree (#comment-1105548) Example 2 Finding the taskbar and clicking on the start menu button (#comment-1105680) Example 3 Clicking a litlle more and in the end displaying all items from the clock (thats not directly possible with AU3Info) (#comment-1108849) Example 4 that demonstrates the calculator Example 5 Automating chrome Example 6 Demonstrates all stuff within chrome to navigate html pages, find hyperlink, click hyperlink, find picture, click picture, enter data in inputbox Example 7 The chrome example modified to a firefox example Example 8 The other major browser Internet Explorer automated (made on Example 6 and 7) Example 9 Windows media player Example 10 Automating mach 3 (AFX windows and other hard to get recognized by AutoIT) Lot of links are broken due to forum upgrade just search for the text like "Example 11 Demonstrate Word, Notepad and Calculator actions" Example 11 Demonstrate Word, Notepad and Calculator actions ... Example 13 Details 1 about the right pane of the windows explorer Example 14 Details 2 about the right pane of the windows explorer Example 15 Details 3 about the right pane of the windows explorer Example 16 Details 4 about the right pane of the windows explorer Example 17 Details 5 about the right pane of the windows explorer WITH CACHING Example 18 Details 6 about the right pane of the windows explorer WITH VIRTUAL ITEMS Example 19 Eventhandling examples Example 20 Eventhandling examples Example 21a Eventhandling examples Internet Explorer Example 21b Eventhandling examples Internet Explorer Example 22 Eventhandling examples Follow focus Example 23 Eventhandling examples structure changed Example 24 Eventhandling examples IUIAutomationEventHandler Example 25 SAFEARRAYS Example 26 IACCESSIBLE / MSAA Example 27 IACCESSIBLE2 / MSAA Example 28 IACCESSIBLE / MSAA events Example 29 IACCESSIBLE2 events Example 30 ISimpleDOM Example 31 Notepad window move, maximize, minimize Example 32 Three browsers doing the same stuff with small differences in scripting only .. TODO Build recorder Enhance the spy with a nicer UI UI for the repository (now in the script with dot notation) Enhance mapping / identifying on multiple properties instead of 1 combined with index If speed becomes an issue use the caching logic of the MS UIA framework Add the other patterns later Generalize the concept of System Under Test of starting the SUT (for testing framework purposes) Remote running of scripts Fix issue on finding within dynamic context ... edit august 18th 2013 initial post Only zip files are needed to download , just unzip in 1 directory edit july 2016 Made V0_63 and examples works with AutoIt v3.3.14 Windows 10 tested Simple spy gives some basic code as a present Chrome latest versions seems to be having issues with IUIAutomation on tabs/buttons of mainwindow use MSAA for accessing tabsheets / buttons more cleanup to be in UDF style More comments in the source see changelog.txt for previous changes edit september 2017 All examples fixed for the IE, Firefox and Chrome browser Some small but essential fixes in UIAWrappers edit april 2018 Enhanced logic on fallback / dynamic search, still not perfect, to slow Retested with latest Chrome, FF, Edge and IE11 and some extensions to show how to get text from the webpage (examples 5,6,7) Some small bugfixes Some comments as given in forum incorporated edit may 2019 Speed enhancements on especially fallback searching UIA.CFG works now in a better way to turn on/off debug, highlighting, debug2file More stable and consistent behavior Internal cleanup and refactoring of bigger functions Checked with W10 (not tested on W7) Added some W10 properties Run with 3.3.14.5 on W10 UIA_V0_51.zip EXAMPLES_V0_5.zip UIA_V0_63.zip EXAMPLES_V0_63.zip UIA_V0_64.zip EXAMPLES_V0_64.zip EXAMPLES_V0_66.zip UIA_V0_66.zip EXAMPLES_V0_70.zip UIA_V0_70.zip
    1 point
  2. Hi @SkysLastChance, Please don't post a screenshot of HTML. Either paste the HTML in a code box or attach as an HTML file. Also, it helps if you can provide the URL to a live website. It doesn't have to be for the actual site if that's not possible. 😉 Have you tried locating some of the other elements, such as the table or one of the initial divs? Dan
    1 point
  3. 1 point
  4. $sText = GUICtrlRead($textResult) You should get what you want.
    1 point
  5. InetRead is http based ! See WebDriver for chrome automation. And please do not quote what I just said, especially if it is in an other language than english. Just use reply box at the end of the thread.
    1 point
  6. Access via COM was removed from MS Office in 2010, and I don't imagine that the 2007 version would be accessing the WIndows 10 version. However it is an option, and it reminds me that using OneNote in some manner may be an option as well
    1 point
  7. Don't use FileOpen, just create the directory first and then use FileWrite($program & "\.txt", ...) nb: Just noticed you were using the wrong flags also for FileOpen, it's $FO_... not $FC_...
    1 point
  8. What the OP means is that the installer doesn't run when stored in a path containing UNICODE characters, so there is an easy workaround but it is something we should do for the next version. Jos
    1 point
  9. My first steps would be: 1. Right click on an empty space on the desktop 2. New AutoIt v3 Script 3. Right Click on the created new file 4. Edit 5. Paste a simple example like this and save #include <File.au3> #include <MsgBoxConstants.au3> Local $sFind = "д" Local $sReplace = "d" Local $sFileName = "test.txt" Local $iRetval = _ReplaceStringInFile($sFileName, $sFind, $sReplace) If $iRetval = -1 Then MsgBox($MB_SYSTEMMODAL, "ERROR", "The pattern could not be replaced in file: " & $sFileName & " Error: " & @error) Exit Else MsgBox($MB_SYSTEMMODAL, "INFO", "Found " & $iRetval & " occurances of the pattern: " & $sFind & " in the file: " & $sFileName) EndIf 6. Create a text file in same location as the script: test.txt д some text д more text д 7. Return to the SciTe Editor 8. Place the cursor on the name of some function and press F1 for HELP File (_ReplaceStringInFile in the example above) 9. Press F5 for running the script 10. Repeat again and again: HELP FILE / simple examples for functions / Test ...
    1 point
  10. @JohnWIlling Unfortunately, that still won't allow you to connect to an instance of Chrome that wasn't launched with Chromedriver.
    1 point
  11. Hello, I am new to winHttp functions I want to log in facebook then read the html of my profile page this code that @trancexx wrote is working,but I want to login first to see my facebook profile data thanks in advance
    1 point
  12. Jon

    Forum Rules

    We want the forum to be a pleasant place for everyone to discuss AutoIt scripting, and we also want to protect the reputation of AutoIt. So we ask you to respect these simple rules while you are here: Forum Posting 1. Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects: Malware of any form - trojan, virus, keylogger, spam tool, "joke/spoof" script, etc. Bypassing of security measures - log-in and security dialogs, CAPTCHAs, anti-bot agents, software activation, etc. Automation of software/sites contrary to their EULA (see Reporting bullet below). Launching, automation or script interaction with games or game servers, regardless of the game. Running or injecting any code (in any form) intended to alter the original functionality of another process. Decompilation of AutoIt scripts or details of decompiler software. This list is non-exhaustive - the Moderating team reserve the right to close any thread that they feel is contrary to the ethos of the forum. 2. Do not post material that could be considered pornographic, violent or explicit - or express personal opinions that would not be acceptable in a civilized society. Do not post any copyrighted material unless the copyright is owned by you or by this site. 3. To protect this community, any files posted by you are subject to checks to ensure that they do not contain malware. This includes, but is not limited to, decompilation and reverse engineering. 4. Do not flame or insult other members - and just report the thread to a Moderator (see below) if you are so attacked. 5. Do not PM other users asking for support - that is why the forum exists, so post there instead. 6. Do not create multiple accounts - if you inadvertently created multiple accounts then contact a Moderator to close the unwanted ones. 7. Do not repost the same question if the previous thread has been locked - particularly if you merely reword the question to get around one of the prohibitions listed above. 8. Do not delete your posts, nor completely remove their content, if doing so will interrupt the flow of the thread. 9. Do not post in a thread while the Moderating team are actively trying to determine whether it is legal. The Moderation team will do their best to act in fair and reasonable manner. Sanctions will only be applied as a last resort and any action taken will be explained in the relevant thread. If moderation action is taken, you will need to acknowledge this through a dialog or you will be unable to post further in the forum. Please note that this dialog is not an agreement that the warning was justified - it is only there so that members are aware that moderation action has been taken and that they may have certain restrictions applied to their account. If you feel that you have been unfairly moderated then contact the Moderator concerned - using a PM or the "Report" button is preferable to opening a new thread (although new members may have to do this). But do be aware that the Moderation team has the final word - the rules are set out by the site owner and you are only welcome here if you respect his wishes. Signatures and Avatars There is no formal policy for the use of signatures but if a moderator thinks it is too big and/or distracting then you may be asked to tone it down. No-one likes wading through signatures that are a page high. Similarly for avatars, expect distracting flashing and animated gifs to be removed. Reporting If you feel a post needs Moderator attention, please use the "Report" button next to the post date at the top. You can then enter details of why you have reported the post - but there is no need to include the content of the post as that is done automatically. The Moderating team will be alerted to the post and will deal with it as soon as they can. If you suspect a EULA violation, do not expect the Moderating team to do all the work - please provide some evidence in the report such as a copy of (or link to) the EULA in question, as well as the section you believe has been violated. Finally, please do not enter into an argument with the original poster - that is why we have Moderators. Spam Please do not react to spam in any way other than reporting it. Multiple reports are combined by the forum software, so there is no need to announce that you have reported the spam - in fact doing so only increases the work for the Moderator who deals with it. Interacting with this website Anyone found abusing the website is subject to harsh punishment without warning. A non-exhaustive list of potential abuses include: Automated forum registration or login. Automated posting or sending messages on the forum. Automated manipulation of polls, user reputation or other forum features. Automated creation or comments on issue tracker tickets. Automated creation or editing of wiki pages. Other abuses which are either examples of excessive bandwidth usage or automation of the site. Use common sense. If you do not have common sense, don't do anything. Do not automate the forum, wiki or issue tracker in any way at all. Scripts which automatically update AutoIt such as AutoUpdateIt are acceptable as long as they are not abused and do not generate excessive bandwidth usage.
    1 point
  13. Quickstart Unzip the 2 zips (UIA*.zip and examples*.zip) of post #1 Start simplespy.au3 Hover your mouse over the element you want to handle Press ctrl+w Copy / paste the given source to a new AutoIT script If you need help ask for help in new thread in general support section and post screenshot that shows your element is highlighted with simplespy post output of simplespy with all properties attached log.txt if available in your script directory use allways contents of latest zip files which could be work in progress (WIP) zip As you will not come far if you do not understand the basics first do this Understand AutoIT http://www.autoitscript.com/autoit3/docs/tutorials/helloworld/helloworld.htm http://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm http://www.autoitscript.com/autoit3/docs/tutorials/notepad/notepad.htm Understand testing frameworks and related concepts http://en.wikipedia.org/wiki/Test_automation http://safsdev.sourceforge.net/FRAMESDataDrivenTestAutomationFrameworks.htm http://en.wikipedia.org/wiki/Keyword-driven_testing http://ewildsch.home.xs4all.nl/testautomation.htm If you understand above learn the basic way of setting focus and clicking thru UIA and the wrappers Understand IUIAutomation wrappers and framework Lets do the QuickStart steps as described above on the Start Button of Windows You will get this *** Standard code *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oP0=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=;controltype:=Pane;class:=Shell_TrayWnd", $treescope_children) _UIA_Action($oP0,"setfocus") _UIA_setVar("Starten.mainwindow","title:=Starten;classname:=Button") _UIA_action("Starten.mainwindow","setfocus") This code is not yet perfect (and simplespy will improve over time) and you will have to change still manually _UIA_setVar is only used to get a "logical" name for a technical description There are many ways for UIA which varies from simple thru the wrappers to advanced based on the CUIAutomation2.au3 This is better coded #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oP0 $oP0=_UIA_action("Title:=;controltype:=Pane;class:=Shell_TrayWnd", "getobject") _UIA_Action($oP0,"move") _UIA_action("title:=Starten;classname:=Button;controltype:=Button","move") _UIA_action("title:=Starten;classname:=Button;controltype:=Button","invoke") ;~ _UIA_action("title:=Start.*;classname:=Button;instance:=2","move") ;~ _UIA_action("title:=Start.*;classname:=Button;instance:=2","invoke") Exercise Learn first to automate some simple stuff on notepad.exe and calc.exe by starting those applications and with ctrl+w within simplespy try some code snippets See for latest examplecode the zip in first post Example 1 Iterating thru the different ways of representing the objects in the tree a. Autoit WinList function b. UIAutomation RawViewWalker c. UIAutomation ControlViewWalker d. UIAutomation ContentViewWalker e. Finding elements based on conditions (based on property id, frequently search on name or classname) ;~ Example 1 Iterating thru the different ways of representing the objects in the tree ;~ a. Autoit WinList function ;~ b. UIAutomation RawViewWalker ;~ c. UIAutomation ControlViewWalker ;~ d. UIAutomation ContentViewWalker ;~ e. Finding elements based on conditions (based on property id, frequently search on name or classname) #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPI.au3> #include "CUIAutomation2.au3" #include "UIAWrappers.au3" #AutoIt3Wrapper_UseX64=Y ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os ;~ To prevent some FAQ questions consolewrite("*** Some important settings you can find in " & @scriptdir & "\UIA.CFG ***" & @CRLF) consolewrite("*** " & _UIA_getVersionInfoString() ) consolewrite("*** If logging is turned on you can find it here :" & _UIA_getVar("logFileName") & @CRLF) samplewinlist() sampleTW(1) sampleTW(2) sampleTW(3) ConsoleWrite("**** Desktop windows ****" & @CRLF) findThemAll($UIA_oDesktop, $TreeScope_Children) ConsoleWrite(@CRLF & "**** All childs of the taskbar ****") $oTaskBar = _UIA_gettaskbar() findThemAll($oTaskBar, $treescope_subtree) ConsoleWrite(@CRLF & "**** Deal with browser windows ****" & @CRLF) Local $myBrowser ;- Just get the first browser we can find $myBrowser=getBrowser() $tReturn=MsgBox($MB_SYSTEMMODAL + $MB_OKCANCEL , "Title", "Make sure you have 2 chrome browsers open otherwise press X button to abort.") if $tReturn<>$IDOK Then ConsoleWrite(@CRLF & "**** ABORTING chrome browser demo ****" & @CRLF) exit EndIf consolewrite(@CRLF & "**** Continue with finding 2 browser windows ****" & @CRLF) ;- Just get the first browser we can find of this type $browserType= "Google Chrome" ;~ $browserType= "Internet Explorer" ;~ $browserType= "Opera" $myBrowser=getBrowser($browserType,1) if isobj($myBrowser) Then consolewrite("Yes found first browser " & @CRLF) endif ConsoleWrite(@CRLF & "**** Deal with 2nd browser window****" & @CRLF) ;- Just get the 2nd browser we can find of this type $myBrowser=getBrowser($browserType,2) if isobj($myBrowser) Then consolewrite("Yes found second browser " & @CRLF) Else consolewrite("No 2nd browser found so unable to focus and highlight " & @CRLF) exit endif _UIA_Action($myBrowser,"setfocus") _UIA_Action($myBrowser,"highlight") Func sampleWinList() ConsoleWrite("sample winlist (title not empty and visible windows only)" & @CRLF) Local $hTimer = TimerInit() Local $var = WinList() For $i = 1 To $var[0][0] ; Only display visble windows If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then ConsoleWrite($i & ": Title=" & $var[$i][0] & @TAB & "Handle=" & $var[$i][1] & " Class=" & _WinAPI_GetClassName($var[$i][1]) & @CRLF) EndIf Next Local $fDiff = TimerDiff($hTimer) Consolewrite("SampleWinList took: " & $fDiff & " milliseconds" & @CRLF & @CRLF) EndFunc ;==>sampleWinList Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible Func getBrowser($browserName="",$browserIndex=1) local $iBrowserIdx=0 ;- Create treewalker $UIA_oUIAutomation.RawViewWalker($UIA_pTW) $oTW = ObjCreateInterface($UIA_pTW, $sIID_IUIAutomationTreeWalker, $dtagIUIAutomationTreeWalker) If IsObj($oTW) = 0 Then MsgBox(1, "UI automation treewalker failed", "UI Automation failed failed", 10) EndIf ;~ Get first element $oTW.GetFirstChildElement($UIA_oDesktop, $UIA_pUIElement) $oUIElement = ObjCreateInterface($UIA_pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement) ;~ Iterate all desktopwindows While IsObj($oUIElement) = True local $tName= _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId) Local $tHandle= Hex(_UIA_getPropertyValue($oUIElement, $UIA_NativeWindowHandlePropertyId)) Local $tClassName= _UIA_getPropertyValue($oUIElement, $uia_classnamepropertyid) ;~ Browser normally put their browsername after the - (so this fails when multiple - are in title so thats why we search from right) local $tStr=stringmid($tname,stringinstr($tName,"-", $STR_NOCASESENSE, -1)+2) ;- See if its a browser (based on title it could be done on class but preferred logical name instead of a classname) ;~ Private modes diffferent title to deal with only IE misbehaves ;~ InPrivate - Internet Explorer - [InPrivate] ;~ InPrivate - [InPrivate] ?- Microsoft Edge ;~ Google Chrome (Incognito) ;~ Mozilla Firefox (Private Browsing) ;~ Privé-browsen - Opera< ;~ Fix misbehave if $tStr="[InPrivate]" then $tStr="Internet Explorer" if stringinstr($tStr," (") then $tStr=stringleft($tstr,stringinstr($tStr," (")-1) EndIf ;~ consolewrite("location: " & stringinstr($tName,"-", $STR_NOCASESENSE, -1) & "<" & $tstr & "><" & $tname & "><" & $tclassname & "><" & $tHandle & ">"& @CRLF) $itsABrowserTitle=stringinstr("Google Chrome,Internet Explorer,Mozilla Firefox,Microsoft Edge,Opera",$tStr,$STR_NOCASESENSE ) if $itsABrowserTitle > 0 then ;~ consolewrite("** Potential match ** " & $tStr & ":" & $browserName& @tab & $tname & @tab & $tclassname & @CRLF) if ($browserName=stringleft($tStr,stringlen($browsername))) or ($browserName="") Then ;~ consolewrite("** match ** " & $tStr & ":" & $browserName& @tab & $tname & @tab & $tclassname & @CRLF) $iBrowserIdx=$iBrowserIdx+1 ;~ consolewrite($browserIndex & $iBrowserIdx) if $iBrowserIDX=$browserIndex Then return $oUIElement endif EndIf EndIf $oTW.GetNextSiblingElement($oUIElement, $UIA_pUIElement) $oUIElement = ObjCreateInterface($UIA_pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement) WEnd EndFunc ;==>sampleTW Func sampleTW($t) ConsoleWrite("initializing tw " & $t & @CRLF) Local $hTimer = TimerInit() Local $i=0 ;~ ' Lets show all the items of the desktop with a treewalker If $t = 1 Then $UIA_oUIAutomation.RawViewWalker($UIA_pTW) If $t = 2 Then $UIA_oUIAutomation.ControlViewWalker($UIA_pTW) If $t = 3 Then $UIA_oUIAutomation.ContentViewWalker($UIA_pTW) $oTW = ObjCreateInterface($UIA_pTW, $sIID_IUIAutomationTreeWalker, $dtagIUIAutomationTreeWalker) If IsObj($oTW) = 0 Then MsgBox(1, "UI automation treewalker failed", "UI Automation failed failed", 10) EndIf $oTW.GetFirstChildElement($UIA_oDesktop, $UIA_pUIElement) $oUIElement = ObjCreateInterface($UIA_pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement) While IsObj($oUIElement) = True ConsoleWrite($i & "Title is: " & _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId) & @TAB & "Handle=" & Hex(_UIA_getPropertyValue($oUIElement, $UIA_NativeWindowHandlePropertyId)) & @TAB & "Class=" & _UIA_getPropertyValue($oUIElement, $uia_classnamepropertyid) & @CRLF) $oTW.GetNextSiblingElement($oUIElement, $UIA_pUIElement) $oUIElement = ObjCreateInterface($UIA_pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement) $i=$i+1 WEnd Local $fDiff = TimerDiff($hTimer) Consolewrite("Sample tw " & $t & " took: " & $fDiff & " milliseconds" & @CRLF & @CRLF) EndFunc ;==>sampleTW Func findThemAll($oElementStart, $TreeScope) Local $hTimer = TimerInit() ;~ Get result with findall function alternative could be the treewalker Dim $pCondition, $pTrueCondition Dim $pElements, $iLength $UIA_oUIAutomation.CreateTrueCondition($pTrueCondition) $oCondition = ObjCreateInterface($pTrueCondition, $sIID_IUIAutomationCondition, $dtagIUIAutomationCondition) ;~ $oCondition1 = _AutoItObject_WrapperCreate($aCall[1], $dtagIUIAutomationCondition) ;~ Tricky to search all descendants on html objects or from desktop/root element $oElementStart.FindAll($TreeScope, $oCondition, $pElements) $oAutomationElementArray = ObjCreateInterface($pElements, $sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray) $oAutomationElementArray.Length($iLength) For $i = 0 To $iLength - 1; it's zero based $oAutomationElementArray.GetElement($i, $UIA_pUIElement) $oUIElement = ObjCreateInterface($UIA_pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement) ConsoleWrite("Title is: " & _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId) & @TAB & "Class=" & _UIA_getPropertyValue($oUIElement, $uia_classnamepropertyid) & @CRLF) Next Local $fDiff = TimerDiff($hTimer) Consolewrite("Findthemall took: " & $fDiff & " milliseconds" & @CRLF & @CRLF) EndFunc ;==>findThemAll edit 21 aug 2014 Added quick start stuff
    1 point
×
×
  • Create New...