Jump to content
  1. mLipok

    mLipok

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Sayed
      Hi there, 
      I'm new in AutoIt forms and using AutoIt to automate desktop application (able to automate the application normally but facing issue when I've to re-run the application twice within the same script...so need help in this please)
      here is the steps then followed by the issue in a brief : 
      1- run application . 
      2- do some actions (click menus,activate windows,set texts..)
      3- close the application. 
      4- run the application again & access the same controls.
      5- open the same windows again (like step 2)
      6- perform some validations (by getting texts from some text boxes)
      7- close the application again (and repeat 1-7 for 15 times in average )
      The issue 
      * all controls are accessible in the first run and actions done successfully on controls (for steps 1-3) BUT from the second run of the application from step-4 it's able to set focus only the main application window.
      Note: only unique properties used to while mapping the controls. 
      Error that appear in the console :
      UIAWrappers.au3" (1673) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $x = Int($t[1] + ($t[3] / 2)) $x = Int($t[1] + (^ ERROR  
      Simple spy code  of one of the controls that has this strange issue(menubar&view menu Item): 
      ;~ *** Standard code maintainable *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oP1","Title:=XXX;controltype:=UIA_WindowControlTypeId;class:=WindowsForms10.Window.8.app") ;main app form xxx _UIA_setVar("oP2","Title:=menuStrip1;controltype:=UIA_MenuBarControlTypeId;class:=WindowsForms10.Window.8.app") ;menuStrip1 ;~ $oUIElement=_UIA_getObjectByFindAll("View.mainwindow", "title:=View;ControlType:=UIA_MenuItemControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=View;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("oUIElement","highlight") ;~_UIA_action("oUIElement","click")  
       
    • By rmckay
      I'm trying to understand the use of TreeWalker and DllCall()s.  My ultimate goal is to use TreeWalker to list all children of webpages.  I've been working through the files for UIASpy to understand the logic.  After a weeks worth of searching for examples I'm still stuck on the reason for the repeated use of DllCalls in most of the functions.  Here is an example - the function 'UIASpy_CheckWindows()' (located in UIASpy_Elements.au3) is called from file UIASpy_Gui.au3.  In the function the following DllCall is used:
      DllCall( "user32.dll", "lresult", "SendMessageW", "hwnd", $hTV, "uint", $TVM_GETITEMW, "wparam", 0, "struct*", $tItem ) I understand that the function 'SendMessageW' in 'user32.dll' sends a message to the window $hTV.  The message is '$TVM_GETNEXTITEM' and '$tItem' is a struct with additional information - Microsoft Doc -https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendmessagew.  The window $hTV is created in UIASpy_Gui.au3 and that's where I get lost.  Is there code in UIASpy_Gui.au3 that handles this message?  I don't know what to look for.  This procedure - Function called that contains DllCall (SendMessage) is repeatedly used.  Thanks in advance.
    • By rmckay
      Hello,
      I'm trying to set a value in a combo box on a Chrome web page.  I've checked that the Chrome://accessibility is on and have checked to see that it's working with one of @LarsJ's scripts.  I've been able to locate the combo box and expand it.  I have then tried to put the contents into an element array.  When I check to see if the array is created there is no error.  When I check the size of the array with   '$oUIElementArray1.Length($iLength1)' the length is zero.  I then tried to set the value in the combo box with .SetValue().  No luck.  Next I tried to get the combo box items with '$oSelectionPattern1.GetCurrentSelection($pElementArray*)'.  My assumption is that the combo box items are put in an array - $pElementArray* though I couldn't get this to work in another program.  I've included the script and output.  This is my first attempt working with a website so that is likely where the problem is.  I've used all of the code except '$oSelectionPattern1' successfully in another script.
      #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include "C:\Users\Rod\Documents\AutoIt\Include\UIA_Constants.au3" ; Can be copied from UIASpy Includes folder #include "C:\Users\Rod\Documents\AutoIt\Include\CUIAutomation2WithDuplicatesRemoved.au3" ;~ #include "C:\Users\Rod\Documents\AutoIt\Jigsaw Open Journalytix\Jigsaw Open Journalytix 01.au3" Opt("MustDeclareVars", 1) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface($sCLSID_CUIAutomation8, $sIID_IUIAutomation5, $dtag_IUIAutomation5) If Not IsObj($oUIAutomation) Then Return ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oUIAutomation ERR" & @CRLF) ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oUIAutomation OK" & @CRLF) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement($pDesktop) $oDesktop = ObjCreateInterface($pDesktop, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8) If Not IsObj($oDesktop) Then Return ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oDesktop ERR" & @CRLF) ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oDesktop OK" & @CRLF) ; --- Find window/control --- ConsoleWrite("--- Find window/control ---" & @CRLF) ; locate browser Local $pCondition0 $oUIAutomation.CreatePropertyCondition($UIA_ClassNamePropertyId, "Chrome_WidgetWin_1", $pCondition0) If Not $pCondition0 Then Return ConsoleWrite(':' & @ScriptLineNumber & ':' & " $pCondition0 ERR" & @CRLF) ConsoleWrite(':' & @ScriptLineNumber & ':' & " $pCondition0 OK" & @CRLF) Local $pPane1, $oPane1 $oDesktop.FindFirst($TreeScope_Descendants, $pCondition0, $pPane1) $oPane1 = ObjCreateInterface($pPane1, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8) If Not IsObj($oPane1) Then Return ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oPane1 ERR" & @CRLF) ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oPane1 OK" & @CRLF) ; --- Find combo box --- ConsoleWrite("--- Find combo box ---" & @CRLF) Local $pCondition1 $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_ComboBoxControlTypeId, $pCondition1) If Not $pCondition1 Then Return ConsoleWrite(':' & @ScriptLineNumber & ':' & " $pCondition1 ERR" & @CRLF) ConsoleWrite(':' & @ScriptLineNumber & ':' & " $pCondition1 OK" & @CRLF) Local $pComboBox1, $oComboBox1 $oPane1.FindFirst($TreeScope_Descendants, $pCondition1, $pComboBox1) $oComboBox1 = ObjCreateInterface($pComboBox1, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8) If Not IsObj($oComboBox1) Then Return ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oComboBox1 ERR" & @CRLF) ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oComboBox1 OK" & @CRLF) ; --- ExpandCollapse Pattern (action) Object --- ConsoleWrite("--- ExpandCollapse Pattern (action) Object ---" & @CRLF) Local $pExpandCollapsePattern1, $oExpandCollapsePattern1 $oComboBox1.GetCurrentPattern($UIA_ExpandCollapsePatternId, $pExpandCollapsePattern1) $oExpandCollapsePattern1 = ObjCreateInterface($pExpandCollapsePattern1, $sIID_IUIAutomationExpandCollapsePattern, $dtag_IUIAutomationExpandCollapsePattern) If Not IsObj($oExpandCollapsePattern1) Then Return ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oExpandCollapsePattern1 ERR" & @CRLF) ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oExpandCollapsePattern1 OK" & @CRLF) ; --- ExpandCollapse Pattern (action) Methods --- ConsoleWrite("--- ExpandCollapse Pattern (action) Methods ---" & @CRLF) $oExpandCollapsePattern1.Expand() ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oExpandCollapsePattern1.Expand()" & @CRLF) Local $oUIElementArray1, $iLength1, $pElements ; $pElements is a pointer to an UI Automation element array Local $pTrueCondition $oUIAutomation.CreateTrueCondition($pTrueCondition) ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oUIAutomation.CreateTrueCondition()" & @CRLF) If Not $pTrueCondition Then Return ConsoleWrite(':' & @ScriptLineNumber & ':' & " $pTrueCondition ERR" & @CRLF) ConsoleWrite(':' & @ScriptLineNumber & ':' & " $pTrueCondition OK" & @CRLF) $oComboBox1.FindAll($TreeScope_Children, $pTrueCondition, $pElements) $oUIElementArray1 = ObjCreateInterface($pElements, $sIID_IUIAutomationElementArray, $dtag_IUIAutomationElementArray) If Not IsObj($oUIElementArray1) Then Return ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oUIElementArray1 ERR" & @CRLF) ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oUIElementArray1 OK" & @CRLF) ; script stops here - apparently array is not created $oUIElementArray1.Length($iLength1) If Not $iLength1 Then Return ConsoleWrite(':' & @ScriptLineNumber & ':' & " $iLength1 = 0 ERR" & @CRLF) ConsoleWrite(':' & @ScriptLineNumber & ':' & " $iLength1 = " & $iLength1 & @CRLF) #cs============================================================================= Display array #ce============================================================================= Local $pElement1, $oElement1, $sValue1 For $i = 0 To $iLength1 - 1 $oUIElementArray1.GetElement($i, $pElement1) $oElement1 = ObjCreateInterface($pElement1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement) $oElement1.GetCurrentPropertyValue($UIA_NamePropertyId, $sValue1) ConsoleWrite(':' & @ScriptLineNumber & ':' & " $sValue" & $i & "= " & $sValue1 & @CRLF) Next ; --- LegacyIAccessible Pattern (action) Object --- ConsoleWrite("--- LegacyIAccessible Pattern (action) Object ---" & @CRLF) Local $pLegacyIAccessiblePattern1, $oLegacyIAccessiblePattern1 $oComboBox1.GetCurrentPattern($UIA_LegacyIAccessiblePatternId, $pLegacyIAccessiblePattern1) $oLegacyIAccessiblePattern1 = ObjCreateInterface($pLegacyIAccessiblePattern1, $sIID_IUIAutomationLegacyIAccessiblePattern, $dtag_IUIAutomationLegacyIAccessiblePattern) If Not IsObj($oLegacyIAccessiblePattern1) Then Return ConsoleWrite("$oLegacyIAccessiblePattern1 ERR" & @CRLF) ConsoleWrite("$oLegacyIAccessiblePattern1 OK" & @CRLF) ; --- LegacyIAccessible Pattern (action) Methods --- ; tried to set value into combobox but nothing happens ConsoleWrite("--- LegacyIAccessible Pattern (action) Methods ---" & @CRLF) Local $sShowEntriesCombobox = 'All' $oLegacyIAccessiblePattern1.SetValue($sShowEntriesCombobox) ConsoleWrite("$oLegacyIAccessiblePattern1.SetValue()" & @CRLF) ; --- Selection Pattern (action) Object --- ConsoleWrite("--- Selection Pattern (action) Object ---" & @CRLF) Local $pSelectionPattern1, $oSelectionPattern1 $oComboBox1.GetCurrentPattern($UIA_SelectionPatternId, $pSelectionPattern1) $oSelectionPattern1 = ObjCreateInterface($pSelectionPattern1, $sIID_IUIAutomationSelectionPattern, $dtag_IUIAutomationSelectionPattern) Sleep(1000) If Not IsObj($oSelectionPattern1) Then Return ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oSelectionPattern1 ERR" & @CRLF) ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oSelectionPattern1 OK" & @CRLF) ; --- Selection Pattern (action) Methods --- ConsoleWrite("--- Selection Pattern (action) Methods ---" & @CRLF) $oSelectionPattern1.GetCurrentSelection($pElements) ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oSelectionPattern1.GetCurrentSelection()" & @CRLF) EndFunc ;==>Example Console Output
      >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\Rod\Documents\AutoIt\jigsaw Show Entries Code\JIgsa Show Entries Combobox - for Forum 02.au3" /UserParams +>15:31:00 Starting AutoIt3Wrapper v.19.102.1901.0 SciTE v.4.1.2.0 Keyboard:00000409 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:2 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\Rod\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\Rod\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.5) params:-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 from:C:\Program Files (x86)\AutoIt3 input:C:\Users\Rod\Documents\AutoIt\jigsaw Show Entries Code\JIgsa Show Entries Combobox - for Forum 02.au3 +>15:31:00 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\Rod\Documents\AutoIt\jigsaw Show Entries Code\JIgsa Show Entries Combobox - for Forum 02.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop :18: $oUIAutomation OK :25: $oDesktop OK --- Find window/control --- :35: $pCondition0 OK :41: $oPane1 OK --- Find combo box --- :50: $pCondition1 OK :56: $oComboBox1 OK --- ExpandCollapse Pattern (action) Object --- :66: $oExpandCollapsePattern1 OK --- ExpandCollapse Pattern (action) Methods --- :73: $oExpandCollapsePattern1.Expand() :79: $oUIAutomation.CreateTrueCondition() :81: $pTrueCondition OK :88: $oUIElementArray1 OK :92: $iLength1 = 0 ERR +>15:31:00 AutoIt3.exe ended.rc:0 +>15:31:00 AutoIt3Wrapper Finished. >Exit code: 0 Time: 1.681 Thanks in advance
    • By rmckay
      Hello,
      I'm trying to automate the settings of combo boxes in a program. The combo boxes are child windows of two different windows.  They have the similar but different titles so I can locate them using 'WinList('ES 06-20-NT8')'.  After I locate the windows I need to change the selection in a combo box on each.  I initially tried to use the window handle of the respective windows to create an element for each with '$oUIAutomation.ElementFromHandle( $hWindow, $pWindow )'.  The objects will create and I can read the contents of the combo boxes. When I try to change the value using   .SetValue() the combo box in only one of the windows changes.  WinActivate() or .SetFocus() will change the active window but the combo box will still only change in one of the windows.  Next attempt is to use the '$UIA_AutomationIdPropertyId' & ' $UIA_NativeWindowHandlePropertyId  to create an ''AndCondition'.  I've included the script for this.  The problem now is that each time the program restarts the value for '$UIA_NativeWindowHandlePropertyId ' changes.  If I get the current value using UIASpy and input the values into the script it will work.  I've searched every place I can think of to find out how I can get the current value for '$UIA_NativeWindowHandlePropertyId ' and automate it.  Any suggestions are greatly appreciated.

       
      #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include "C:\Users\Rod\Documents\AutoIt\Include\UIA_Constants.au3" ; Can be copied from UIASpy Includes folder #include "C:\Users\Rod\Documents\AutoIt\Include\CUIAutomation2WithDuplicateConstantsRemoved.au3" #include 'Array.au3' Opt("MustDeclareVars", 1) Example() Func Example() ; creates an array with 3 rows Local $aArr = WinList('ES 06-20-NT8') _ArrayDisplay($aArr) For $i = 1 To UBound($aArr) - 1 ConsoleWrite($aArr[$i][0] & ' ' & $aArr[$i][1] & @CRLF) Next ; tried window handle for property condition in '$UIA_NativeWindowHandlePropertyId' but it doesn't work ; Local $hWnd = WinGetHandle($aArr[1][0]) ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface($sCLSID_CUIAutomation8, $sIID_IUIAutomation5, $dtag_IUIAutomation5) If Not IsObj($oUIAutomation) Then Return ConsoleWrite("$oUIAutomation ERR" & @CRLF) ConsoleWrite("$oUIAutomation OK" & @CRLF) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement($pDesktop) $oDesktop = ObjCreateInterface($pDesktop, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8) If Not IsObj($oDesktop) Then Return ConsoleWrite("$oDesktop ERR" & @CRLF) ConsoleWrite("$oDesktop OK" & @CRLF) ; --- Find window/control --- ConsoleWrite("--- Find window/control ---" & @CRLF) Local $pCondition0, $pCondition1, $pAndCondition1 $oUIAutomation.CreatePropertyCondition($UIA_AutomationIdPropertyId, "accountComboBox", $pCondition0) $oUIAutomation.CreatePropertyCondition($UIA_NativeWindowHandlePropertyId, 0x001506B6, $pCondition1) $oUIAutomation.CreateAndCondition($pCondition0, $pCondition1, $pAndCondition1) If Not $pAndCondition1 Then Return ConsoleWrite("$pAndCondition1 ERR" & @CRLF) ConsoleWrite("$pAndCondition1 OK" & @CRLF) Local $pComboBox1, $oComboBox1 $oDesktop.FindFirst($TreeScope_Descendants, $pAndCondition1, $pComboBox1) $oComboBox1 = ObjCreateInterface($pComboBox1, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8) If Not IsObj($oComboBox1) Then Return ConsoleWrite("$oComboBox1 ERR" & @CRLF) ConsoleWrite("$oComboBox1 OK" & @CRLF) ; --- LegacyIAccessible Pattern (action) Object --- ConsoleWrite("--- LegacyIAccessible Pattern (action) Object ---" & @CRLF) Local $pLegacyIAccessiblePattern1, $oLegacyIAccessiblePattern1 $oComboBox1.GetCurrentPattern($UIA_LegacyIAccessiblePatternId, $pLegacyIAccessiblePattern1) $oLegacyIAccessiblePattern1 = ObjCreateInterface($pLegacyIAccessiblePattern1, $sIID_IUIAutomationLegacyIAccessiblePattern, $dtag_IUIAutomationLegacyIAccessiblePattern) If Not IsObj($oLegacyIAccessiblePattern1) Then Return ConsoleWrite("$oLegacyIAccessiblePattern1 ERR" & @CRLF) ConsoleWrite("$oLegacyIAccessiblePattern1 OK" & @CRLF) ; --- LegacyIAccessible Pattern (action) Methods --- ConsoleWrite("--- LegacyIAccessible Pattern (action) Methods ---" & @CRLF) Local $sValue $oLegacyIAccessiblePattern1.CurrentValue($sValue) ConsoleWrite("$oLegacyIAccessiblePattern1.CurrentValue() = " & $sValue & @CRLF) ; --- Value Pattern (action) Object --- ConsoleWrite("--- Value Pattern (action) Object ---" & @CRLF) Local $pValuePattern1, $oValuePattern1 $oComboBox1.GetCurrentPattern($UIA_ValuePatternId, $pValuePattern1) $oValuePattern1 = ObjCreateInterface($pValuePattern1, $sIID_IUIAutomationValuePattern, $dtag_IUIAutomationValuePattern) If Not IsObj($oValuePattern1) Then Return ConsoleWrite("$oValuePattern1 ERR" & @CRLF) ConsoleWrite("$oValuePattern1 OK" & @CRLF) ; --- Value Pattern (action) Methods --- ConsoleWrite("--- Value Pattern (action) Methods ---" & @CRLF) $oValuePattern1.SetValue('NT8-Sim 03 Tue') ConsoleWrite("$oValuePattern1.SetValue()" & @CRLF) $oLegacyIAccessiblePattern1.CurrentValue($sValue) ConsoleWrite("$oLegacyIAccessiblePattern1.CurrentValue() = " & $sValue & @CRLF) ; --- Find window/control --- ConsoleWrite("--- Find window/control ---" & @CRLF) ; --- Find window/control --- ConsoleWrite("--- Find window/control ---" & @CRLF) $oUIAutomation.CreatePropertyCondition($UIA_AutomationIdPropertyId, "accountComboBox", $pCondition0) $oUIAutomation.CreatePropertyCondition($UIA_NativeWindowHandlePropertyId, 0x0010069E, $pCondition1) $oUIAutomation.CreateAndCondition($pCondition0, $pCondition1, $pAndCondition1) If Not $pAndCondition1 Then Return ConsoleWrite("$pAndCondition1 ERR" & @CRLF) ConsoleWrite("$pAndCondition1 OK" & @CRLF) $oDesktop.FindFirst($TreeScope_Descendants, $pAndCondition1, $pComboBox1) $oComboBox1 = ObjCreateInterface($pComboBox1, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8) If Not IsObj($oComboBox1) Then Return ConsoleWrite("$oComboBox1 ERR" & @CRLF) ConsoleWrite("$oComboBox1 OK" & @CRLF) ; --- LegacyIAccessible Pattern (action) Object --- ConsoleWrite("--- LegacyIAccessible Pattern (action) Object ---" & @CRLF) $oComboBox1.GetCurrentPattern($UIA_LegacyIAccessiblePatternId, $pLegacyIAccessiblePattern1) $oLegacyIAccessiblePattern1 = ObjCreateInterface($pLegacyIAccessiblePattern1, $sIID_IUIAutomationLegacyIAccessiblePattern, $dtag_IUIAutomationLegacyIAccessiblePattern) If Not IsObj($oLegacyIAccessiblePattern1) Then Return ConsoleWrite("$oLegacyIAccessiblePattern1 ERR" & @CRLF) ConsoleWrite("$oLegacyIAccessiblePattern1 OK" & @CRLF) ; --- LegacyIAccessible Pattern (action) Methods --- ConsoleWrite("--- LegacyIAccessible Pattern (action) Methods ---" & @CRLF) $oLegacyIAccessiblePattern1.CurrentValue($sValue) ConsoleWrite("$oLegacyIAccessiblePattern1.CurrentValue()" & $sValue & @CRLF) ; --- Value Pattern (action) Object --- ConsoleWrite("--- Value Pattern (action) Object ---" & @CRLF) $oComboBox1.GetCurrentPattern($UIA_ValuePatternId, $pValuePattern1) $oValuePattern1 = ObjCreateInterface($pValuePattern1, $sIID_IUIAutomationValuePattern, $dtag_IUIAutomationValuePattern) If Not IsObj($oValuePattern1) Then Return ConsoleWrite("$oValuePattern1 ERR" & @CRLF) ConsoleWrite("$oValuePattern1 OK" & @CRLF) ; --- Value Pattern (action) Methods --- ConsoleWrite("--- Value Pattern (action) Methods ---" & @CRLF) $oValuePattern1.SetValue('NT8-Sim 03 Tue') ConsoleWrite("$oValuePattern1.SetValue()" & @CRLF) $oLegacyIAccessiblePattern1.CurrentValue($sValue) ConsoleWrite("$oLegacyIAccessiblePattern1.CurrentValue() = " & $sValue & @CRLF) EndFunc ;==>Example  
      Output from script
      ES 06-20-NT8-Sim 02 Mon 0x05D50AAA ES 06-20-NT8-Sim04 Wed 0x001208B8 $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oComboBox1 OK --- LegacyIAccessible Pattern (action) Object --- $oLegacyIAccessiblePattern1 OK --- LegacyIAccessible Pattern (action) Methods --- $oLegacyIAccessiblePattern1.CurrentValue() = NT8-Sim 02 Mon --- Value Pattern (action) Object --- $oValuePattern1 OK --- Value Pattern (action) Methods --- $oValuePattern1.SetValue() $oLegacyIAccessiblePattern1.CurrentValue() = NT8-Sim 03 Tue --- Find window/control --- --- Find window/control --- $pAndCondition1 OK $oComboBox1 OK --- LegacyIAccessible Pattern (action) Object --- $oLegacyIAccessiblePattern1 OK --- LegacyIAccessible Pattern (action) Methods --- $oLegacyIAccessiblePattern1.CurrentValue()NT8-Sim04 Wed --- Value Pattern (action) Object --- $oValuePattern1 OK --- Value Pattern (action) Methods --- $oValuePattern1.SetValue() $oLegacyIAccessiblePattern1.CurrentValue() = NT8-Sim 03 Tue Thanks in advance.
    • By adityaparakh
      Hello ,
      I am trying to fetch data and control a Windows Program.
      The data isn't reflected in the Au3Info tool , hence used SimpleSpy UIA , for trying.
      The code is able to fetch only one row at a time.
      Most Strangely , the code doesn't retreive the same specified row consistently.
      If I run the same code , under same circumstance , it is still fetching different rows.
      This was when op2 and op3 were zero. I would not like to use this at all.

      Also , it takes 3 seconds for it search down the hiearchy and reach the row.
      I will need to fetch ALL the rows continuously for 6 hours every second , in a minimized state.
      Can you please help.
      Attached :
      1. AuInfo summary
      2. Code
      3. Simple Spy Summary
      The Actions I am trying to do (in a Minimzed State - not affecting usage of computer for other purposes)
      1. Fetch all Rows (number of rows will not always be constant
      2. Press the Check box for a specific row(s)
      3. Press the squareOff button on top
      Thanks a lot
       
       
      #include <MsgBoxConstants.au3> #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oP8=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=MO Trader;controltype:=UIA_WindowControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children) _UIA_Action($oP8,"setfocus") Local $oP7=_UIA_getObjectByFindAll($oP8, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children) _UIA_Action($oP7,"setfocus") Local $oP6=_UIA_getObjectByFindAll($oP7, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children) _UIA_Action($oP6,"setfocus") Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children) _UIA_Action($oP5,"setfocus") Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=Day Net Position;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children) _UIA_Action($oP4,"setfocus") Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children) _UIA_Action($oP3,"setfocus") Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=0.0000;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children) _UIA_Action($oP2,"setfocus") Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=0.0000;controltype:=UIA_TableControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children) _UIA_Action($oP1,"setfocus") Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=Data Panel;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children) ;~ First find the object in the parent before you can do something Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=Row 12;ControlType:=UIA_CustomControlTypeId", $treescope_subtree) _UIA_action($oUIElement,"click") Local $string = _UIA_action($oUIElement,"getValue") MsgBox($MB_OK,"", $string) Local $oUIElement2=_UIA_getObjectByFindAll($oP0, "title:=Row 6;ControlType:=UIA_CustomControlTypeId", $treescope_subtree) _UIA_action($oUIElement2,"click") Local $string2 = _UIA_action($oUIElement2,"getValue") MsgBox($MB_OK,"", $string2)  


      SimpleSpy Row.txt
×
×
  • Create New...