Earthshine Posted November 5, 2018 Share Posted November 5, 2018 i would at least try putting double quotes around the string you are searching for.... I am looking at that function, hopefully @junkew will have the definitive answer. My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Earthshine Posted November 5, 2018 Share Posted November 5, 2018 (edited) 38 minutes ago, Iulia_Vascan said: 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? #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_TreeControlTypeId;class:=") ; ;~ $oUIElement=_UIA_getObjectByFindAll("Windingn.1Q=242p=4m=3.mainwindow", "title:=Winding n. 1 Q = 24 2p = 4 m = 3;ControlType:=UIA_TreeItemControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=Winding n. 1 Q = 24 2p = 4 m = 3;controltype:=UIA_TreeItemControlTypeId;class:=") ;ControlType:=UIA_TreeItemControlTypeId;classname:=") _UIA_action("oUIElement","highlight") _UIA_action("oUIElement","click") so I just used the wizard to create an example, but this worked for me. just type out the name, you may have to create the name using the user input however, I am not sure how you are getting the name. In my case it's Winding n. 1 Q = 24 2p = 4 m = 3 you could build that string with the collected data from the user is what I was trying to say. also, you can double click if by doing this _UIA_action("oUIElement","doubleclick") that easy, works here on my system. let me know if you need more assistance. at this point it is based off number of phases (m=3) Number of slots (Q=24) and the winding number, which is just increaing. Look at the string functions to build strings for use with the IUI kit you should be able to get those values easily Edited November 5, 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...
junkew Posted November 5, 2018 Share Posted November 5, 2018 Solution 1 = regular expression _UIA_setVar("oUIElement","Title:=> Winding.*;controltype:=UIA_ButtonControlType") Soluition 1b use regex plus index property if it recognizes multiple elements Solution 2 use indexrelative which you can use to go n elements further or with -n elements before another known element thats more static in property identification. Solution 3 use string functions to construct your string to recognize. Solution 4 see if the button has an automationid thats static. I doubt as i see its a qtwidget. 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...
Iulia_Vascan Posted November 6, 2018 Author Share Posted November 6, 2018 @junkew Thank you very much! It's working with the first solution : _UIA_setVar("oUIElement","Title:= Winding n. .*;controltype:=UIA_ButtonControlType") Link to comment Share on other sites More sharing options...
Iulia_Vascan Posted November 6, 2018 Author Share Posted November 6, 2018 @junkew Is it possible to hide all my process of automation in the background, so the user don't see all the steps that the script does ? I found in the macro reference @SH_HIDE which hides the window. Run("C:\Users\UTCN-MAE\Desktop\M_2\dolomites-release-python\Dolomites.exe", @SH_HIDE) The window is hidden but the code is no longer working. Is is because this function (_UIA_Action) needs to have the window of the GUI on the screen? Because I saw that if the window is hidden the code is searching on my screen after the buttons. expandcollapse popup;~ *** Standard code maintainable *** Run("C:\Users\UTCN-MAE\Desktop\M_2\dolomites-release-python\Dolomites.exe") WinWaitActive("[CLASS:Dolomites]", "", 1) #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("Add mainwindow", "title:=Add;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=Add;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") ;~ $oUIElement=_UIA_getObjectByFindAll("Add mainwindow", "title:=Add;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:= Winding n. .*;controltype:=UIA_ButtonControlType") ;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") ;~ $oUIElement=_UIA_getObjectByFindAll("Add mainwindow", "title:=Add;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=GetDP circuit;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") WinWaitActive("[CLASS:Dolomites]", "", 1) ControlFocus("Save GetDP circuit", "", "Edit1") ControlSetText("Save GetDP circuit", "", "Edit1", "C:\Users\UTCN-MAE\Desktop\M_2\Windings\winding.txt",@SW_HIDE) ControlClick("Save GetDP circuit", "","Button2") WinWaitActive("[CLASS:Dolomites]", "", 1) If ProcessExists("Dolomites.exe") Then ProcessClose("Dolomites.exe") EndIf Run("C:\Users\UTCN-MAE\Desktop\M_2\onelab-Windows64\gmsh.exe") WinWaitActive("[CLASS:FLTK]", "", 1) Link to comment Share on other sites More sharing options...
Earthshine Posted November 6, 2018 Share Posted November 6, 2018 you know you don't have to do all those extra setfocus 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 6, 2018 Share Posted November 6, 2018 No ui stands for user interface as soon as you hide it ts not availabe for x y coordinates etc. The whole concept is around userinteraction. You could hide it when you run a virtual machine or maybe virtual displaydrivers but that are in general complexer solutions. 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...
FrancescoDiMuro Posted November 6, 2018 Share Posted November 6, 2018 (edited) @Iulia_Vascan If you want to do all those steps without using UI Automation UDF, you could use the built-in scripting library of Dolomites, through which you can do whatever you want ( even interact with the user combining AutoIt and Python ), as I have already suggested you in PM It is well documented, and it allows you to do whatever you do through UI, and even more. That should be even better than automating the UI Edited November 6, 2018 by FrancescoDiMuro 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 6, 2018 Share Posted November 6, 2018 yeah, that is handy too, but since OP didn't ask about it, I never thought of it, but that is way cool FrancescoDiMuro 1 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Ghoul2020 Posted February 2, 2020 Share Posted February 2, 2020 On 10/30/2018 at 3:56 PM, Earthshine said: i know because that's how windows works. it takes time for an app that has just launched to be ready. the other theory is that they are not windows controls and he won't be able to click them using autoit anyway. " the other theory is that they are not windows controls "??🙄🙄🤦🏻♂️...if they are not "WINDOWS CONTROLS"..then what do you call them? 🤐 all i can see here is " only words with no sense "...they say "The worst wheel of the cart makes the most noise."😏 Musashi and Earthshine 2 Link to comment Share on other sites More sharing options...
Earthshine Posted February 2, 2020 Share Posted February 2, 2020 (edited) edited Edited February 2, 2020 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Developers Jos Posted February 2, 2020 Developers Share Posted February 2, 2020 (edited) Guys could you take this somewhere else and @Ghoul2020, why on earth so you bother us with your shit? Just don't post when you can handle somebody strong king back at you after you lash out. Jos Edited February 2, 2020 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Ghoul2020 Posted February 3, 2020 Share Posted February 3, 2020 4 hours ago, Jos said: Guys could you take this somewhere else and @Ghoul2020, why on earth so you bother us with your shit? Just don't post when you can handle somebody strong king back at you after you lash out. Jos Listen KID😄 ..I don't know if you understand this ..BUT.. I have a hard time arguing with STUPID people...I feel like I've lost so many amazing traits because I've listened to stupid people, ignorant people who are bullies.They should have to wear signs that just say, 'I'm STUPID.'...🖕🏻 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 3, 2020 Moderators Share Posted February 3, 2020 Ghoul2020, We try to keep these forums a civilised place and so reactions like yours above do not sit nicely here. Furthermore replying as you did to a member of the Moderation team is extremely unwise. I have locked the thread but, because of your newness here I will limit my actions to just that. Consider yourself very lucky and change your attitude in any future posts as you have now used up any flex we were prepared to show you. Any further transgressions will lead to your immediate removal from the community. Your choice - please choose wisely. 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...
Developers Jos Posted February 3, 2020 Developers Share Posted February 3, 2020 5 hours ago, Ghoul2020 said: Listen KID😄 ..I don't know if you understand this ..BUT.. mmmm KID? You have received a final warning to either clean up your act here or you will be shipped out permanently. 😒 Jos Earthshine 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts