Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: UIAutomationClient Explorer CabinetWClass SysTreeView32 Tree System.Windows.Automation.TreeScope System.Windows.Automation.AutomationElement
ShellExecute('explorer.exe', '', '', @NORMAL, '') TimeDelay(1) ; Load required assemblies. ObjectClrOption("use","UIAutomationClient, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35") ObjectClrOption("use","UIAutomationTypes, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35") ; Search scope enumerated values. enumScope = ObjectClrNew("System.Windows.Automation.TreeScope") ; Get access to the desktop window which is the parent of all other windows. objUiElement = ObjectClrNew("System.Windows.Automation.AutomationElement") objUiRoot = objUiElement.RootElement ; Instantiate a property condition for IE objPropCon1 = ObjectClrNew("System.Windows.Automation.PropertyCondition", objUiElement.ClassNameProperty, "CabinetWClass") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Find the first Explorer window under the desktop nElement = enumScope.Children Scope = ObjectClrType("System.Windows.Automation.TreeScope",nElement) ; Find the first explorer under the desktop. objExplorer = objUiRoot.FindFirst(Scope,objPropCon1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Find the first treeview control in explorer. ; Istantiate other useful classes need to search for a treeview control. objPropCon2 = ObjectClrNew("System.Windows.Automation.PropertyCondition", objUiElement.ClassNameProperty, "SysTreeView32") ;; Search scope. nElement = enumScope.Descendants Scope = ObjectClrType("System.Windows.Automation.TreeScope",nElement) ; Find IE objTree = objExplorer.FindFirst(Scope,objPropCon2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Get the all items of the tree. ; Classes needed to obtain a treeveiw item. objCtrlType = ObjectClrNew("System.Windows.Automation.ControlType") objPropCon3 = ObjectClrNew("System.Windows.Automation.PropertyCondition", objUiElement.ControlTypeProperty, objCtrlType.TreeItem) list = '' objAllItems = objTree.FindAll(Scope,objPropCon3) ForEach objItem In objAllItems If list == "" Then list = objItem.GetCurrentPropertyValue(objUiElement.NameProperty) Else list = list:',':objItem.GetCurrentPropertyValue(objUiElement.NameProperty) Next AskItemlist( 'All Items', list, ',', @UNSORTED, @SINGLE ) Exit
Article ID: W18526
Filename: Grab Property Names of Controls.txt
File Created: 2014:07:29:14:36:26
Last Updated: 2014:07:29:14:36:26