Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/28/2016 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. iAmNewbe

    How do you use a Timer?

    Alright, apparently from what support is telling me and what I can gather from the manual the Timers set and kill function must be in the same scope physically. Though that is not said any where specifically. The work around to make a timer stop from within a separate scope like when you set a timer from outside a function and need to kill it from within a function or a separate function when a certain thing happens or doesn't is to use a toggle. The following code works where the other versions, having Kill Timer functions in a separate scope to the Set Timer caused problems, apparently is the reason 64 bit versions of the script failed with crashing after Timer was killed. Different scopes == DIE HORRIBLY for Timer Kill. In this case I create a Toggle that is turned off then turned on when I want the timer to stop. The While Loop and Timer Set and Kill are all in the same scope the Toggle is in two separate scopes and is checked every run of the loop. I don't personally like that type of code that runs constantly checking for something, but it does work. #AutoIt3Wrapper_UseX64=y #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Timers.au3> Local $Form1 = GUICreate("Form1", 615, 437, 192, 124) Global $stopTimer = False GUISetState(@SW_SHOW) Global $myTimer = _Timer_SetTimer($Form1, 500, "_TimedActivated") ; create timer Func _TimedActivated($hWnd, $iMsg, $iIDTimer, $iTime) Dim $Form1, $myTimer Local $choice = Random(1,3,1) Switch $choice Case 1 ConsoleWrite("case 1"&@crlf) Case 2 ConsoleWrite("case 2"&@crlf) Case 3 ;~ We run a timer to call this function until Case 3 is activated then we stop timer $stopTimer = True; Timer needs to be shutoff or it will keep calling function ConsoleWrite("case 3"&@crlf) ; Needs to display once Exit ; exits here only because there is nothing left to do in this particular script, it would stay open forever on it's own. EndSwitch EndFunc While 1 if($stopTimer == True) Then _Timer_KillTimer($Form1, $myTimer) ; Checks if timer is still needed $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _Timer_KillAllTimers ($Form1) Exit EndSwitch WEnd
    1 point
  3. Anoop

    Automation WebPage

    So you are getting error when loading the website initially itself. Try to solve it first.
    1 point
  4. Jos

    Timer

    I don't see the AdlibRegister() function like I suggested so did you open the helpfile and checked it out? Give it a try and post back what you tried. Jos
    1 point
  5. There is a reason why we have these nice examples in the helpfile. You aren't reading the STDERR so don't get the error: Quick and dirty fix: #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> _Example() Func _Example() Local $pid = Run('"' & @ComSpec & '" /c net share SharedFolder="C:\TEST" /grant:everyone,FULL', '', @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD) local $sOutput While 1 $sTemp = StdoutRead($pid) $sTemp &= StderrRead($pid) ; Exit the loop if the process closes or StdoutRead returns an error. If @error Then ExitLoop Else $sOutput&=$sTemp EndIf Sleep(10) WEnd MsgBox($MB_SYSTEMMODAL, "Stdout Read:", $sOutput) EndFunc
    1 point
  6. RunWait? guys come-on
    1 point
  7. You could use Run to start the python script and grab any output written to the console using StdOutRead.
    1 point
  8. BinaryToString is leaving the null character on the end of the path, you'll have to strip it away. $sBinaryVideoPath = RegRead("HKEY_CURRENT_USER\SOFTWARE\NVIDIA Corporation\Global\ShadowPlay\NVSPCAPS", "DefaultPathW") $sVideoPath = BinaryToString($sBinaryVideoPath, 2) $sVideoPath = StringStripWS($sVideoPath, 2) $sVideoPath &= "\TEST" InputBox("","",$sVideoPath)
    1 point
  9. ; Assuming that $aDrivesList is already filled with menu items ; the Case statement should look something like this: Case $aDrivesList[1][1] To $aDrivesList[UBound($aDrivesList)-1][1] $x = $nMsg - $aDrivesList[1][1] + 1 ; $x is index in $aDrivesList
    1 point
  10. A ribbon can be automated with the UI Automation framework. This is an example with WordPad. Start to open WordPad. No need to open a file. Get an overview of the controls in the ribbon. Here the entire window: #include "CUIAutomation2.au3" Opt( "MustDeclareVars", 1 ) Global $oUIAutomation Example() ; List all automation elements of a window ; in a hierarchical structure like a treeview. Func Example() ; Get window handle ;Local $hWindow = 0x0006045C ; Infragistics ;Local $hWindow = WinGetHandle( "[CLASS:WindowsForms10.Window.8.app.0.bb8560_r19_ad1]" ) ; Infragistics ;Local $hWindow = WinGetHandle( "[REGEXPCLASS:WindowsForms10.Window.8.app.*]" ) ; Windows Updates Downloader ;Local $hWindow = WinGetHandle( "BCGPVisualStudioGUIDemo - Start Page" ) ; BCGSoft BCGPVisualStudioGUIDemo ;Local $hWindow = WinGetHandle( "[CLASS:CabinetWClass]" ) ; Windows Explorer, Windows 7 ;Local $hWindow = WinGetHandle( "[CLASS:ExploreWClass]" ) ; Windows Explorer, Windows XP ;Local $hWindow = WinGetHandle( "Windows Explorer right pane" ) ; Windows Explorer right pane ;Local $hWindow = WinGetHandle( "[TITLE:My GUI Checkbox; CLASS:AutoIt v3 GUI]" ) ; AutoIt GUI window ;Local $hWindow = WinGetHandle( "[CLASS:AutoIt v3 GUI]" ) ; AutoIt script ;Local $hWindow = WinGetHandle( "[CLASS:Chrome_WidgetWin_1]" ) ; Chrome ;Local $hWindow = WinGetHandle( "[CLASS:IEFrame]" ) ; Internet Explorer Local $hWindow = WinGetHandle( "[CLASS:WordPadClass]" ) ; WordPad ;Local $hWindow = WinGetHandle( "Calculator" ) ; Calculator If Not $hWindow Then Return ConsoleWrite( "$hWindow ERR" & @CRLF ) ConsoleWrite( "$hWindow OK" & @CRLF ) ; Create UI Automation object $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; Get UI Automation element from window handle Local $pWindow, $oWindow $oUIAutomation.ElementFromHandle( $hWindow, $pWindow ) $oWindow = ObjCreateInterface( $pWindow, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow ) Then Return ConsoleWrite( "$oWindow ERR" & @CRLF ) ConsoleWrite( "$oWindow OK" & @CRLF & @CRLF ) ; List all elements of window ListDescendants( $oWindow, 0 ) EndFunc ; List all child elements of parent Func ListDescendants( $oParent, $iLevel, $iLevels = 0, $sIndent = "" ) If Not IsObj( $oParent ) Then Return If $iLevels And $iLevel = $iLevels Then Return ; Create RawViewWalker object Local $pRawViewWalker, $oRawViewWalker $oUIAutomation.RawViewWalker( $pRawViewWalker ) $oRawViewWalker = ObjCreateInterface( $pRawViewWalker, $sIID_IUIAutomationTreeWalker, $dtagIUIAutomationTreeWalker ) If Not IsObj( $oRawViewWalker ) Then Return ConsoleWrite( "RawViewWalker object error" & @CRLF ) ; Get first child element Local $pUIElement, $oUIElement $oRawViewWalker.GetFirstChildElement( $oParent, $pUIElement ) $oUIElement = ObjCreateInterface( $pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) For $i = 0 To $iLevel - 1 $sIndent &= " " Next While IsObj( $oUIElement ) ConsoleWrite( $sIndent & "Title = " & GetCurrentPropertyValue( $oUIElement, $UIA_NamePropertyId ) & @CRLF & _ $sIndent & "Class = " & GetCurrentPropertyValue( $oUIElement, $UIA_ClassNamePropertyId ) & @CRLF & _ $sIndent & "Ctrl type = " & GetCurrentPropertyValue( $oUIElement, $UIA_ControlTypePropertyId ) & @CRLF & _ $sIndent & "Ctrl name = " & GetCurrentPropertyValue( $oUIElement, $UIA_LocalizedControlTypePropertyId ) & @CRLF & _ $sIndent & "Value = " & GetCurrentPropertyValue( $oUIElement, $UIA_LegacyIAccessibleValuePropertyId ) & @CRLF & _ $sIndent & "Handle = " & Hex( GetCurrentPropertyValue( $oUIElement, $UIA_NativeWindowHandlePropertyId ) ) & @CRLF & @CRLF ) ListDescendants( $oUIElement, $iLevel + 1, $iLevels ) $oRawViewWalker.GetNextSiblingElement( $oUIElement, $pUIElement ) $oUIElement = ObjCreateInterface( $pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) WEnd EndFunc Func GetCurrentPropertyValue( $oObject, $iPropertyId ) Local $vValue, $sString $oObject.GetCurrentPropertyValue( $iPropertyId, $vValue ) If Not IsArray( $vValue ) Then Return $vValue $sString = $vValue[0] For $i = 1 To UBound( $vValue ) - 1 $sString &= "; " & $vValue[$i] Next Return $sString EndFunc The output in SciTE console should look like this: $hWindow OK $oUIAutomation OK $oWindow OK Title = UIRibbonDockTop Class = UIRibbonCommandBarDock Ctrl type = 50033 Ctrl name = pane Value = Handle = 000103D6 Title = Ribbon Class = UIRibbonCommandBar Ctrl type = 50033 Ctrl name = pane Value = Handle = 000103DC Title = Ribbon Class = UIRibbonWorkPane Ctrl type = 50033 Ctrl name = pane Value = Handle = 000103E4 Title = Class = NUIPane Ctrl type = 50033 Ctrl name = pane Value = Handle = 000103CE Title = Ribbon Class = NetUIHWND Ctrl type = 50033 Ctrl name = pane Value = Ribbon Handle = 000103D0 Title = Class = NetUICtrlNotifySink Ctrl type = 50033 Ctrl name = pane Value = Handle = 000103DE Title = Font family Class = RICHEDIT50W Ctrl type = 50004 Ctrl name = edit Value = Calibri Handle = 00010408 Title = Class = NetUICtrlNotifySink Ctrl type = 50033 Ctrl name = pane Value = Handle = 000103E0 Title = Font size Class = RICHEDIT50W Ctrl type = 50004 Ctrl name = edit Value = 11 Handle = 0001040A Title = Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Quick Access Toolbar Class = Ctrl type = 50021 Ctrl name = tool bar Value = Quick Access Toolbar Handle = 00000000 Title = Save Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Undo Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Redo Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Customize Quick Access Toolbar Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Application menu Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Ribbon tabs Class = Ctrl type = 50018 Ctrl name = tab Value = Ribbon tabs list Handle = 00000000 Title = Class = Ctrl type = 50025 Ctrl name = Value = Handle = 00000000 Title = Home Class = Ctrl type = 50019 Ctrl name = tab item Value = Handle = 00000000 Title = View Class = Ctrl type = 50019 Ctrl name = tab item Value = Handle = 00000000 Title = Help Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Lower Ribbon Class = Ctrl type = 50033 Ctrl name = pane Value = Lower Ribbon Handle = 00000000 Title = Class = Ctrl type = 50025 Ctrl name = Value = Handle = 00000000 Title = Home Class = Ctrl type = 50025 Ctrl name = Value = Ribbon tab Handle = 00000000 Title = Clipboard Class = Ctrl type = 50021 Ctrl name = tool bar Value = Group Handle = 00000000 Title = Paste Class = Ctrl type = 50025 Ctrl name = Value = Handle = 00000000 Title = Paste Class = Ctrl type = 50031 Ctrl name = split button Value = Paste (Ctrl+V) Handle = 00000000 Title = Paste Class = Ctrl type = 50031 Ctrl name = split button Value = Handle = 00000000 Title = Cut Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Copy Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Font Class = Ctrl type = 50021 Ctrl name = tool bar Value = Group Handle = 00000000 Title = Font family Class = Ctrl type = 50003 Ctrl name = combo box Value = Calibri Handle = 00000000 Title = Open Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Font size Class = Ctrl type = 50003 Ctrl name = combo box Value = 11 Handle = 00000000 Title = Open Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Grow font Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Shrink font Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Bold Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Italic Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Underline Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Strikethrough Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Subscript Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Superscript Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Text color Class = Ctrl type = 50025 Ctrl name = Value = Automatic Handle = 00000000 Title = Text color Class = Ctrl type = 50031 Ctrl name = split button Value = Automatic Handle = 00000000 Title = Text color Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Text highlight color Class = Ctrl type = 50025 Ctrl name = Value = No color Handle = 00000000 Title = Text highlight color Class = Ctrl type = 50031 Ctrl name = split button Value = No color Handle = 00000000 Title = Text highlight color Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Paragraph Class = Ctrl type = 50021 Ctrl name = tool bar Value = Group Handle = 00000000 Title = Decrease indent Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Increase indent Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Lists Class = Ctrl type = 50025 Ctrl name = Value = Handle = 00000000 Title = Lists Class = Ctrl type = 50031 Ctrl name = split button Value = Handle = 00000000 Title = Lists Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Change line spacing Class = Ctrl type = 50031 Ctrl name = split button Value = Handle = 00000000 Title = Align text left Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Align text center Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Align text right Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Justify text Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Paragraph Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Insert Class = Ctrl type = 50021 Ctrl name = tool bar Value = Group Handle = 00000000 Title = Picture Class = Ctrl type = 50025 Ctrl name = Value = Handle = 00000000 Title = Picture Class = Ctrl type = 50031 Ctrl name = split button Value = Insert picture Handle = 00000000 Title = Picture Class = Ctrl type = 50031 Ctrl name = split button Value = Handle = 00000000 Title = Paint drawing Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Date and time Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Insert object Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Editing Class = Ctrl type = 50021 Ctrl name = tool bar Value = Group Handle = 00000000 Title = Find Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Replace Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Select all Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Class = Afx:00000000FF0E0000:0:0000000000010003:0000000000000010:0000000000000000 Ctrl type = 50033 Ctrl name = pane Value = Handle = 000303AE Title = Class = msctls_statusbar32 Ctrl type = 50017 Ctrl name = status bar Value = Handle = 000203B2 Title = Class = Afx:00000000FF0E0000:0 Ctrl type = 50033 Ctrl name = pane Value = Handle = 000203B0 Title = 100% Class = Static Ctrl type = 50020 Ctrl name = text Value = Handle = 000103B8 Title = - Class = Button Ctrl type = 50000 Ctrl name = button Value = Handle = 000103BA Title = Zoom Slider Class = msctls_trackbar32 Ctrl type = 50015 Ctrl name = slider Value = 50 Handle = 000103BC Title = Page left Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Position Class = Ctrl type = 50027 Ctrl name = thumb Value = Handle = 00000000 Title = Page right Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = + Class = Button Ctrl type = 50000 Ctrl name = button Value = Handle = 000103BE Title = Class = Ctrl type = 50020 Ctrl name = text Value = Handle = 00000000 Title = Class = Ctrl type = 50020 Ctrl name = text Value = Handle = 00000000 Title = Class = Ctrl type = 50020 Ctrl name = text Value = Handle = 00000000 Title = Class = Afx:00000000FF0E0000:0:0000000000010003:0000000000000010:0000000000000000 Ctrl type = 50033 Ctrl name = pane Value = Handle = 000103C8 Title = Rich Text Window Class = RICHEDIT50W Ctrl type = 50004 Ctrl name = edit Value = Handle = 000303A4 Title = Class = Ctrl type = 50037 Ctrl name = title bar Value = Document - WordPad Handle = 00000000 Title = System Class = Ctrl type = 50010 Ctrl name = menu bar Value = Handle = 00000000 Title = System Class = Ctrl type = 50011 Ctrl name = menu item Value = Handle = 00000000 Title = Minimize Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Maximize Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Title = Close Class = Ctrl type = 50000 Ctrl name = button Value = Handle = 00000000 Click the split button to create a list: #include "CUIAutomation2.au3" Opt( "MustDeclareVars", 1 ) Global $oUIAutomation Example() Func Example() Local $hWindow = WinGetHandle( "[CLASS:WordPadClass]" ) If Not $hWindow Then Return ConsoleWrite( "$hWindow ERR" & @CRLF ) ConsoleWrite( "$hWindow OK" & @CRLF ) ; Create UI Automation object $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; Get UI Automation element from window handle Local $pWindow, $oWindow $oUIAutomation.ElementFromHandle( $hWindow, $pWindow ) $oWindow = ObjCreateInterface( $pWindow, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow ) Then Return ConsoleWrite( "$oWindow ERR" & @CRLF ) ConsoleWrite( "$oWindow OK" & @CRLF ) ; Condition to find split button Local $pCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_SplitButtonControlTypeId, $pCondition1 ) If Not $pCondition1 Then Return ConsoleWrite( "$pCondition1 ERR" & @CRLF ) ConsoleWrite( "$pCondition1 OK" & @CRLF ) ; Condition to find "Lists" ; "Lists" is a localized word ; Use the word in your own language Local $pCondition2 $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "Lists", $pCondition2 ) If Not $pCondition2 Then Return ConsoleWrite( "$pCondition2 ERR" & @CRLF ) ConsoleWrite( "$pCondition2 OK" & @CRLF ) ; And condition ; Both conditions Local $pCondition $oUIAutomation.CreateAndCondition( $pCondition1, $pCondition2, $pCondition ) If Not $pCondition Then Return ConsoleWrite( "$pCondition ERR" & @CRLF ) ConsoleWrite( "$pCondition OK" & @CRLF ) ; Find "Lists" split button Local $pButton, $oButton $oWindow.FindFirst( $TreeScope_Descendants, $pCondition, $pButton ) $oButton = ObjCreateInterface( $pButton, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oButton ) Then Return ConsoleWrite( "$oButton ERR" & @CRLF ) ConsoleWrite( "$oButton OK" & @CRLF ) ; Click (Invoke) button Local $pInvoke, $oInvoke $oButton.GetCurrentPattern( $UIA_InvokePatternId, $pInvoke ) $oInvoke = ObjCreateInterface( $pInvoke, $sIID_IUIAutomationInvokePattern, $dtagIUIAutomationInvokePattern ) If Not IsObj( $oInvoke ) Then Return ConsoleWrite( "$oInvoke ERR" & @CRLF ) ConsoleWrite( "$oInvoke OK" & @CRLF ) $oInvoke.Invoke() EndFunc
    1 point
  11. Jfish

    How do i loop this?

    Automating games is against the forum rules so I won't be able to assist you with that. If you want general help with loops try running the samples provided in the help file.
    1 point
  12. Jfish

    How do you use a Timer?

    The ticket has been commented with that info. Workaround for now is to use v 3.3.12
    1 point
  13. Jfish

    How do you use a Timer?

    I am able to reproduce on that version of AutoIt. I will open a bug ticket. EDIT: Ticket created EDIT: same behavior noted in _Timer_KillTimer
    1 point
  14. Jfish

    How do i loop this?

    Hello and welcome to the forum. There are many different types of loops. Check the help file under "Loop Statements" to see your options. Your choice will depend on whether or not you are trying to do it a set number of times or until a condition is satisfied. Maybe a description of what you are trying to do?
    1 point
  15. Jfish

    How do you use a Timer?

    I am on x64 too b/c I am on Windows 10. I ran your code and it works fine. It does not crash for me - it exits gracefully. Can you show the Scite output after the script stops working? Can you add some debugging too? I assume the script is exactly as you have posted it above? EDIT: can anyone else replicate the crash on x64 using Au3 3.3.14.2?
    1 point
  16. To check for an array I suggest to use IsArray!
    1 point
  17. Are you using the full SciTE4AutoIt? Also take at look at Running under Windows 64-bit Edition. You can try this as well. #include <WinAPIFiles.au3> _WinAPI_Wow64EnableWow64FsRedirection(False) $DOS = Run('c:\windows\system32\msg.exe Billy test', "", $STDOUT_CHILD + $STDERR_CHILD) Adam
    1 point
×
×
  • Create New...