LarsJ Posted February 16, 2023 Author Share Posted February 16, 2023 You will need to find out what type of automation is supported by your application. Classic (AutoIt) automation, MSAA automation (Inspect.exe, dropdown control in upper left corner) or UI Automation (Inspect.exe or UIASpy). For both MSAA and UI Automation code, the rule of thumb is that it's only possible to automate a task that can be performed manually by an end user. 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 Link to comment Share on other sites More sharing options...
mLipok Posted February 16, 2023 Share Posted February 16, 2023 I'm just looking for a small .NET application that is publicly available to make tests available to everyone. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
LarsJ Posted February 16, 2023 Author Share Posted February 16, 2023 You cannot know in advance which automation options will work. If you want to make something that is generally applicable, then you will need to make some small tests for all 3 options. But I have no immediate ideas about possible test applications. 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 Link to comment Share on other sites More sharing options...
mLipok Posted February 16, 2023 Share Posted February 16, 2023 (edited) Here is better repro: expandcollapse popup#AutoIt3Wrapper_UseX64=y #RequireAdmin ;~ https://www.autoitscript.com/forum/topic/197080-using-ui-automation-code-in-autoit/?do=findComment&comment=1513436 Global $_UIA_SMART_AUTOMATION, $_UIA_SMART_DESKTOP #include <GUIConstantsEx.au3> #include "z:\!!!_SVN_AU3\UDF_Forum\Other_Members\UIA_Constants.au3" Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("UIA HWND Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) _UIA_CreateProperty_issue_testing() ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK ExitLoop EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Func _UIA_CreateProperty_issue_testing() _Log("! WinWait('UIA HWND Example') = " & WinWait('UIA HWND Example')) _UIASimple_GetWindowByTitle('UIA HWND Example', '') EndFunc ;==>_UIA_CreateProperty_issue_testing Func _UIASimple_GetWindowByTitle($sTitle, $sText = '') #forceref $sText Local $sHWND = 0 ConsoleWrite("> " & @ScriptLineNumber & ' $sHWND=' & $sHWND &' $sTitle=' & $sTitle &' =' &' =' & '' &'' &@CRLF) Local $oUIA = _UIASimple_InitAutomation() Local $oDesktop = _UIASimple_GetDesktop() Local $pCondition1 $oUIA.CreatePropertyCondition($UIA_NamePropertyId, $sTitle, $pCondition1) ;~ $oUIA.CreatePropertyCondition($UIA_NativeWindowHandlePropertyId, $sHWND, $pCondition1) Local $s_Info = ' ::: Title=' & $sTitle & (($pCondition1) ? ('') : (" ::: $pCondition1 ERR ::: ")) _Log(@ScriptLineNumber & $s_Info) ;~ Local $s_Info = ' HWND = ' & $sHWND & ' ::: Title=' & $sTitle & (($pCondition1) ? ('') : (" ::: $pCondition1 ERR ::: ")) If Not $pCondition1 Then Return Local $pWindow $oDesktop.FindFirst($TreeScope_Descendants, $pCondition1, $pWindow) _Log(@ScriptLineNumber & " $pWindow= " & $pWindow) Local $oWindow = ObjCreateInterface($pWindow, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oWindow) Then Return _Log(@ScriptLineNumber & " $oWindow ERR - Title= " & $sTitle) _Log(@ScriptLineNumber & " $oWindow OK") Local $hWnd2 $hWnd2 = $oWindow.GetCurrentPropertyValue($UIA_NativeWindowHandlePropertyId, False) Local $s_Title2 = $oWindow.GetCurrentPropertyValue($UIA_NamePropertyId, True) ;~ $hWnd2 = $oWindow.GetCurrentPropertyValue($UIA_NativeWindowHandlePropertyId, False) _Log(@ScriptLineNumber & ' $hWnd2 = ' & $hWnd2 & ' $s_Title2 = ' & $s_Title2) Return $oWindow EndFunc ;==>_UIASimple_GetWindowByTitle Func _Log($sData, $iERR = @error, $iEXT = @extended) ConsoleWrite($sData & @CRLF) Return SetError($iERR, $iEXT) EndFunc ;==>_Log Func _UIASimple_InitAutomation() If IsObj($_UIA_SMART_AUTOMATION) Then Return $_UIA_SMART_AUTOMATION ; Create UI Automation object Local $oUIA = ObjCreateInterface($sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation) If Not IsObj($oUIA) Then Return _Log(@ScriptLineNumber & " $oUIA ERR") _Log(@ScriptLineNumber & " $oUIA OK") $_UIA_SMART_AUTOMATION = $oUIA Return $_UIA_SMART_AUTOMATION EndFunc ;==>_UIASimple_InitAutomation Func _UIASimple_GetDesktop() If IsObj($_UIA_SMART_DESKTOP) Then Return $_UIA_SMART_DESKTOP Local $oUIA = _UIASimple_InitAutomation() ; Get Desktop element Local $pDesktop $oUIA.GetRootElement($pDesktop) Local $oDesktop = ObjCreateInterface($pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oDesktop) Then Return _Log(@ScriptLineNumber & " $oDesktop ERR") _Log(@ScriptLineNumber & " $oDesktop OK") $_UIA_SMART_DESKTOP = $oDesktop Return $_UIA_SMART_DESKTOP EndFunc ;==>_UIASimple_GetDesktop Here is screenshot: As you can see UIASpy properly sees the $UIA_NativeWindowHandlePropertyId value. And my question related to this screenshot: Why I can not do the same (to get $UIA_NativeWindowHandlePropertyId value) with my repro code ? Edited February 16, 2023 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
InnI Posted February 16, 2023 Share Posted February 16, 2023 30 minutes ago, mLipok said: to get $UIA_NativeWindowHandlePropertyId value ;~ Local $hWnd2 ;~ $hWnd2 = $oWindow.GetCurrentPropertyValue($UIA_NativeWindowHandlePropertyId, False) ;~ Local $s_Title2 = $oWindow.GetCurrentPropertyValue($UIA_NamePropertyId, True) Local $hWnd2, $s_Title2 $oWindow.GetCurrentPropertyValue($UIA_NativeWindowHandlePropertyId, $hWnd2) $oWindow.GetCurrentPropertyValue($UIA_NamePropertyId, $s_Title2) mLipok 1 Link to comment Share on other sites More sharing options...
InnI Posted February 16, 2023 Share Posted February 16, 2023 (edited) AutoIt can find any top-level window. No need to search from desktop. Just use method ElementFromHandle. This method can be used for any controls that have a native handle (found by AutoIt). expandcollapse popup#AutoIt3Wrapper_UseX64=y Global $_UIA_SMART_AUTOMATION #include <GUIConstantsEx.au3> #include "UIA_Constants.au3" Example() Func Example() Local $hGUI = GUICreate("UIA HWND Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) GUISetState(@SW_SHOW, $hGUI) ; --------------------------------- ; main window $hWnd = WinWait("UIA HWND Example") _Log("! hWnd = " & $hWnd) $oWindow = _UIASimple_ElementFromHandle($hWnd) Local $hWnd2, $s_Title2 $oWindow.GetCurrentPropertyValue($UIA_NativeWindowHandlePropertyId, $hWnd2) $oWindow.GetCurrentPropertyValue($UIA_NamePropertyId, $s_Title2) _Log("! hWnd2 = 0x" & Hex($hWnd2) & ", $s_Title2 = " & $s_Title2) _Log("----------------") ; button OK $hCtrl = ControlGetHandle("UIA HWND Example", "", "Button1") _Log("! hCtrl = " & $hCtrl) $oBtn = _UIASimple_ElementFromHandle($hCtrl) Local $hCtrl2, $sText $oBtn.GetCurrentPropertyValue($UIA_NativeWindowHandlePropertyId, $hCtrl2) $oBtn.GetCurrentPropertyValue($UIA_NamePropertyId, $sText) _Log("! hCtrl2 = 0x" & Hex($hCtrl2) & ", $sText = " & $sText) ; --------------------------------- While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example Func _UIASimple_ElementFromHandle($hHandle) If Not IsHWnd($hHandle) Then Return SetError(1, 0, 0) Local $pElement, $oElement, $oUIA = _UIASimple_InitAutomation() $oUIA.ElementFromHandle($hHandle, $pElement) $oElement = ObjCreateInterface($pElement, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) $pElement = 0 If Not IsObj($oElement) Then Return SetError(2, 0, 0) Return $oElement EndFunc ;==>_UIASimple_ElementFromHandle Func _UIASimple_InitAutomation() If IsObj($_UIA_SMART_AUTOMATION) Then Return $_UIA_SMART_AUTOMATION Local $oUIA = ObjCreateInterface($sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation) If Not IsObj($oUIA) Then Return _Log(@ScriptLineNumber & " $oUIA ERR") $_UIA_SMART_AUTOMATION = $oUIA Return $_UIA_SMART_AUTOMATION EndFunc ;==>_UIASimple_InitAutomation Func _Log($sData, $iERR = @error, $iEXT = @extended) ConsoleWrite($sData & @CRLF) Return SetError($iERR, $iEXT) EndFunc ;==>_Log Edited February 16, 2023 by InnI mLipok 1 Link to comment Share on other sites More sharing options...
mLipok Posted February 16, 2023 Share Posted February 16, 2023 @InnI thanks for: Func _UIASimple_ElementFromHandle($hHandle) If Not IsHWnd($hHandle) Then Return SetError(1, 0, 0) Local $pElement, $oElement, $oUIA = _UIASimple_InitAutomation() $oUIA.ElementFromHandle($hHandle, $pElement) $oElement = ObjCreateInterface($pElement, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) $pElement = 0 If Not IsObj($oElement) Then Return SetError(2, 0, 0) Return $oElement EndFunc ;==>_UIASimple_ElementFromHandle And thanks to your suggestion about: Local $hWnd2, $s_Title2 $oWindow.GetCurrentPropertyValue($UIA_NativeWindowHandlePropertyId, $hWnd2) $oWindow.GetCurrentPropertyValue($UIA_NamePropertyId, $s_Title2) _Log(@ScriptLineNumber & ' $hWnd2 = ' & $hWnd2 & ' $s_Title2 = ' & $s_Title2) This directs me to solutions the main problem. Becuase I notice that: $oWindow.GetCurrentPropertyValue($UIA_NativeWindowHandlePropertyId, $hWnd2) returns value in DEC but: WinWait('UIA HWND Example') returns value in HEX So I'm working on finall solution. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
mLipok Posted February 16, 2023 Share Posted February 16, 2023 (edited) The final solution: expandcollapse popup#AutoIt3Wrapper_UseX64=y ;~ #AutoIt3Wrapper_UseX64=n #RequireAdmin ;~ https://www.autoitscript.com/forum/topic/197080-using-ui-automation-code-in-autoit/?do=findComment&comment=1513436 Global $_UIA_SMART_AUTOMATION, $_UIA_SMART_DESKTOP #include <AutoItConstants.au3> #include <GUIConstantsEx.au3> #include "z:\!!!_SVN_AU3\UDF_Forum\Other_Members\UIA_Constants.au3" Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("UIA HWND Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) _UIA_CreateProperty_issue_testing() ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK ExitLoop EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Func _UIA_CreateProperty_issue_testing() Local $hWND_HEX = WinWait('UIA HWND Example') Local $hWND_DEC = Dec(StringTrimLeft($hWND_HEX, 2), $NUMBER_32BIT) _Log("! WinWait('UIA HWND Example') = " & $hWND_HEX) _Log("! WinWait('UIA HWND Example') = " & $hWND_DEC) ConsoleWrite("- FIRST TEST - Title" & @CRLF) _UIASimple_GetWindowByTitle('UIA HWND Example', '') ConsoleWrite("- SECOND TEST - HWND" & @CRLF) _UIASimple_GetWindowByTitle($hWND_HEX, '') ConsoleWrite("- THIRD TEST - HWND" & @CRLF) _UIASimple_ElementFromHandle($hWND_HEX) ConsoleWrite("- TEST END" & @CRLF) EndFunc ;==>_UIA_CreateProperty_issue_testing Func _UIASimple_GetWindowByTitle($sTitle, $sText = '') #forceref $sText ; Not supported yet Local $hWND_HEX = 0 Local $hWND_DEC = 0 If IsHWnd($sTitle) Then $hWND_HEX = $sTitle $hWND_DEC = Dec(StringTrimLeft($hWND_HEX, 2), $NUMBER_32BIT) $sTitle = WinGetTitle($sTitle) EndIf Local $oUIA = _UIASimple_InitAutomation() Local $oDesktop = _UIASimple_GetDesktop() Local $pCondition1 If $hWND_DEC Then _Log(@ScriptLineNumber & ' VargetType($hWND_DEC) = ' & VarGetType($hWND_DEC)) $oUIA.CreatePropertyCondition($UIA_NativeWindowHandlePropertyId, $hWND_DEC, $pCondition1) Else $oUIA.CreatePropertyCondition($UIA_NamePropertyId, $sTitle, $pCondition1) EndIf Local $s_Info = ' ::: $hWND_DEC=' & $hWND_DEC & ' ::: Title=' & $sTitle & (($pCondition1) ? ('') : (" ::: $pCondition1 ERR ::: ")) _Log(@ScriptLineNumber & $s_Info) If Not $pCondition1 Then Return Local $pWindow $oDesktop.FindFirst($TreeScope_Descendants, $pCondition1, $pWindow) _Log(@ScriptLineNumber & " $pWindow= " & $pWindow) Local $oWindow = ObjCreateInterface($pWindow, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oWindow) Then Return _Log(@ScriptLineNumber & " $oWindow ERR - Title= " & $sTitle) _Log(@ScriptLineNumber & " $oWindow OK") Local $hWnd_Native, $s_Title_FromUIA $oWindow.GetCurrentPropertyValue($UIA_NativeWindowHandlePropertyId, $hWnd_Native) $oWindow.GetCurrentPropertyValue($UIA_NamePropertyId, $s_Title_FromUIA) _Log(@ScriptLineNumber & ' $hWnd_Native = ' & $hWnd_Native & ' $s_Title_FromUIA = ' & $s_Title_FromUIA) _Log(@ScriptLineNumber & ' VargetType($hWnd_Native) = ' & VarGetType($hWnd_Native)) Return $oWindow EndFunc ;==>_UIASimple_GetWindowByTitle Func _UIASimple_InitAutomation() If IsObj($_UIA_SMART_AUTOMATION) Then Return $_UIA_SMART_AUTOMATION ; Create UI Automation object Local $oUIA = ObjCreateInterface($sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation) If Not IsObj($oUIA) Then Return _Log(@ScriptLineNumber & " $oUIA ERR") _Log(@ScriptLineNumber & " $oUIA OK") $_UIA_SMART_AUTOMATION = $oUIA Return $_UIA_SMART_AUTOMATION EndFunc ;==>_UIASimple_InitAutomation Func _UIASimple_GetDesktop() If IsObj($_UIA_SMART_DESKTOP) Then Return $_UIA_SMART_DESKTOP Local $oUIA = _UIASimple_InitAutomation() ; Get Desktop element Local $pDesktop $oUIA.GetRootElement($pDesktop) Local $oDesktop = ObjCreateInterface($pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oDesktop) Then Return _Log(@ScriptLineNumber & " $oDesktop ERR") _Log(@ScriptLineNumber & " $oDesktop OK") $_UIA_SMART_DESKTOP = $oDesktop Return $_UIA_SMART_DESKTOP EndFunc ;==>_UIASimple_GetDesktop ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UIASimple_ElementFromHandle ; Description ...: ; Syntax ........: _UIASimple_ElementFromHandle($hHandle) ; Parameters ....: $hHandle - a handle value. ; Return values .: None ; Author ........: InnI ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UIASimple_ElementFromHandle($hHandle) If Not IsHWnd($hHandle) Then Return SetError(1, 0, 0) Local $pElement, $oElement, $oUIA = _UIASimple_InitAutomation() $oUIA.ElementFromHandle($hHandle, $pElement) $oElement = ObjCreateInterface($pElement, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) $pElement = 0 If Not IsObj($oElement) Then Return SetError(2, 0, 0) Local $hWnd_Native, $s_Title_FromUIA $oElement.GetCurrentPropertyValue($UIA_NativeWindowHandlePropertyId, $hWnd_Native) $oElement.GetCurrentPropertyValue($UIA_NamePropertyId, $s_Title_FromUIA) _Log(@ScriptLineNumber & ' $oElement OK ::: $hWnd_Native = ' & $hWnd_Native & ' $s_Title_FromUIA = ' & $s_Title_FromUIA) Return $oElement EndFunc ;==>_UIASimple_ElementFromHandle Func _Log($sData, $iERR = @error, $iEXT = @extended) ConsoleWrite($sData & @CRLF) Return SetError($iERR, $iEXT) EndFunc ;==>_Log btw. take a note that $oWindow.GetCurrentPropertyValue($UIA_NativeWindowHandlePropertyId, $hWnd2) returns a value in DEC, it seems to always be a 32 bit DEC value but: WinWait('UIA HWND Example') returns value in HEX with bitness corelated to: #AutoIt3Wrapper_UseX64=y ;~ #AutoIt3Wrapper_UseX64=n Edit 1: Thus this following line was needed: Local $hWND_DEC = Dec(StringTrimLeft($hWND_HEX, 2), $NUMBER_32BIT) Edit 2: Results: Quote ! WinWait('UIA HWND Example') = 0x0000000000320BFA ! WinWait('UIA HWND Example') = 3279866- FIRST TEST - Title 107 $oUIA OK 122 $oDesktop OK 81 ::: $hWND_DEC=0 ::: Title=UIA HWND Example 87 $pWindow= 1742066804512 90 $oWindow OK 95 $hWnd_Native = 3279866 $s_Title_FromUIA = UIA HWND Example 96 VargetType($hWnd_Native) = Int32- SECOND TEST - HWND 74 VargetType($hWND_DEC) = Int32 81 ::: $hWND_DEC=3279866 ::: Title=UIA HWND Example 87 $pWindow= 1742066804512 90 $oWindow OK 95 $hWnd_Native = 3279866 $s_Title_FromUIA = UIA HWND Example 96 VargetType($hWnd_Native) = Int32- THIRD TEST - HWND 152 $oElement OK ::: $hWnd_Native = 3279866 $s_Title_FromUIA = UIA HWND Example- TEST END Edited February 16, 2023 by mLipok edit 1 , 2 + typos Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
mLipok Posted February 16, 2023 Share Posted February 16, 2023 @LarsJ What you think about to change UIASpy to show $UIA_NativeWindowHandlePropertyId value in correct bitness and togther HEX + DEC ? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
InnI Posted February 16, 2023 Share Posted February 16, 2023 22 minutes ago, mLipok said: Thus this following line was needed HEX and DEC are just a representation of a number. Their values are the same. Link to comment Share on other sites More sharing options...
mLipok Posted February 16, 2023 Share Posted February 16, 2023 (edited) 6 minutes ago, InnI said: HEX and DEC are just a representation of a number. Their values are the same. so Instead: Local $hWND_DEC = Dec(StringTrimLeft($hWND_HEX, 2), $NUMBER_32BIT) try to use: Local $hWND_DEC = Dec(StringTrimLeft($hWND_HEX, 2)) and switch between: #AutoIt3Wrapper_UseX64=y ;~ #AutoIt3Wrapper_UseX64=n What results you get ? EDIT: oops I mean try here: If IsHWnd($sTitle) Then $hWND_HEX = $sTitle $hWND_DEC = Dec(StringTrimLeft($hWND_HEX, 2), $NUMBER_32BIT) $sTitle = WinGetTitle($sTitle) EndIf to change to: If IsHWnd($sTitle) Then $hWND_HEX = $sTitle $hWND_DEC = Dec(StringTrimLeft($hWND_HEX, 2)) $sTitle = WinGetTitle($sTitle) EndIf Edited February 16, 2023 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
InnI Posted February 16, 2023 Share Posted February 16, 2023 1 hour ago, mLipok said: it seems to always be a 32 bit Looks like you're right. https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-automation-element-propids UIA_NativeWindowHandlePropertyId 30020 Identifies the NativeWindowHandle property, which is an integer that represents the handle (HWND) of the automation element window, if it exists; otherwise, this property is 0. Variant type: VT_I4 Default value: 0 And... ; Return values .: UIA Element (object) ; Author ........: InnI ; Modified ......: mLipok 😉 Link to comment Share on other sites More sharing options...
demon964 Posted April 2 Share Posted April 2 Hi. I need add email and password to this textbox, but cant find Autoit window info Link to comment Share on other sites More sharing options...
demon964 Posted April 2 Share Posted April 2 hi, how i can use IUIAutomation for login microsoft store? or simple paste text to microsoft store textbox Link to comment Share on other sites More sharing options...
Danyfirex Posted April 2 Share Posted April 2 @demon964 You can do it like this: expandcollapse popup#include "UIA_Constants.au3" _Test() Func _Test() ; --- Find window/control --- ConsoleWrite("--- Find window/control ---" & @CRLF) ; 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) Local $pCondition1 $oUIAutomation.CreatePropertyCondition($UIA_ClassNamePropertyId, "ApplicationFrameWindow", $pCondition1) If Not $pCondition1 Then Return ConsoleWrite("$pCondition1 ERR" & @CRLF) ConsoleWrite("$pCondition1 OK" & @CRLF) Local $pWindow1, $oWindow1 $oDesktop.FindFirst($TreeScope_Children, $pCondition1, $pWindow1) $oWindow1 = ObjCreateInterface($pWindow1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oWindow1) Then Return ConsoleWrite("$oWindow1 ERR" & @CRLF) ConsoleWrite("$oWindow1 OK" & @CRLF) Local $pCondition0 $oUIAutomation.CreatePropertyCondition($UIA_NamePropertyId, "Enter your email, phone, or Skype.", $pCondition0) ;change this for your Russian Edit Text If Not $pCondition0 Then Return ConsoleWrite("$pCondition0 ERR" & @CRLF) ConsoleWrite("$pCondition0 OK" & @CRLF) Local $pEdit1, $oEdit1 $oWindow1.FindFirst($TreeScope_Descendants, $pCondition0, $pEdit1) $oEdit1 = ObjCreateInterface($pEdit1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oEdit1) Then Return ConsoleWrite("$oEdit1 ERR" & @CRLF) ConsoleWrite("$oEdit1 OK" & @CRLF) Local $pLegacyIAccessiblePattern1, $oLegacyIAccessiblePattern1 $oEdit1 .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) Local $iStr = "Danyfirex@autoit.com" $oLegacyIAccessiblePattern1.SetValue($iStr) EndFunc ;==>_Test Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
demon964 Posted April 2 Share Posted April 2 @Danyfirex you compiled code? automatically added your mail adress to microsoft store? mine not worked Link to comment Share on other sites More sharing options...
Danyfirex Posted April 2 Share Posted April 2 that's the first step just add the email you need to do/add some code to full log in. I only teach you how to catch the fish, but if you only want the fish you have to pay for it. 😅 Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 2 Moderators Share Posted April 2 demon964, You already have one thread helping you on this, so why post in another? Let us stick to this one. M23 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 Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted April 2 Share Posted April 2 Hi @demon964 , do you plan to automated more then the login (account confirmation)? In case it's only this window/popup/modal, you could save your time by simply find the window focus the window navigate through TABs send your text (inputs) use SPACE or ENTER to confirm the button(s) .. done. Of course this wouldn't be a nice approach, but maybe a simple one in case nothing more is to do 🤔 ?! Best regards Sven Stay innovative! Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
jchd Posted April 12 Share Posted April 12 This is the first time I actually need to use UI Automation, but I can't reach any climax. This is the UIASpy of the Firefox window I need to enter text in several Edit controls. My code so far: expandcollapse popup#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\UIA_Constants.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_SafeArray.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Variant.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, $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 --- ConsoleWrite("--- Find window ---" & @CRLF) Local $pCondition $oUIAutomation.CreatePropertyCondition($UIA_NamePropertyId, "Votre colis - Colissimo en ligne - Boutique La Poste pour les professionnels — Mozilla Firefox", $pCondition) If Not $pCondition Then Return ConsoleWrite("$pCondition ERR" & @CRLF) ConsoleWrite("$pCondition OK" & @CRLF) Local $pWindow, $oWindow $oDesktop.FindFirst($TreeScope_Children, $pCondition, $pWindow) $oWindow = ObjCreateInterface($pWindow, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oWindow) Then Return ConsoleWrite("$oWindow ERR" & @CRLF) ConsoleWrite("$oWindow OK" & @CRLF) ; --- Find document --- ConsoleWrite("--- Find document ---" & @CRLF) $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_DocumentControlTypeId, $pCondition) If Not $pCondition Then Return ConsoleWrite("$pCondition ERR" & @CRLF) ConsoleWrite("$pCondition OK" & @CRLF) Local $pDocument, $oDocument $oWindow.FindFirst($TreeScope_Descendants, $pCondition, $pDocument) $oDocument = ObjCreateInterface($pDocument, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oDocument) Then Return ConsoleWrite("$oDocument ERR" & @CRLF) ConsoleWrite("$oDocument OK" & @CRLF) ConsoleWrite("--- Find control ---" & @CRLF) $oUIAutomation.CreatePropertyCondition($UIA_AutomationIdPropertyId, "addressFormDestPart.lastName", $pCondition) If Not $pCondition Then Return ConsoleWrite("$pCondition ERR" & @CRLF) ConsoleWrite("$pCondition OK" & @CRLF) Local $pEdit, $oEdit $oDocument.FindFirst($TreeScope_Descendants, $pCondition, $pEdit) $oEdit = ObjCreateInterface($pEdit, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oEdit) Then Return ConsoleWrite("$oEdit ERR" & @CRLF) ConsoleWrite("$oEdit OK" & @CRLF) ; --- Value Pattern (action) Object --- ConsoleWrite("--- Value Pattern (action) Object ---" & @CRLF) Local $pValuePattern, $oValuePattern $oEdit.GetCurrentPattern($UIA_ValuePatternId, $pValuePattern) $oValuePattern = ObjCreateInterface($pValuePattern, $sIID_IUIAutomationValuePattern, $dtag_IUIAutomationValuePattern) If Not IsObj($oValuePattern) Then Return ConsoleWrite("$oValuePattern ERR" & @CRLF) ConsoleWrite("$oValuePattern OK" & @CRLF) $oValuePattern.SetValue("AutoIt rules") EndFunc ;==>Example The console output shows that I can reach the green underlined window, document, but I can't get to the Edit control: $oUIAutomation OK $oDesktop OK --- Find window --- $pCondition OK $oWindow OK --- Find document --- $pCondition OK $oDocument OK --- Find control --- $pCondition OK $oEdit ERR I've tried to add a (possibly pointless) step to access the Document control, as in the code, but the result is the same. Is there a limit to the maximum supported depth between a window (or here a document) and the targeted Edit? I notice there are a large number of Group controls in between. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
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