OldMan-Newbee Posted June 9, 2021 Posted June 9, 2021 I am new to using AutoIT & UIASpy and UI Automation. First THANK YOU to LarsJ and junkew and all the others who have replied in this topic. I need to put text into multiple textboxes in an already open Edge session. Using the Chrome - Click an extension Example - I Have succeeded in placing the first string in the first textbox. All of the text boxes on the site are called TEXTBOX and are in different Groups or Tables. The GROUPS each show a different $UIA_AutomationIdPropertyId. For each TABLE and TEXTBOX the only thing I see that is different between each is the $UIA_BouningRectanglePropertyId and the $UIA_ClickablePointPropertyId. I can't seem to utilize these differences to find and get text into each of the other textbox. I'm so sorry I'm so woefully ignorant. I just need a few more bread crumbs. expandcollapse popup3Wrapper_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\UIA_Constants.au3" ;#include "Includes\CUIAutomation2.au3" Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation ) 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, $dtag_IUIAutomationElement ) If Not IsObj( $oDesktop ) Then Return ConsoleWrite( "$oDesktop ERR" & @CRLF ) ConsoleWrite( "$oDesktop OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "Chrome_WidgetWin_1", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) Local $pWindow1, $oWindow1 $oDesktop.FindFirst( $TreeScope_Children, $pCondition0, $pWindow1 ) $oWindow1 = ObjCreateInterface( $pWindow1, $sIID_IUIAutomationElement9, $dtag_IUIAutomationElement9 ) If Not IsObj( $oWindow1 ) Then Return ConsoleWrite( "$oWindow1 ERR" & @CRLF ) ConsoleWrite( "$oWindow1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_AriaRolePropertyId, "form", $pCondition1 ) If Not $pCondition1 Then Return ConsoleWrite( "$pCondition1 ERR" & @CRLF ) ConsoleWrite( "$pCondition1 OK" & @CRLF ) Local $pGroup1, $oGroup1 $oWindow1.FindFirst( $TreeScope_Descendants, $pCondition1, $pGroup1 ) $oGroup1 = ObjCreateInterface( $pGroup1, $sIID_IUIAutomationElement9, $dtag_IUIAutomationElement9 ) If Not IsObj( $oGroup1 ) Then Return ConsoleWrite( "$oGroup1 ERR" & @CRLF ) ConsoleWrite( "$oGroup1 OK - " & $pCondition1 & " - " & $pGroup1 & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2 $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, "TOP", $pCondition2 ) If Not $pCondition2 Then Return ConsoleWrite( "$pCondition2 ERR" & @CRLF ) ConsoleWrite( "$pCondition2 OK " & @CRLF ) Local $pGroup2, $oGroup2 $oWindow1.FindFirst( $TreeScope_Descendants, $pCondition2, $pGroup2 ) $oGroup2 = ObjCreateInterface( $pGroup2, $sIID_IUIAutomationElement9, $dtag_IUIAutomationElement9 ) If Not IsObj( $oGroup2 ) Then Return ConsoleWrite( "$oGroup2 ERR- " & $pCondition2 & " - " & $pGroup2 & @CRLF ) ConsoleWrite( "$oGroup2 OK- " & $pCondition2 & " - " & $pGroup2 & @CRLF ) EndFunc
Moderators Melba23 Posted June 10, 2021 Moderators Posted June 10, 2021 Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states: Quote Share your cool AutoIt scripts, UDFs and applications with others. Do not post general support questions here, instead use the AutoIt Help and Support forums. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
LarsJ Posted June 10, 2021 Posted June 10, 2021 The first thing you should do is to print the control structure for the entire Edge window so that it's possible to get an overview of all these edit and group controls. How to do it is described in this post. Paste the information into your editor and search/replace the crossed out information with a series of x's or similar. Finally, paste the text into a code box so that it's possible to study the control structure a little more closely. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions
OldMan-Newbee Posted June 10, 2021 Author Posted June 10, 2021 @Malba23 I'm sorry I posted incorrectly. Thank you for cleaning up after me.
OldMan-Newbee Posted June 10, 2021 Author Posted June 10, 2021 expandcollapse popup0000 Window: XXXXXXX - XXXXXXX Inquiry - Profile 1 - Microsoft Edge 0001 Pane: XXXXXXX - XXXXXXX Inquiry - Microsoft Edge - Profile 1 0002 Pane: Microsoft Edge 0003 Pane: GlassBrowserFrameView 0004 Button: TabIconView 0005 Pane: FocusRing 0006 Pane: InkDropContainerView 0007 Text: LabelButtonLabel 0008 Text: XXXXXXX - XXXXXXX Inquiry - Profile 1 - Microsoft Edge 0009 Pane: GlassBrowserCaptionButtonContainer 0010 Button: Minimize 0011 Button: Maximize 0012 Button: Restore 0013 Pane: FocusRing 0014 Button: Close 0015 Pane: BrowserView 0016 Pane: TopContainerView 0017 Tab: Tab bar 0018 Pane: TabStrip 0019 TabItem: XXXXXXX - XXXXXXX Inquiry 0020 Text: XXXXXXX - XXXXXXX Inquiry 0021 Pane: TabIcon 0022 Button: Mute tab 0023 Pane: FocusRing 0024 Button: Close tab 0025 Pane: FocusRing 0026 Pane: FocusRing 0027 Pane: Separator 0028 Pane: ScrollView 0029 Pane: ScrollView::Viewport 0030 Pane: View 0031 Pane: ScrollView::Viewport 0032 Pane: FocusRing 0033 Pane: Separator 0034 Button: New Tab 0035 Pane: InkDropContainerView 0036 Pane: FocusRing 0037 Text: New tab 0038 Text: Ctrl+T 0039 Button: New Tab 0040 Pane: InkDropContainerView 0041 Pane: FocusRing 0042 Text: New tab 0043 Text: Ctrl+T 0044 Pane: FrameGrabHandle 0045 Pane: TipMarqueeView 0046 Group: StyledLabel 0047 ToolBar: App bar 0048 Group: LocationBarView 0049 Button: IconLabelBubbleView 0050 Text: AXVirtualView 0051 Pane: PermissionChip 0052 Button: OmniboxChipButton 0053 Pane: FocusRing 0054 Pane: InkDropContainerView 0055 Text: LabelButtonLabel 0056 Button: View site information 0057 Text: AXVirtualView 0058 Edit: Address and search bar 0059 Text: Label 0060 Group: SelectedKeywordView 0061 Text: AXVirtualView 0062 Group: KeywordHintView 0063 Button: ContentSettingImageView 0064 Text: AXVirtualView 0065 Button: ContentSettingImageView 0066 Text: AXVirtualView 0067 Button: ContentSettingImageView 0068 Text: AXVirtualView 0069 Button: ContentSettingImageView 0070 Text: AXVirtualView 0071 Button: ContentSettingImageView 0072 Text: AXVirtualView 0073 Button: ContentSettingImageView 0074 Text: AXVirtualView 0075 Button: This page wants to install a service handler. 0076 Text: AXVirtualView 0077 Button: ContentSettingImageView 0078 Text: AXVirtualView 0079 Button: ContentSettingImageView 0080 Text: AXVirtualView 0081 Button: ContentSettingImageView 0082 Text: AXVirtualView 0083 Button: ContentSettingImageView 0084 Text: AXVirtualView 0085 Button: ContentSettingImageView 0086 Text: AXVirtualView 0087 Button: ContentSettingImageView 0088 Text: AXVirtualView 0089 Button: ContentSettingImageView 0090 Text: AXVirtualView 0091 Button: ContentSettingImageView 0092 Text: AXVirtualView 0093 Button: Notifications blocked 0094 Text: AXVirtualView 0095 Pane: PageActionIconContainerView 0096 Button: Send this page 0097 Text: AXVirtualView 0098 Button: Make a call from 0099 Text: AXVirtualView 0100 Button: Create QR code for this Page 0101 Text: AXVirtualView 0102 Button: Manage your passwords 0103 Text: AXVirtualView 0104 Button: To open this link, choose an app 0105 Text: AXVirtualView 0106 Button: App available. Install 0107 Text: AXVirtualView 0108 Button: Shopping in Microsoft Edge 0109 Text: AXVirtualView 0110 Button: Find 0111 Text: AXVirtualView 0112 Button: Enter Immersive Reader (F9) 0113 Text: AXVirtualView 0114 Button: Show translate options 0115 Text: AXVirtualView 0116 Button: Zoom: 100% 0117 Text: AXVirtualView 0118 Button: This page is allowed to view files 0119 Text: AXVirtualView 0120 Button: Third-party cookie blocking 0121 Text: AXVirtualView 0122 Button: Google Pay offer available 0123 Text: AXVirtualView 0124 Button: Save card 0125 Text: AXVirtualView 0126 Button: Save personal info 0127 Text: AXVirtualView 0128 Button: Clear input 0129 Pane: FocusRing 0130 Pane: AccessiblePaneView 0131 Pane: ContentsSeparator 0132 Group: Infobar Container 0133 Pane: ContentShadow 0134 Pane: View 0135 Document: WebView 0136 Pane: NativeViewHost 0137 Pane: View 0138 Document: WebView 0139 Pane: NativeViewHost 0140 Pane: View 0141 Document: WebView 0142 Pane: NativeViewHost 0143 Pane: Chrome Legacy Window 0144 Document: XXXXXXX - XXXXXXX Inquiry 0145 Document 0146 Document 0147 Group 0148 Group 0149 Separator: 0150 Text: Show Thumbnail Photos 0151 CheckBox 0152 Separator: 0153 Separator: 0154 Table 0155 DataItem 0156 DataItem: Region: Kansas City Car ID: 0157 Text: Region: 0158 ComboBox 0159 Text: 0160 Text: Car ID: 0161 Edit 0162 Group 0163 Table 0164 DataItem 0165 DataItem: Command Line 0166 Text: Command Line 0167 DataItem 0168 Separator 0169 Text: 0170 Edit 0171 Group 0172 Group 0173 Table 0174 DataItem 0175 DataItem: License 0176 Text: License 0177 DataItem 0178 Separator 0179 Table 0180 DataItem 0181 DataItem: License # 0182 Group: FORM_LABEL 0183 Text: License # 0184 DataItem 0185 Edit 0186 DataItem: Year 0187 Group: FORM_LABEL 0188 Text: Year 0189 DataItem 0190 Edit 0191 DataItem: State 0192 Group: FORM_LABEL 0193 Text: State 0194 DataItem: Kansas 0195 ComboBox 0196 DataItem: Type 0197 Group: FORM_LABEL 0198 Text: Type 0199 DataItem: Passenger Car 0200 ComboBox 0201 DataItem 0202 DataItem: Tab # 0203 Group: FORM_LABEL 0204 Text: Tab # 0205 DataItem 0206 Edit 0207 Table 0208 DataItem 0209 DataItem: Vehicle 0210 Text: Vehicle 0211 DataItem 0212 Separator the CARID on line 0154-0161 is the only box I have successfully populated with text. Line 0162-0167 - Command Line textbox is the first of many I would like to populate.
LarsJ Posted June 10, 2021 Posted June 10, 2021 I think it's the Edit controls you fill out. Eg. the Edit controls in lines 162 and 170. Since there are only 6 Edit controls in your printout above, there are probably a maximum of 6 controls that you need to fill out. When you need to fill in a number of controls of the same type (here Edit controls) it's easiest to use a UI Automation element array. Then you can fill in the controls that need to be filled in and skip the rest. The example here (SampleCode2.au3) shows how to create and traverse a UI Automation element array. Study the example thoroughly and copy and adjust the code to suit your Edit controls. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now