caramen Posted October 31, 2018 Share Posted October 31, 2018 13 minutes ago, Earthshine said: That Dolomites program is pretty cool actually. Pm information requested since i noticed the pole button ? PM me what is this soft usage ? Iulia_Vascan 1 My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Earthshine Posted October 31, 2018 Share Posted October 31, 2018 26 minutes ago, caramen said: Pm information requested since i noticed the pole button ? PM me what is this soft usage ? https://sourceforge.net/projects/dolomites/ an application suite for the design of electrical machine and drives get it here. My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
junkew Posted October 31, 2018 Share Posted October 31, 2018 Good to see positive results on qt widgets with iuia. Probably build with latest versions of qt with accessiability turned on. @Earthshine nice example Earthshine 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Earthshine Posted October 31, 2018 Share Posted October 31, 2018 (edited) thanks, but I used your Simplespy to generate the example, so, back at ya @junkew Edited October 31, 2018 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Earthshine Posted October 31, 2018 Share Posted October 31, 2018 (edited) On 10/30/2018 at 6:07 AM, Iulia_Vascan said: Hello, I am new to AutoIT, I am trying to automate the push of two buttons in a GUI. The first one is presented in a1.png ("Add" - Button), the second one in a2.png ("GetDP circuit" - Button). This is my code: Run("E:\Iulia_Vascan\dolomites-release-python\Dolomites.exe") ControlClick("Dolomites","", controlID [, button = "left" [, clicks = 1 [, 217 [, 298]]]] ) ControlClick("Dolomites","", controlID [, button = "left" [, clicks = 1 [, 307 [, 59]]]] ) ControlFocus("Save GetDP circuit", "", "Edit1") ControlSetText("Save GetDP circuit", "", "Edit1", "E:\Iulia_Vascan\Metoda_2\winding.pro") ControlClick("Save GetDP circuit", "","Button2") I write the ControlClick function as is presented in the Help - Function Reference, but it didn't work and I can't figure out why. Thank you! the add button is very similar as captured by simplespy.au3, here both buttons are clicked, but you must select a windings first for the second button to do anything. right now, it just presses Add and then Export GetDP ;~ *** Standard code maintainable *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oUIElementAdd","Title:=Add;controltype:=UIA_ButtonControlTypeId;class:=") _UIA_action("oUIElementAdd","highlight") _UIA_action("oUIElementAdd","click") _UIA_setVar("oUIElementGet","Title:=Export GetDP circuit;controltype:=UIA_ButtonControlTypeId;class:=") _UIA_action("oUIElementGet","highlight") _UIA_action("oUIElementGet","click") Edited November 1, 2018 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Iulia_Vascan Posted November 1, 2018 Author Share Posted November 1, 2018 @Earthshine Hi again, I tried to run your script, and every time I run it, I get this error. I found some explanation on this forum, but it's not working.. the problem it will be the "_" underscore, I delete them but still not working... ">"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "E:\Iulia_Vascan\Metoda_2\au3_uiautomation-master\simple_2.au3" "E:\Iulia_Vascan\Metoda_2\au3_uiautomation-master\simple_2.au3" (5) : ==> Unknown function name.: _UIA_setVar("oUIElementAdd","Title:=Add;controltype:=UIA_ButtonControlTypeId;class:=") ^ ERROR >Exit code: 1 Time: 0.1101" expandcollapse popup;~ *** Standard code maintainable *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oP1","Title:=Dolomites;controltype:=UIA_WindowControlTypeId;class:=Qt5QWindowIcon") ;Dolomites _UIA_setVar("oP2","Title:=;controltype:=UIA_CustomControlTypeId;class:=") ; _UIA_setVar("oP3","Title:=;controltype:=UIA_SplitButtonControlTypeId;class:=") ; _UIA_setVar("oP4","Title:=;controltype:=UIA_CustomControlTypeId;class:=") ; _UIA_setVar("oP5","Title:=;controltype:=UIA_CustomControlTypeId;class:=") ; _UIA_setVar("oP6","Title:=;controltype:=UIA_SplitButtonControlTypeId;class:=") ; _UIA_setVar("oP7","Title:=;controltype:=UIA_SplitButtonControlTypeId;class:=") ; _UIA_setVar("oP8","Title:=;controltype:=UIA_CustomControlTypeId;class:=") ; ;~ $oUIElement=_UIA_getObjectByFindAll("Wizard....mainwindow", "title:=Wizard...;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=Wizard...;controltype:=UIA_ButtonControlTypeId;class:=") ;ControlType:=UIA_ButtonControlTypeId;classname:=") ;~ Actions split away from logical/technical definition above can come from configfiles ;~_UIA_Action("oP1","highlight") _UIA_Action("oP1","setfocus") ;~_UIA_Action("oP2","highlight") _UIA_Action("oP2","setfocus") ;~_UIA_Action("oP3","highlight") _UIA_Action("oP3","setfocus") ;~_UIA_Action("oP4","highlight") _UIA_Action("oP4","setfocus") ;~_UIA_Action("oP5","highlight") _UIA_Action("oP5","setfocus") ;~_UIA_Action("oP6","highlight") _UIA_Action("oP6","setfocus") ;~_UIA_Action("oP7","highlight") _UIA_Action("oP7","setfocus") ;~_UIA_Action("oP8","highlight") _UIA_Action("oP8","setfocus") _UIA_action("oUIElement","highlight") _UIA_action("oUIElement","click") Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted November 1, 2018 Share Posted November 1, 2018 @Iulia_Vascan If you click on the file of the include ( .au3 ), and then press Ctrl + I, you'll open the include file, in which you should find _UIA_setVar() function. Maybe it is called in another way, or maybe you have to include another "library" Iulia_Vascan 1 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Earthshine Posted November 1, 2018 Share Posted November 1, 2018 Uiawrapper should be in same directory yiur script runs from Iulia_Vascan 1 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
junkew Posted November 1, 2018 Share Posted November 1, 2018 Read this carefully to see how to change your registry so that your uiwrappers.au3 does not have to be in same folder as your script https://www.autoitscript.com/autoit3/docs/keywords/include.htm simplespy generates generic identification so if you have empty on properties Title:=;controltype:=UIA_CustomControlTypeId;class:= you can change it to controltype:=UIA_CustomControlTypeId which will only work if there is one control or its the first on this level Iulia_Vascan 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Nine Posted November 1, 2018 Share Posted November 1, 2018 (edited) Or you could try a simpler form of mouse clicks : Opt ("PixelCoordMode", 0) Opt ("MouseCoordMode", 0) Opt ("MustDeclareVars", 1) Run("E:\Iulia_Vascan\dolomites-release-python\Dolomites.exe") WinWaitActive ("Dolomites") MouseClick ("left",215,298,1,5) ; add buton Sleep (250) MouseClick ("left",307,59,1,5) ; get dp button Sleep (250) .... Edited November 1, 2018 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Earthshine Posted November 1, 2018 Share Posted November 1, 2018 (edited) what if dolomites runs somewhere else on the screen? this is more reliable that that stuff. user can change the size and location of the window and it would still work if those controls could be gotten to. Edited November 1, 2018 by Earthshine Iulia_Vascan 1 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Nine Posted November 1, 2018 Share Posted November 1, 2018 17 minutes ago, Earthshine said: what if dolomites runs somewhere else on the screen? this is more reliable that that stuff. user can change the size and location of the window and it would still work if those controls could be gotten to. Opt ("PixelCoordMode", 0) Opt ("MouseCoordMode", 0) That solves the problem ! MouseClick is then relative the current active window. No matter where the window is located it will work unless the button changes place :s “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Earthshine Posted November 1, 2018 Share Posted November 1, 2018 sometimes they do as it gets stretched around. My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Nine Posted November 1, 2018 Share Posted November 1, 2018 8 minutes ago, Earthshine said: sometimes they do as it gets stretched around. if necessary you can always force location and size with winmove ... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted November 1, 2018 Share Posted November 1, 2018 @Nine You're right, but think that the dynamics that the script has with UI Automation will never be like mouse clicks Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Nine Posted November 1, 2018 Share Posted November 1, 2018 (edited) 2 hours ago, FrancescoDiMuro said: You're right, but think that the dynamics that the script has with UI Automation will never be like mouse clicks I prefer a 6 lines of code that works that 100 lines that doesn't work It is easy to fall into a dogmatic approach, it is harder to get out... Edited November 1, 2018 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Earthshine Posted November 2, 2018 Share Posted November 2, 2018 (edited) This isn’t about you or what you prefer though. Start your own threads. Have you even tested your code? everthing i posted works reliable. You spout nonsense Edited November 2, 2018 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
junkew Posted November 2, 2018 Share Posted November 2, 2018 Be aware uiawrappers can go from simple to complex for hundreds of screens in a more maintainable way to even splitting your recognition strings in a separate config file. For a few buttons you could use x y mouseclick but if your app redesigns the ui you have a lot of work when it are dozens of mouseclicks. With mouseclick you do the job of finding x y. With recognition strings the computer does the job of finding x y either controlclick or uia or other udf. Earthshine 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Earthshine Posted November 2, 2018 Share Posted November 2, 2018 (edited) Thank you for that. I’m not going to try to convince him. Let them find out with experience like I had to Edited November 2, 2018 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Iulia_Vascan Posted November 5, 2018 Author Share Posted November 5, 2018 Hi again, I automated those two buttons, but now I have a problem with another one which is more complicated, because its name depends on the user input. More precise here in Dolomites software, the user inserts some input variables (Q=var1=? , 2p=var2=? and m=var3=?), then with AutoIT the Add button is pushed, after that the winding is generated with the name "Winding n. 1 Q= var1 2p= var2 m= var3" and I have to select this button (picture below). I can add this button in the script as the Add button, but here is the problem... The script doesn't know what variables the user will insert. So I have to push the button "Winding n. 1 Q= ? 2p= ? m= ?". Is a posibility that AutoIT to identify this button if it knows just a part of name's button? I tried just with "Winding n. 1 Q= 2p= m= " but it doesn't recognize the button and it stops. _UIA_setVar("oUIElement","Title:=> Winding n. 1 Q= 2p= m=;controltype:=UIA_ButtonControlTypeId;class:=") How can I automate the push of this button if the name depends on what the user will insert? Link to comment Share on other sites More sharing options...
Recommended Posts