Nyl- Posted March 2, 2021 Posted March 2, 2021 (edited) test() test1() Func test() ControlClick("Spare Parts","","[CLASS:WindowsForms10.Window.8.app.0.73673b_r6_ad1; INSTANCE:80]","left",1,200, 87) ;clicks initial item ConsoleWrite("1") ControlClick("Spare Parts","","[CLASS:WindowsForms10.Window.8.app.0.73673b_r6_ad1; INSTANCE:88]","left",1,278, 80) ;clicks update inventory ConsoleWrite("2") EndFunc Func test1() WinWait("[TITLE:New Material Transaction Wizard : Spare Parts; CLASS:WindowsForms10.Window.8.app.0.73673b_r6_ad1]") ;waits for the new form to appear ConsoleWrite("3") ControlClick("New Material Transaction Wizard : Spare Parts","","[CLASS:WindowsForms10.BUTTON.app.0.73673b_r6_ad1; INSTANCE:12]","left",1, 40, 11) ;clicks next ConsoleWrite("4") WinWait("[TITLE:New Material Transaction Wizard : Spare Parts; CLASS:WindowsForms10.Window.8.app.0.73673b_r6_ad1]") ;waits for the next tab to appear ConsoleWrite("5") ControlClick("New Material Transaction Wizard : Spare Parts","","[CLASS:WindowsForms10.BUTTON.app.0.73673b_r6_ad1; INSTANCE:3]","left",1,11, 11) ;clicks a button and a new form will appear ConsoleWrite("6") WinWait("[TITLE:Lookup - Location selection; CLASS:WindowsForms10.Window.8.app.0.73673b_r6_ad1]") ;waits for the new form to appear ConsoleWrite("7") ControlClick("Lookup - Location selection","","[CLASS:WindowsForms10.BUTTON.app.0.73673b_r6_ad1; INSTANCE:2]","left",1,48, 19) ;clicks on in the new form ConsoleWrite("8") ControlClick("New Material Transaction Wizard : Spare Parts","","[CLASS:WindowsForms10.COMBOBOX.app.0.73673b_r6_ad1; INSTANCE:3]","left",1,48, 13) ;clicks the combobox ConsoleWrite("9") ControlSend("New Material Transaction Wizard : Spare Parts","","[CLASS:WindowsForms10.COMBOBOX.app.0.73673b_r6_ad1; INSTANCE:3]","{down}{enter}") ;picks the 2nd option in the combobox ConsoleWrite("10") ControlSend("New Material Transaction Wizard : Spare Parts","","[CLASS:WindowsForms10.EDIT.app.0.73673b_r6_ad1; INSTANCE:14]",Round(random(0.5,1.8),0)&"{left}{del}") ;input 1 or 2 in the edit ConsoleWrite("11") EndFunc When I use this script, it stops on "6"(I know that it is waiting for the new form to appear) but the problem is that it did not click the button which was supposed to open the new form and the actual program is stuck after the test() func. But when I only use test1() func only and manually click the update inventory, everything works perfectly. Edited March 2, 2021 by Nyl-
Nyl- Posted March 2, 2021 Author Posted March 2, 2021 Sorry for this post. Problem was solved using WinActivate prior to the first ControlClick from text1(). Thanks to this link. [SOLVED] Problem with ControlClick - AutoIt General Help and Support - AutoIt Forums (autoitscript.com)
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