Leaderboard
Popular Content
Showing content with the highest reputation on 04/08/2021 in all areas
-
WebDriver - Chrome driver version 89 is not accessible - (Moved)
Nine and 3 others reacted to Earthshine for a topic
Jen is the keeper of the Internet4 points -
I have absolutely ZERO experience with RTF, never used it. How about a logo ?2 points
-
Looking for a nice About window with credits area
Werty and one other reacted to Professor_Bernd for a topic
2 points -
WebDriver - Chrome driver version 89 is not accessible - (Moved)
Earthshine and one other reacted to Nine for a topic
No ? Damn ! Who is then ?2 points -
I think i found the issue with a variable overflow which also happened in the old version but simply didn't crash then. Please give the current Tidy Beta v21.316.1639.4 a try. Jos2 points
-
#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $Chrome = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" $Arr = StringSplit("Movies|Games|Books|Sport|News|Movies2|Games2|Books2|Sport2|News2|Movies3|Games3|Books3|Sport3","|") Dim $Sel[$Arr[0] + 1] GUICreate("IBM DataPower Gateway", 500, 400, -1, -1) $Left = 10 $Top = 10 $rows = 5 ; number of checkboxes in each column $TopMax = $Top + $rows*25 For $i = 1 To $Arr[0] $Sel[$i] = GUICtrlCreateCheckbox($Arr[$i], $Left, $Top, 150, 20) If Mod($i, $rows) = 0 Then $Left += 150 $Top = 10 Else $Top += 25 EndIf Next $ButtonSel = GUICtrlCreateButton("Select All", 10, $TopMax, 150, 20) $ButtonUnSel = GUICtrlCreateButton("Unselect All", 10, $TopMax + 30, 150, 20) $ButtonOpen = GUICtrlCreateButton("Open", 10, $TopMax + 60, 150, 20) GUISetState(@SW_SHOW) While 1 $ChkbxSel = GUIGetMsg() Switch $ChkbxSel Case $GUI_EVENT_CLOSE ExitLoop Case $ButtonSel For $i = 1 To $Arr[0] GUICtrlSetState($Sel[$i], $GUI_CHECKED) Next Case $ButtonUnSel For $i = 1 To $Arr[0] GUICtrlSetState($Sel[$i], $GUI_UNCHECKED) Next Case $ButtonOpen For $i = 1 To $Arr[0] If GUICtrlRead($Sel[$i]) = $GUI_CHECKED Then $Addr = " https://www." & $Arr[$i] & ".com" ;MsgBox($MB_OK,"",$Addr & " selected") Run($Chrome & $Addr) ;MsgBox($MB_OK,"",$Arr[$i] & " selected") EndIf Next EndSwitch WEnd1 point
-
Looking for a nice About window with credits area
Shark007 reacted to Professor_Bernd for a topic
That was the same for me, I also used a MsgBox until now. That was the reason why I was looking for something nicer. Unfortunately I found only 3 example codes, but they were all very old (2004 - 2007) and very simple. For example, none has an area for credits. With the tip from Danyfirex it will now hopefully be a little prettier, but that is known to be a matter of taste. +1 I currently use a msgbox so anything would be a step up I think the HTML About dialog was a joke by argumentum. (If not, argumentum please excuse me!)please excuse!) Further up Chimp posted a short HTML example and I wrote of my modest HTML skills. I probably won't create an HTML About dialog anytime soon. However, if you're interested in the About Dialog I'm putting together, I'll be happy to share it once it's done.1 point -
I suggest to add some error checking: #include <Excel.au3> While True WinWaitActive("_CurrentDay", "", 0) $sWindowTitle = WinGetTitle("_CurrentDay") $oWorkbook = _Excel_BookAttach($sWindowTitle, "Title") If @error = 0 Then $sRangeRead = _Excel_RangeRead($oWorkbook, Default, "A1") MsgBox(0, 0, $sRangeRead) _Excel_BookClose($oWorkbook, False) EndIf Sleep(5000) WEnd1 point
-
Hello @Filipp_G, I'm using this library pretty often, it is really helpful. I just want to say, if you already solved the problem, why not share what you have? Just increase the version number, put your comments on the beginning of the file and upload it. This way anyone can improve it.1 point
-
Take a look at Patterns (actions) examples 7 (answering questions 1) and 3)) and 8 (answering question 2)).1 point
-
Looking for a nice About window with credits area
argumentum reacted to Professor_Bernd for a topic
I'm afraid by the time I've mastered html and javascript to the point where I can create a web page, IE will probably be gone.1 point -
WebDriver - Chrome driver version 89 is not accessible - (Moved)
Earthshine reacted to Nine for a topic
Going to sleep better tonight, thanks.1 point -
WebDriver - Chrome driver version 89 is not accessible - (Moved)
Earthshine reacted to mLipok for a topic
???BigBrother???1 point -
This format works with chrome : "file://C:\\Applications\\AutoIt\\WebDriver\\HTML Examples\\Basic.html"1 point
-
RESOLVED! This version is working, (also without Tidy.ini) Thank you all guys. Cheers.1 point
-
Have a look at the _Excel functions in the help file, try _Excel_BookAttach then _Excel_BookClose to close the workbook.1 point
-
Looking for a nice About window with credits area
Professor_Bernd reacted to argumentum for a topic
use a web page in a disabled IE. Add some nice JavaScript ( and share it here for me to use )1 point -
How to query different Excel Ranges is described in the Excel wiki: https://www.autoitscript.com/wiki/Excel_Range1 point
-
I see If _Excel_BookAttach is successful (returning $oWorkbook) I use $oWorkbook.Application to get the correct Excel object for further processing. Excel allows to have multiple instances of Excel running at the same time. _Excel_BookAttach can return the workbook object from any of this instances.1 point
-
@water - While _Excel_Open() wasn't required, I added it so you could reference the $oExcel application object for _Excel_BookOpen (only if _Excel_BookAttach failed). @Bagel - Your _Excel_BookAttach $sMode parameter is incorrect it should be "FileName" not "Book8"1 point
-
_Excel_BookAttach connects to an already existing workbook (by name etc.). There is no need to run _Excel_Open when trying to attach. I already posted a working example in your last thread1 point
-
ControlGetText don't work after click Back Button
behdadsoft reacted to argumentum for a topic
you have an "If", so after that, it is done. If there was a "While" loop then it'd do that you say.1 point -
Patterns (actions), 1 - 12 Control patterns are objects that can be used to perform actions on an UI element (window/control). The actual actions are performed by executing the methods of the pattern objects. Control types that are supported by specific control patterns are listed in Control Types and Their Supported Control Patterns. How to create pattern objects and execute pattern methods through UIASpy is described in How to topics 12 and 14. The examples shows how to use control patterns. The examples are tested on Windows 10 and Windows 7. In many examples you need to update eg. control names to your own names. There may also be other values to be updated. Lines to be updated are marked with ; <<<<<<<<<<<<<<<<<<<< Use UIASpy to check and copy the values. All code is stored in Examples\4) Patterns (actions)\<Pattern>\ folders. Patterns (actions): Section 1 - 12: Examples based on File Explorer Top of next post (bottom of this post) Section 13 - 15: Virtual listview item patterns Section 16 - 17: Other control pattern objects File Explorer picture Window patterns (Window) Window Control Pattern (SetWindowVisualState()) Transform Control Pattern (Move()) Treeview patterns (Tree, TreeItem) ExpandCollapse Control Pattern (Expand(), Collapse()) ScrollItem Control Pattern (ScrollIntoView()) Scroll Control Pattern (Scroll()) Does not work on Windows 7 ($oScrollPattern1 ERR) Listview patterns (List, ListItem) Grid Control Pattern (GetItem()) Table Control Pattern (GetCurrentColumnHeaders()) Invoke Control Pattern (Invoke()) MultipleView Control Pattern (GetCurrentSupportedViews()) SelectionItem Control Pattern (Select(), AddToSelection()) Selection Control Pattern (GetCurrentSelection()) Virtual listview item patterns File Explorer picture ItemContainer Control Pattern VirtualizedItem Control Pattern Other control pattern objects Value Control Pattern RangeValue Control Pattern 1. File Explorer picture 2. Window Control Pattern From Microsoft documentation: The Window control pattern supports controls that provide fundamental window-based functionality within a traditional GUI. This includes top-level application windows, multiple-document interface (MDI) child windows, resizable split pane controls, modal dialogs and balloon help windows. Preparation File Explorer should look as shown in the picture. Open UIASpy, place the mouse over window title bar, press F2. Code The code created with UIASpy shows how to alternately switch the window visual state between normal and minimized (Window.au3, Window-a.au3 contains code directly from UIASpy): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\CUIAutomation2.au3" ; Get proper version in UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) 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_IUIAutomationElement, $dtagIUIAutomationElement ) 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_ClassNamePropertyId, "CabinetWClass", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "System (C:)", $pCondition1 ) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pWindow1, $oWindow1 $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pWindow1 ) $oWindow1 = ObjCreateInterface( $pWindow1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow1 ) Then Return ConsoleWrite( "$oWindow1 ERR" & @CRLF ) ConsoleWrite( "$oWindow1 OK" & @CRLF ) ; --- Window Pattern (action) Object --- ConsoleWrite( "--- Window Pattern (action) Object ---" & @CRLF ) Local $pWindowPattern1, $oWindowPattern1 $oWindow1.GetCurrentPattern( $UIA_WindowPatternId, $pWindowPattern1 ) $oWindowPattern1 = ObjCreateInterface( $pWindowPattern1, $sIID_IUIAutomationWindowPattern, $dtagIUIAutomationWindowPattern ) If Not IsObj( $oWindowPattern1 ) Then Return ConsoleWrite( "$oWindowPattern1 ERR" & @CRLF ) ConsoleWrite( "$oWindowPattern1 OK" & @CRLF ) ; --- Control Pattern Properties --- ConsoleWrite( "--- Control Pattern Properties ---" & @CRLF ) Local $iWindowWindowVisualState1 $oWindow1.GetCurrentPropertyValue( $UIA_WindowWindowVisualStatePropertyId, $iWindowWindowVisualState1 ) ConsoleWrite( "$iWindowWindowVisualState1 = " & $iWindowWindowVisualState1 & @CRLF ) ; --- Copy element info --- ; $UIA_WindowWindowVisualStatePropertyId $WindowVisualState_Normal ; --- Window Pattern (action) Methods --- ConsoleWrite( "--- Window Pattern (action) Methods ---" & @CRLF ) If $iWindowWindowVisualState1 = $WindowVisualState_Normal Then $oWindowPattern1.SetWindowVisualState( $WindowVisualState_Minimized ) ConsoleWrite( "$oWindowPattern1.SetWindowVisualState( $WindowVisualState_Minimized )" & @CRLF ) Else $oWindowPattern1.SetWindowVisualState( $WindowVisualState_Normal ) ConsoleWrite( "$oWindowPattern1.SetWindowVisualState( $WindowVisualState_Normal )" & @CRLF ) EndIf EndFunc SciTE output: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oWindow1 OK --- Window Pattern (action) Object --- $oWindowPattern1 OK --- Control Pattern Properties --- $iWindowWindowVisualState1 = 0 --- Window Pattern (action) Methods --- $oWindowPattern1.SetWindowVisualState( $WindowVisualState_Minimized ) Remarks WindowVisualState values are found in CUIAutomation2.au3 and Microsoft documentation. 3. Transform Control Pattern From Microsoft documentation: The Transform control pattern is used to support controls that can be moved, resized, or rotated within a two-dimensional space. Preparation File Explorer should look as shown in the picture. Open UIASpy, place the mouse over window title bar, press F2. Code The code created with UIASpy shows how to move the window horizontally 100 pixels forth and back (Transform.au3, Transform-a.au3 contains code directly from UIASpy): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\CUIAutomation2.au3" ; Get proper version in UIASpy Includes folder #include "..\..\..\Includes\UIA_Functions.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) 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_IUIAutomationElement, $dtagIUIAutomationElement ) 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_ClassNamePropertyId, "CabinetWClass", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "System (C:)", $pCondition1 ) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pWindow1, $oWindow1 $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pWindow1 ) $oWindow1 = ObjCreateInterface( $pWindow1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow1 ) Then Return ConsoleWrite( "$oWindow1 ERR" & @CRLF ) ConsoleWrite( "$oWindow1 OK" & @CRLF ) ; --- Transform Pattern (action) Object --- ConsoleWrite( "--- Transform Pattern (action) Object ---" & @CRLF ) Local $pTransformPattern1, $oTransformPattern1 $oWindow1.GetCurrentPattern( $UIA_TransformPatternId, $pTransformPattern1 ) $oTransformPattern1 = ObjCreateInterface( $pTransformPattern1, $sIID_IUIAutomationTransformPattern, $dtagIUIAutomationTransformPattern ) If Not IsObj( $oTransformPattern1 ) Then Return ConsoleWrite( "$oTransformPattern1 ERR" & @CRLF ) ConsoleWrite( "$oTransformPattern1 OK" & @CRLF ) ; --- Element Properties (information) --- ConsoleWrite( "--- Element Properties (information) ---" & @CRLF ) Local $asBoundingRectangle1 $oWindow1.GetCurrentPropertyValue( $UIA_BoundingRectanglePropertyId, $asBoundingRectangle1 ) UIA_GetArrayPropertyValueAsString( $asBoundingRectangle1 ) ConsoleWrite( "$asBoundingRectangle1 = " & $asBoundingRectangle1 & @CRLF ) ; --- Copy element info --- ; $UIA_BoundingRectanglePropertyId l=250,t=50,w=1000,h=900 ; --- Transform Pattern (action) Methods --- ConsoleWrite( "--- Transform Pattern (action) Methods ---" & @CRLF ) If StringSplit( $asBoundingRectangle1, ",", 2 )[0] = 250 Then ; 2 = $STR_NOCOUNT ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $oTransformPattern1.Move( StringSplit( $asBoundingRectangle1, ",", 2 )[0] + 100, 50 ) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ConsoleWrite( "$oTransformPattern1.Move( +100 )" & @CRLF ) Else $oTransformPattern1.Move( StringSplit( $asBoundingRectangle1, ",", 2 )[0] - 100, 50 ) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ConsoleWrite( "$oTransformPattern1.Move( -100 )" & @CRLF ) EndIf EndFunc SciTE output: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oWindow1 OK --- Transform Pattern (action) Object --- $oTransformPattern1 OK --- Element Properties (information) --- $asBoundingRectangle1 = 250,50,1000,900 --- Transform Pattern (action) Methods --- $oTransformPattern1.Move( +100 ) Remarks Note the use of UIA_GetArrayPropertyValueAsString() function and the inclusion of UIA_Functions.au3 UDF. 4. ExpandCollapse Control Pattern From Microsoft documentation: The ExpandCollapse control pattern is used to support controls that visually expand to display more content and collapse to hide content. Eg. a treeview element with child elements. Preparation File Explorer should look as shown in the picture. The C-drive in the treeview should be collapsed. Open UIASpy, place the mouse over the C-drive, press F1. Code The code generated with UIASpy shows how to alternately expand and collapse the C-drive (ExpandCollapse.au3, ExpandCollapse-a.au3 contains code directly from UIASpy): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\CUIAutomation2.au3" ; Get proper version in UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) 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_IUIAutomationElement, $dtagIUIAutomationElement ) 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_ClassNamePropertyId, "CabinetWClass", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "System (C:)", $pCondition1 ) ; <<<<<<<<<<<<<<<<< $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pWindow1, $oWindow1 $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pWindow1 ) $oWindow1 = ObjCreateInterface( $pWindow1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow1 ) Then Return ConsoleWrite( "$oWindow1 ERR" & @CRLF ) ConsoleWrite( "$oWindow1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2, $pCondition3, $pAndCondition3 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_TreeItemControlTypeId, $pCondition2 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "System (C:)", $pCondition3 ) ; <<<<<<<<<<<<<<<<< $oUIAutomation.CreateAndCondition( $pCondition2, $pCondition3, $pAndCondition3 ) If Not $pAndCondition3 Then Return ConsoleWrite( "$pAndCondition3 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition3 OK" & @CRLF ) Local $pTreeItem1, $oTreeItem1 $oWindow1.FindFirst( $TreeScope_Descendants, $pAndCondition3, $pTreeItem1 ) $oTreeItem1 = ObjCreateInterface( $pTreeItem1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oTreeItem1 ) Then Return ConsoleWrite( "$oTreeItem1 ERR" & @CRLF ) ConsoleWrite( "$oTreeItem1 OK" & @CRLF ) ; --- ExpandCollapse Pattern (action) Object --- ConsoleWrite( "--- ExpandCollapse Pattern (action) Object ---" & @CRLF ) Local $pExpandCollapsePattern1, $oExpandCollapsePattern1 $oTreeItem1.GetCurrentPattern( $UIA_ExpandCollapsePatternId, $pExpandCollapsePattern1 ) $oExpandCollapsePattern1 = ObjCreateInterface( $pExpandCollapsePattern1, $sIID_IUIAutomationExpandCollapsePattern, $dtagIUIAutomationExpandCollapsePattern ) If Not IsObj( $oExpandCollapsePattern1 ) Then Return ConsoleWrite( "$oExpandCollapsePattern1 ERR" & @CRLF ) ConsoleWrite( "$oExpandCollapsePattern1 OK" & @CRLF ) ; --- Control Pattern Properties --- ConsoleWrite( "--- Control Pattern Properties ---" & @CRLF ) Local $iExpandCollapseExpandCollapseState1 $oTreeItem1.GetCurrentPropertyValue( $UIA_ExpandCollapseExpandCollapseStatePropertyId, $iExpandCollapseExpandCollapseState1 ) ConsoleWrite( "$iExpandCollapseExpandCollapseState1 = " & $iExpandCollapseExpandCollapseState1 & @CRLF ) ; --- Copy element info --- ; $UIA_ExpandCollapseExpandCollapseStatePropertyId $ExpandCollapseState_Collapsed ; --- ExpandCollapse Pattern (action) Methods --- ConsoleWrite( "--- ExpandCollapse Pattern (action) Methods ---" & @CRLF ) If $iExpandCollapseExpandCollapseState1 = $ExpandCollapseState_Collapsed Then $oExpandCollapsePattern1.Expand() ConsoleWrite( "$oExpandCollapsePattern1.Expand()" & @CRLF ) Else $oExpandCollapsePattern1.Collapse() ConsoleWrite( "$oExpandCollapsePattern1.Collapse()" & @CRLF ) EndIf EndFunc SciTE output: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oWindow1 OK --- Find window/control --- $pAndCondition3 OK $oTreeItem1 OK --- ExpandCollapse Pattern (action) Object --- $oExpandCollapsePattern1 OK --- Control Pattern Properties --- $iExpandCollapseExpandCollapseState1 = 0 --- ExpandCollapse Pattern (action) Methods --- $oExpandCollapsePattern1.Expand() Remarks ExpandCollapseState values are found in CUIAutomation2.au3 and Microsoft documentation. 5. ScrollItem Control Pattern From Microsoft documentation: The ScrollItem control pattern acts as a communication channel between a child control and its container to ensure that the container can change the currently visible content (or region) within its viewport to display the child control. The ScrollItem pattern object implements one method only: ScrollIntoView(). It can be used to make a child control visible in its parent container control. Eg. to make a treeview item visible in the treeview. Preparation File Explorer should look as shown in the picture. The C-drive in the treeview should be collapsed. Open UIASpy, place the mouse over the C-drive, press F1. Expand the C-drive in the treeview. Expand Windows folder in the treeview. Windows folder should be visible in top of the treeview. The C-drive should be scrolled out of sight. Code The code created with UIASpy shows how to scroll the C-drive into sight (ScrollItem.au3, ScrollItem-a.au3 contains code directly from UIASpy): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\CUIAutomation2.au3" ; Get proper version in UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) 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_IUIAutomationElement, $dtagIUIAutomationElement ) 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_ClassNamePropertyId, "CabinetWClass", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "System (C:)", $pCondition1 ) $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pWindow1, $oWindow1 $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pWindow1 ) $oWindow1 = ObjCreateInterface( $pWindow1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow1 ) Then Return ConsoleWrite( "$oWindow1 ERR" & @CRLF ) ConsoleWrite( "$oWindow1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2, $pCondition3, $pAndCondition3 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_TreeItemControlTypeId, $pCondition2 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "System (C:)", $pCondition3 ) $oUIAutomation.CreateAndCondition( $pCondition2, $pCondition3, $pAndCondition3 ) If Not $pAndCondition3 Then Return ConsoleWrite( "$pAndCondition3 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition3 OK" & @CRLF ) Local $pTreeItem1, $oTreeItem1 $oWindow1.FindFirst( $TreeScope_Descendants, $pAndCondition3, $pTreeItem1 ) $oTreeItem1 = ObjCreateInterface( $pTreeItem1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oTreeItem1 ) Then Return ConsoleWrite( "$oTreeItem1 ERR" & @CRLF ) ConsoleWrite( "$oTreeItem1 OK" & @CRLF ) ; --- ScrollItem Pattern (action) Object --- ConsoleWrite( "--- ScrollItem Pattern (action) Object ---" & @CRLF ) Local $pScrollItemPattern1, $oScrollItemPattern1 $oTreeItem1.GetCurrentPattern( $UIA_ScrollItemPatternId, $pScrollItemPattern1 ) $oScrollItemPattern1 = ObjCreateInterface( $pScrollItemPattern1, $sIID_IUIAutomationScrollItemPattern, $dtagIUIAutomationScrollItemPattern ) If Not IsObj( $oScrollItemPattern1 ) Then Return ConsoleWrite( "$oScrollItemPattern1 ERR" & @CRLF ) ConsoleWrite( "$oScrollItemPattern1 OK" & @CRLF ) ; --- ScrollItem Pattern (action) Methods --- ConsoleWrite( "--- ScrollItem Pattern (action) Methods ---" & @CRLF ) $oScrollItemPattern1.ScrollIntoView() ConsoleWrite( "$oScrollItemPattern1.ScrollIntoView()" & @CRLF ) EndFunc SciTE output: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oWindow1 OK --- Find window/control --- $pAndCondition3 OK $oTreeItem1 OK --- ScrollItem Pattern (action) Object --- $oScrollItemPattern1 OK --- ScrollItem Pattern (action) Methods --- $oScrollItemPattern1.ScrollIntoView() 6. Scroll Control Pattern From Microsoft documentation: The Scroll control pattern is used to support a control that acts as a scrollable container for a collection of child objects. Preparation Run the ScrollItem example in the section above. The C-drive should be visible near the top of the treeview. The treeview scrollbar thumb should also be visible near the top of the treeview. Open UIASpy, place the mouse over the C-drive, press F2. The treeview should be detected. Code The UIASpy generated code shows how to scroll the treeview one page down (Scroll.au3, Scroll-a.au3 contains code directly from UIASpy): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\CUIAutomation2.au3" ; Get proper version in UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) 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_IUIAutomationElement, $dtagIUIAutomationElement ) 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_ClassNamePropertyId, "CabinetWClass", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "System (C:)", $pCondition1 ) ; <<<<<<<<<<<<< $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pWindow1, $oWindow1 $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pWindow1 ) $oWindow1 = ObjCreateInterface( $pWindow1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow1 ) Then Return ConsoleWrite( "$oWindow1 ERR" & @CRLF ) ConsoleWrite( "$oWindow1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_TreeControlTypeId, $pCondition2 ) If Not $pCondition2 Then Return ConsoleWrite( "$pCondition2 ERR" & @CRLF ) ConsoleWrite( "$pCondition2 OK" & @CRLF ) Local $pTree1, $oTree1 $oWindow1.FindFirst( $TreeScope_Descendants, $pCondition2, $pTree1 ) $oTree1 = ObjCreateInterface( $pTree1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oTree1 ) Then Return ConsoleWrite( "$oTree1 ERR" & @CRLF ) ConsoleWrite( "$oTree1 OK" & @CRLF ) ; --- Scroll Pattern (action) Object --- ConsoleWrite( "--- Scroll Pattern (action) Object ---" & @CRLF ) Local $pScrollPattern1, $oScrollPattern1 $oTree1.GetCurrentPattern( $UIA_ScrollPatternId, $pScrollPattern1 ) $oScrollPattern1 = ObjCreateInterface( $pScrollPattern1, $sIID_IUIAutomationScrollPattern, $dtagIUIAutomationScrollPattern ) If Not IsObj( $oScrollPattern1 ) Then Return ConsoleWrite( "$oScrollPattern1 ERR" & @CRLF ) ConsoleWrite( "$oScrollPattern1 OK" & @CRLF ) ; --- Scroll Pattern (action) Methods --- ConsoleWrite( "--- Scroll Pattern (action) Methods ---" & @CRLF ) $oScrollPattern1.Scroll( $ScrollAmount_NoAmount, $ScrollAmount_LargeIncrement ) ; Horizontally, vertically ConsoleWrite( "$oScrollPattern1.Scroll()" & @CRLF ) EndFunc SciTE output: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oWindow1 OK --- Find window/control --- $pCondition2 OK $oTree1 OK --- Scroll Pattern (action) Object --- $oScrollPattern1 OK --- Scroll Pattern (action) Methods --- $oScrollPattern1.Scroll() Remarks ScrollAmount values are found in CUIAutomation2.au3 and Microsoft documentation. 7. Grid Control Pattern From Microsoft documentation: The Grid control pattern supports controls that acts as a container for a collection of child controls that are organized in a two-dimensional logical coordinate system that can be traversed by row and column. These child controls can eg. be the individual cells in a listview. Preparation File Explorer should look as shown in the picture. Open UIASpy, place the mouse over the first visible item in the listview, press F2, press F7. F2 detects the listview item that's parent for the individual item cells (image and edit controls). F7 navigates to the parent control of the item which is the listview. Code Code as created with UIASpy to get the text in a listview cell given by row and column number (Grid.au3, Grid-a.au3 contains code directly from UIASpy): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\CUIAutomation2.au3" ; Get proper version in UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) 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_IUIAutomationElement, $dtagIUIAutomationElement ) 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_ClassNamePropertyId, "CabinetWClass", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "System (C:)", $pCondition1 ) ; <<<<<<<<<<<<<<<<<<<<<<< $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pWindow1, $oWindow1 $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pWindow1 ) $oWindow1 = ObjCreateInterface( $pWindow1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow1 ) Then Return ConsoleWrite( "$oWindow1 ERR" & @CRLF ) ConsoleWrite( "$oWindow1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_ListControlTypeId, $pCondition2 ) If Not $pCondition2 Then Return ConsoleWrite( "$pCondition2 ERR" & @CRLF ) ConsoleWrite( "$pCondition2 OK" & @CRLF ) Local $pList1, $oList1 $oWindow1.FindFirst( $TreeScope_Descendants, $pCondition2, $pList1 ) $oList1 = ObjCreateInterface( $pList1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oList1 ) Then Return ConsoleWrite( "$oList1 ERR" & @CRLF ) ConsoleWrite( "$oList1 OK" & @CRLF ) ; --- Grid Pattern (action) Object --- ConsoleWrite( "--- Grid Pattern (action) Object ---" & @CRLF ) Local $pGridPattern1, $oGridPattern1 $oList1.GetCurrentPattern( $UIA_GridPatternId, $pGridPattern1 ) $oGridPattern1 = ObjCreateInterface( $pGridPattern1, $sIID_IUIAutomationGridPattern, $dtagIUIAutomationGridPattern ) If Not IsObj( $oGridPattern1 ) Then Return ConsoleWrite( "$oGridPattern1 ERR" & @CRLF ) ConsoleWrite( "$oGridPattern1 OK" & @CRLF ) ; --- Control Pattern Properties --- ConsoleWrite( "--- Control Pattern Properties ---" & @CRLF ) Local $iGridColumnCount1 $oList1.GetCurrentPropertyValue( $UIA_GridColumnCountPropertyId, $iGridColumnCount1 ) ConsoleWrite( "$iGridColumnCount1 = " & $iGridColumnCount1 & @CRLF ) Local $iGridRowCount1 $oList1.GetCurrentPropertyValue( $UIA_GridRowCountPropertyId, $iGridRowCount1 ) ConsoleWrite( "$iGridRowCount1 = " & $iGridRowCount1 & @CRLF ) ; --- Grid Pattern (action) Methods --- ConsoleWrite( "--- Grid Pattern (action) Methods ---" & @CRLF ) Local $pEdit1, $oEdit1 $oGridPattern1.GetItem( 4, 0, $pEdit1 ) ; Row, col ConsoleWrite( "$oGridPattern1.GetItem()" & @CRLF ) $oEdit1 = ObjCreateInterface( $pEdit1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) ; --- Control Pattern Properties --- ConsoleWrite( "--- Control Pattern Properties ---" & @CRLF ) Local $sValueValue1 $oEdit1.GetCurrentPropertyValue( $UIA_ValueValuePropertyId, $sValueValue1 ) ConsoleWrite( "$sValueValue1 = " & $sValueValue1 & @CRLF ) EndFunc SciTE output: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oWindow1 OK --- Find window/control --- $pCondition2 OK $oList1 OK --- Grid Pattern (action) Object --- $oGridPattern1 OK --- Control Pattern Properties --- $iGridColumnCount1 = 4 $iGridRowCount1 = 21 --- Grid Pattern (action) Methods --- $oGridPattern1.GetItem() --- Control Pattern Properties --- $sValueValue1 = Intel Remarks Read about $oGridPattern.GetItem() in the Microsoft documentation. 8. Table Control Pattern From Microsoft documentation: The Table control pattern is used to support controls that act as containers for a collection of child elements. The children of the container element must be organized in a two-dimensional logical coordinate system that can be traversed by row and column. This control pattern is analogous to the Grid control pattern with the distinction that the Table control pattern must also expose a column and/or row header relationship for each child element. The Table control pattern can be used to get information about the header control in a listview. Preparation File Explorer should look as shown in the picture. Open UIASpy, place the mouse over the header control in the listview, press F2, press F7. F2 detects the header control that's parent for the individual header items. F7 navigates to the parent control of the header which is the listview. Code The code generated with UIASpy shows how to get information about the header control (Table.au3, Table-a.au3 contains code directly from UIASpy): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\CUIAutomation2.au3" ; Get proper version in UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) 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_IUIAutomationElement, $dtagIUIAutomationElement ) 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_ClassNamePropertyId, "CabinetWClass", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "System (C:)", $pCondition1 ) ; <<<<<<<<<<<<< $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pWindow1, $oWindow1 $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pWindow1 ) $oWindow1 = ObjCreateInterface( $pWindow1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow1 ) Then Return ConsoleWrite( "$oWindow1 ERR" & @CRLF ) ConsoleWrite( "$oWindow1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_ListControlTypeId, $pCondition2 ) If Not $pCondition2 Then Return ConsoleWrite( "$pCondition2 ERR" & @CRLF ) ConsoleWrite( "$pCondition2 OK" & @CRLF ) Local $pList1, $oList1 $oWindow1.FindFirst( $TreeScope_Descendants, $pCondition2, $pList1 ) $oList1 = ObjCreateInterface( $pList1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oList1 ) Then Return ConsoleWrite( "$oList1 ERR" & @CRLF ) ConsoleWrite( "$oList1 OK" & @CRLF ) ; --- Table Pattern (action) Object --- ConsoleWrite( "--- Table Pattern (action) Object ---" & @CRLF ) Local $pTablePattern1, $oTablePattern1 $oList1.GetCurrentPattern( $UIA_TablePatternId, $pTablePattern1 ) $oTablePattern1 = ObjCreateInterface( $pTablePattern1, $sIID_IUIAutomationTablePattern, $dtagIUIAutomationTablePattern ) If Not IsObj( $oTablePattern1 ) Then Return ConsoleWrite( "$oTablePattern1 ERR" & @CRLF ) ConsoleWrite( "$oTablePattern1 OK" & @CRLF ) ; --- Table Pattern (action) Methods --- ConsoleWrite( "--- Table Pattern (action) Methods ---" & @CRLF ) Local $pElements $oTablePattern1.GetCurrentColumnHeaders( $pElements ) ConsoleWrite( "$oTablePattern1.GetCurrentColumnHeaders()" & @CRLF ) ; --- Code Snippets --- ConsoleWrite( "--- Code Snippets ---" & @CRLF ) Local $oAutomationElementArray1, $iLength1 ; $pElements is a pointer to an UI Automation element array $oAutomationElementArray1 = ObjCreateInterFace( $pElements, $sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray ) $oAutomationElementArray1.Length( $iLength1 ) If Not $iLength1 Then Return ConsoleWrite( "$iLength1 = 0 ERR" & @CRLF ) ConsoleWrite( "$iLength1 = " & $iLength1 & @CRLF ) ; --- Code Snippets --- ConsoleWrite( "--- Code Snippets ---" & @CRLF ) Local $pElement1, $oElement1, $sValue1 For $i = 0 To $iLength1 - 1 $oAutomationElementArray1.GetElement( $i, $pElement1 ) $oElement1 = ObjCreateInterface( $pElement1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) $oElement1.GetCurrentPropertyValue( $UIA_ClassNamePropertyId, $sValue1 ) ; $UIA_ClassNamePropertyId is used as example ConsoleWrite( "$sValue1 = " & $sValue1 & @CRLF ) $oElement1.GetCurrentPropertyValue( $UIA_NamePropertyId, $sValue1 ) ConsoleWrite( "$sValue1 = " & $sValue1 & @CRLF ) Next ; --- Copy element info --- ; $UIA_NamePropertyId Name EndFunc SciTE output: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oWindow1 OK --- Find window/control --- $pCondition2 OK $oList1 OK --- Table Pattern (action) Object --- $oTablePattern1 OK --- Table Pattern (action) Methods --- $oTablePattern1.GetCurrentColumnHeaders() --- Code Snippets --- $iLength1 = 4 --- Code Snippets --- $sValue1 = UIColumnHeader $sValue1 = Name $sValue1 = UIColumnHeader $sValue1 = Date modified $sValue1 = UIColumnHeader $sValue1 = Type $sValue1 = UIColumnHeader $sValue1 = Size Remarks Note the loop in bottom of the code that's used to traverse the UI Automation element array to get information about the individual header elements. The $UIA_NamePropertyId is copied in UIASpy from the Name header item. 9. Invoke Control Pattern From Microsoft documentation: The Invoke control pattern is used to support controls that do not maintain state when activated but rather initiate or perform a single, unambiguous action. Controls that do maintain state, such as check boxes and radio buttons, must instead implement Toggle and Selection patterns respectively. In short, the Invoke pattern is used to implement the click action. Preparation File Explorer should look as shown in the picture. Select Windows folder in the listview. Open UIASpy, place the mouse over Windows folder, press F2. F2 detects the listview item that's parent for the individual listview fields (image and edit controls). Code Code to click the Windows folder as generated with UIASpy (Invoke.au3, Invoke-a.au3 contains code directly from UIASpy): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\CUIAutomation2.au3" ; Get proper version in UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) 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_IUIAutomationElement, $dtagIUIAutomationElement ) 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_ClassNamePropertyId, "CabinetWClass", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "System (C:)", $pCondition1 ) ; <<<<<<<<<<<<<<<<< $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pWindow1, $oWindow1 $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pWindow1 ) $oWindow1 = ObjCreateInterface( $pWindow1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow1 ) Then Return ConsoleWrite( "$oWindow1 ERR" & @CRLF ) ConsoleWrite( "$oWindow1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2, $pCondition3, $pAndCondition3 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_ListItemControlTypeId, $pCondition2 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "Windows", $pCondition3 ) ; <<<<<<<<<<<<<<<<<<<<< $oUIAutomation.CreateAndCondition( $pCondition2, $pCondition3, $pAndCondition3 ) If Not $pAndCondition3 Then Return ConsoleWrite( "$pAndCondition3 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition3 OK" & @CRLF ) Local $pListItem1, $oListItem1 $oWindow1.FindFirst( $TreeScope_Descendants, $pAndCondition3, $pListItem1 ) $oListItem1 = ObjCreateInterface( $pListItem1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oListItem1 ) Then Return ConsoleWrite( "$oListItem1 ERR" & @CRLF ) ConsoleWrite( "$oListItem1 OK" & @CRLF ) ; --- Invoke Pattern (action) Object --- ConsoleWrite( "--- Invoke Pattern (action) Object ---" & @CRLF ) Local $pInvokePattern1, $oInvokePattern1 $oListItem1.GetCurrentPattern( $UIA_InvokePatternId, $pInvokePattern1 ) $oInvokePattern1 = ObjCreateInterface( $pInvokePattern1, $sIID_IUIAutomationInvokePattern, $dtagIUIAutomationInvokePattern ) If Not IsObj( $oInvokePattern1 ) Then Return ConsoleWrite( "$oInvokePattern1 ERR" & @CRLF ) ConsoleWrite( "$oInvokePattern1 OK" & @CRLF ) ; --- Invoke Pattern (action) Methods --- ConsoleWrite( "--- Invoke Pattern (action) Methods ---" & @CRLF ) $oInvokePattern1.Invoke() ConsoleWrite( "$oInvokePattern1.Invoke()" & @CRLF ) EndFunc SciTE output: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oWindow1 OK --- Find window/control --- $pAndCondition3 OK $oListItem1 OK --- Invoke Pattern (action) Object --- $oInvokePattern1 OK --- Invoke Pattern (action) Methods --- $oInvokePattern1.Invoke() Remarks Sometimes the Invoke() method does not work for a control. Mainly because the method isn't implemented by the provider. The most common workaround is to perform a MouseClick in the middle of the control (calculated from bounding rectangel). See How to topic number 16. Another workaround is to use classic automation code if possible. See How to topic number 17. Examples Other examples: MouseClick in middle of the control: How to topic number 16. Click with classic automation code: How to topic number 17. 10. MultipleView Control Pattern From Microsoft documentation: The MultipleView control pattern is used to support controls that provide, and are able to switch between, multiple representations of the same information or the same set of child controls. Examples of controls that can present multiple views include the listview (which can show its contents as thumbnails, tiles, icons, or details), Microsoft Excel charts (pie, line, bar, cell value with a formula), Microsoft Word documents (normal, web layout, print layout, reading layout, outline), Microsoft Outlook calendar (year, month, week, day), and Microsoft Windows Media Player skins. Preparation File Explorer should look as shown in the picture. Open UIASpy, place the mouse over the first visible item in the listview, press F2, press F7. F2 detects the listview item that's parent for the individual item cells (image and edit controls). F7 navigates to the parent control of the item which is the listview. Code The code generated with UIASpy shows how to get an array of view identifiers (integers). The returned array is a safearray of integers. The code also shows how to extract the integers from the safearray (MultipleView.au3, MultipleView-a.au3 contains code directly from UIASpy): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\CUIAutomation2.au3" ; Get proper version in UIASpy Includes folder #include "..\..\..\Includes\UIA_SafeArray.au3" ; Can be copied from UIASpy Includes folder #include "..\..\..\Includes\UIA_Variant.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) 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_IUIAutomationElement, $dtagIUIAutomationElement ) 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_ClassNamePropertyId, "CabinetWClass", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "System (C:)", $pCondition1 ) ; <<<<<<<<<<<<< $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pWindow1, $oWindow1 $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pWindow1 ) $oWindow1 = ObjCreateInterface( $pWindow1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow1 ) Then Return ConsoleWrite( "$oWindow1 ERR" & @CRLF ) ConsoleWrite( "$oWindow1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_ListControlTypeId, $pCondition2 ) If Not $pCondition2 Then Return ConsoleWrite( "$pCondition2 ERR" & @CRLF ) ConsoleWrite( "$pCondition2 OK" & @CRLF ) Local $pList1, $oList1 $oWindow1.FindFirst( $TreeScope_Descendants, $pCondition2, $pList1 ) $oList1 = ObjCreateInterface( $pList1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oList1 ) Then Return ConsoleWrite( "$oList1 ERR" & @CRLF ) ConsoleWrite( "$oList1 OK" & @CRLF ) ; --- MultipleView Pattern (action) Object --- ConsoleWrite( "--- MultipleView Pattern (action) Object ---" & @CRLF ) Local $pMultipleViewPattern1, $oMultipleViewPattern1 $oList1.GetCurrentPattern( $UIA_MultipleViewPatternId, $pMultipleViewPattern1 ) $oMultipleViewPattern1 = ObjCreateInterface( $pMultipleViewPattern1, $sIID_IUIAutomationMultipleViewPattern, $dtagIUIAutomationMultipleViewPattern ) If Not IsObj( $oMultipleViewPattern1 ) Then Return ConsoleWrite( "$oMultipleViewPattern1 ERR" & @CRLF ) ConsoleWrite( "$oMultipleViewPattern1 OK" & @CRLF ) ; --- MultipleView Pattern (action) Methods --- ConsoleWrite( "--- MultipleView Pattern (action) Methods ---" & @CRLF ) Local $pSafeArray $oMultipleViewPattern1.GetCurrentSupportedViews( $pSafeArray ) ConsoleWrite( "$oMultipleViewPattern1.GetCurrentSupportedViews()" & @CRLF ) If Not $pSafeArray Then Return ConsoleWrite( "$pSafeArray ERR" & @CRLF ) ConsoleWrite( "$pSafeArray OK" & @CRLF ) Local $iElements, $iViewId SafeArrayGetUBound( $pSafeArray, 1, $iElements ) ConsoleWrite( "$iElements = " & $iElements & @CRLF ) For $i = 0 To $iElements - 1 SafeArrayGetElement( $pSafeArray, $i, $iViewId ) ConsoleWrite( "$iViewId = " & $iViewId & @CRLF ) Next EndFunc SciTE output: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oWindow1 OK --- Find window/control --- $pCondition2 OK $oList1 OK --- MultipleView Pattern (action) Object --- $oMultipleViewPattern1 OK --- MultipleView Pattern (action) Methods --- $oMultipleViewPattern1.GetCurrentSupportedViews() $pSafeArray OK $iElements = 7 $iViewId = 0 $iViewId = 1 $iViewId = 2 $iViewId = 3 $iViewId = 4 $iViewId = 5 $iViewId = 6 Remarks Note that UIA_SafeArray.au3 and UIA_Variant.au3 are included in top of the code to be able to handle safearrays. Note also how the view identifiers are extracted from the safearray returned by $oMultipleViewPattern.GetCurrentSupportedViews() in bottom of the code. Read about $oMultipleViewPattern.GetCurrentSupportedViews() in the Microsoft documentation. 11. SelectionItem Control Pattern From Microsoft documentation: The SelectionItem control pattern is used to support controls that act as individual, selectable child items of container controls. Eg. listbox and listview items. Preparation File Explorer should look as shown in the picture. Open UIASpy, place the mouse over the first visible item in the listview, press F2. F2 detects the listview item that's parent for the individual listview fields (image and edit controls). Code The code created with UIASpy shows how to select the first item in the listview and then select additional four items: (SelectionItem.au3, SelectionItem-a.au3 contains code directly from UIASpy): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\CUIAutomation2.au3" ; Get proper version in UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) 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_IUIAutomationElement, $dtagIUIAutomationElement ) 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_ClassNamePropertyId, "CabinetWClass", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "System (C:)", $pCondition1 ) ; <<<<<<<<<<<<<<<<< $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pWindow1, $oWindow1 $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pWindow1 ) $oWindow1 = ObjCreateInterface( $pWindow1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow1 ) Then Return ConsoleWrite( "$oWindow1 ERR" & @CRLF ) ConsoleWrite( "$oWindow1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2, $pCondition3, $pAndCondition3 $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, "0", $pCondition2 ) $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_ListItemControlTypeId, $pCondition3 ) $oUIAutomation.CreateAndCondition( $pCondition2, $pCondition3, $pAndCondition3 ) If Not $pAndCondition3 Then Return ConsoleWrite( "$pAndCondition3 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition3 OK" & @CRLF ) Local $pListItem1, $oListItem1 $oWindow1.FindFirst( $TreeScope_Descendants, $pAndCondition3, $pListItem1 ) $oListItem1 = ObjCreateInterface( $pListItem1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oListItem1 ) Then Return ConsoleWrite( "$oListItem1 ERR" & @CRLF ) ConsoleWrite( "$oListItem1 OK" & @CRLF ) ; --- SelectionItem Pattern (action) Object --- ConsoleWrite( "--- SelectionItem Pattern (action) Object ---" & @CRLF ) Local $pSelectionItemPattern1, $oSelectionItemPattern1 $oListItem1.GetCurrentPattern( $UIA_SelectionItemPatternId, $pSelectionItemPattern1 ) $oSelectionItemPattern1 = ObjCreateInterface( $pSelectionItemPattern1, $sIID_IUIAutomationSelectionItemPattern, $dtagIUIAutomationSelectionItemPattern ) If Not IsObj( $oSelectionItemPattern1 ) Then Return ConsoleWrite( "$oSelectionItemPattern1 ERR" & @CRLF ) ConsoleWrite( "$oSelectionItemPattern1 OK" & @CRLF ) ; --- SelectionItem Pattern (action) Methods --- ConsoleWrite( "--- SelectionItem Pattern (action) Methods ---" & @CRLF ) $oSelectionItemPattern1.Select() ConsoleWrite( "$oSelectionItemPattern1.Select()" & @CRLF ) ; --- Add 4 items to selection --- ConsoleWrite( "--- Add 4 items to selection ---" & @CRLF ) For $i = 1 To 4 ; 3 lines copied from code above $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, String( $i ), $pCondition2 ) ; Modified: "0" --> String( $i ) $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_ListItemControlTypeId, $pCondition3 ) $oUIAutomation.CreateAndCondition( $pCondition2, $pCondition3, $pAndCondition3 ) ; 2 lines copied from code above $oWindow1.FindFirst( $TreeScope_Descendants, $pAndCondition3, $pListItem1 ) $oListItem1 = ObjCreateInterface( $pListItem1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) ; 2 lines copied from code above $oListItem1.GetCurrentPattern( $UIA_SelectionItemPatternId, $pSelectionItemPattern1 ) $oSelectionItemPattern1 = ObjCreateInterface( $pSelectionItemPattern1, $sIID_IUIAutomationSelectionItemPattern, $dtagIUIAutomationSelectionItemPattern ) ; 2 lines copied from SelectionItem-a.au3 $oSelectionItemPattern1.AddToSelection() ConsoleWrite( "$oSelectionItemPattern1.AddToSelection()" & @CRLF ) Next EndFunc SciTE output: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oWindow1 OK --- Find window/control --- $pAndCondition3 OK $oListItem1 OK --- SelectionItem Pattern (action) Object --- $oSelectionItemPattern1 OK --- SelectionItem Pattern (action) Methods --- $oSelectionItemPattern1.Select() --- Add 4 items to selection --- $oSelectionItemPattern1.AddToSelection() $oSelectionItemPattern1.AddToSelection() $oSelectionItemPattern1.AddToSelection() $oSelectionItemPattern1.AddToSelection() Remarks Note the For-loop to add 4 items to selection. 12. Selection Control Pattern From Microsoft documentation: The Selection control pattern is used to support controls that act as containers for a collection of selectable child items. Eg. a listview with selectable items. Preparation Run the SelectionItem example in the section above. Five items should be selected in top of the listview. Open UIASpy, place the mouse over the first selected item, press F2, press F7. The listview should be detected. F2 detects the listview item that's parent for the individual item cells (image and edit controls). F7 navigates to the parent control of the item which is the listview. Code The UIASpy generated code shows how to get the selected listview items as an UI Automation element array and how to get access to the individual elements in the array: (Selection.au3, Selection-a.au3 contains code directly from UIASpy): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\CUIAutomation2.au3" ; Get proper version in UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) 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_IUIAutomationElement, $dtagIUIAutomationElement ) 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_ClassNamePropertyId, "CabinetWClass", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "System (C:)", $pCondition1 ) ; <<<<<<<<<<<<< $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pWindow1, $oWindow1 $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pWindow1 ) $oWindow1 = ObjCreateInterface( $pWindow1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow1 ) Then Return ConsoleWrite( "$oWindow1 ERR" & @CRLF ) ConsoleWrite( "$oWindow1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_ListControlTypeId, $pCondition2 ) If Not $pCondition2 Then Return ConsoleWrite( "$pCondition2 ERR" & @CRLF ) ConsoleWrite( "$pCondition2 OK" & @CRLF ) Local $pList1, $oList1 $oWindow1.FindFirst( $TreeScope_Descendants, $pCondition2, $pList1 ) $oList1 = ObjCreateInterface( $pList1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oList1 ) Then Return ConsoleWrite( "$oList1 ERR" & @CRLF ) ConsoleWrite( "$oList1 OK" & @CRLF ) ; --- Selection Pattern (action) Object --- ConsoleWrite( "--- Selection Pattern (action) Object ---" & @CRLF ) Local $pSelectionPattern1, $oSelectionPattern1 $oList1.GetCurrentPattern( $UIA_SelectionPatternId, $pSelectionPattern1 ) $oSelectionPattern1 = ObjCreateInterface( $pSelectionPattern1, $sIID_IUIAutomationSelectionPattern, $dtagIUIAutomationSelectionPattern ) If Not IsObj( $oSelectionPattern1 ) Then Return ConsoleWrite( "$oSelectionPattern1 ERR" & @CRLF ) ConsoleWrite( "$oSelectionPattern1 OK" & @CRLF ) ; --- Selection Pattern (action) Methods --- ConsoleWrite( "--- Selection Pattern (action) Methods ---" & @CRLF ) Local $pElements $oSelectionPattern1.GetCurrentSelection( $pElements ) ConsoleWrite( "$oSelectionPattern1.GetCurrentSelection()" & @CRLF ) ; --- Code Snippets --- ConsoleWrite( "--- Code Snippets ---" & @CRLF ) Local $oAutomationElementArray1, $iLength1 ; $pElements is a pointer to an UI Automation element array $oAutomationElementArray1 = ObjCreateInterFace( $pElements, $sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray ) $oAutomationElementArray1.Length( $iLength1 ) If Not $iLength1 Then Return ConsoleWrite( "$iLength1 = 0 ERR" & @CRLF ) ConsoleWrite( "$iLength1 = " & $iLength1 & @CRLF ) ; --- Code Snippets --- ConsoleWrite( "--- Code Snippets ---" & @CRLF ) Local $pElement1, $oElement1, $sValue1 For $i = 0 To $iLength1 - 1 $oAutomationElementArray1.GetElement( $i, $pElement1 ) $oElement1 = ObjCreateInterface( $pElement1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) $oElement1.GetCurrentPropertyValue( $UIA_ClassNamePropertyId, $sValue1 ) ; $UIA_ClassNamePropertyId is used as example ConsoleWrite( "$sValue1 = " & $sValue1 & @CRLF ) $oElement1.GetCurrentPropertyValue( $UIA_ValueValuePropertyId, $sValue1 ) ConsoleWrite( "$sValue1 = " & $sValue1 & @CRLF ) Next ; --- Copy element info --- ; $UIA_ValueValuePropertyId $Recycle.Bin EndFunc SciTE output: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oWindow1 OK --- Find window/control --- $pCondition2 OK $oList1 OK --- Selection Pattern (action) Object --- $oSelectionPattern1 OK --- Selection Pattern (action) Methods --- $oSelectionPattern1.GetCurrentSelection() --- Code Snippets --- $iLength1 = 5 --- Code Snippets --- $sValue1 = UIItem $sValue1 = $Recycle.Bin $sValue1 = UIItem $sValue1 = Config.Msi $sValue1 = UIItem $sValue1 = Documents and Settings $sValue1 = UIItem $sValue1 = Intel $sValue1 = UIItem $sValue1 = MSOCache Remarks Note the loop in bottom of the code that's used to traverse the UI Automation element array to get information about the individual elements. The $UIA_ValueValuePropertyId is copied in UIASpy from the edit element of the first selected listview item. Top of post1 point