All,
I've a question about my script. Mainly about the following part of my code:
Instead of having 23 lines of code to only click a cancel button I should also be able to great a loop. When it runs the script and after it clicked "Button8" it should start the loop and keep scanning if the window with the name "Report Destination" pops up and if so it should press "Button7". I'm not sure if we can build in some sort of timeout that if the screen didn't popup for 10 seconds it will go out of the loop and wait until the script gets executed again(we don't want a loop that will eat up all CPU). I've no idea if this is possible with AutoIT and it would be great if someone can help me to get some better understanding of what the capabilities are of creating a loop. I was thinking of a another If / Else statement but this is probably not the "best" solution..
Thanks,
I've a question about my script. Mainly about the following part of my code:
[ autoit ]
AUTOITSETOPTION("SendKeyDelay",100) ;SET KEY DELAY IF WINEXISTS("Microsoft Dynamics GP")=1 THEN ;CHECK IF GP IS RUNNING WINACTIVATE("Microsoft Dynamics GP") ;ACTIVATE GP WINDOW SEND("!ans{ENTER}") ;OPEN INVENTORY SERIES POSTING WINDOW SLEEP(5000) ;WAIT 5 SECONDS TO LET THE INVENTORY SERIES POSTING WINDOW OPEN CONTROLFOCUS("Microsoft Dynamics GP","","Button8") ;SELECT "MARK WMS BCHS" Button CONTROLCLICK("Microsoft Dynamics GP","","Button8") ;CLICK "MARK WMS BCHS" Button ;CLICK CANCEL ON REPORT DESTINATION WINDOWS WINWAITACTIVE("Report Destination","",10) CONTROLFOCUS("Report Destination","","Button7") CONTROLCLICK("Report Destination","","Button7") WINWAITACTIVE("Report Destination","",10) CONTROLFOCUS("Report Destination","","Button7") CONTROLCLICK("Report Destination","","Button7") WINWAITACTIVE("Report Destination","",10) CONTROLFOCUS("Report Destination","","Button7") CONTROLCLICK("Report Destination","","Button7") WINWAITACTIVE("Report Destination","",10) CONTROLFOCUS("Report Destination","","Button7") CONTROLCLICK("Report Destination","","Button7") WINWAITACTIVE("Report Destination","",10) CONTROLFOCUS("Report Destination","","Button7") CONTROLCLICK("Report Destination","","Button7") WINWAITACTIVE("Report Destination","",10) CONTROLFOCUS("Report Destination","","Button7") CONTROLCLICK("Report Destination","","Button7") WINWAITACTIVE("Report Destination","",10) CONTROLFOCUS("Report Destination","","Button7") CONTROLCLICK("Report Destination","","Button7") WINWAITACTIVE("Report Destination","",10) CONTROLFOCUS("Report Destination","","Button7") CONTROLCLICK("Report Destination","","Button7") ELSE ;IF GP IS NOT RUNNING BELOW CODE WILL BE EXECUTED
Instead of having 23 lines of code to only click a cancel button I should also be able to great a loop. When it runs the script and after it clicked "Button8" it should start the loop and keep scanning if the window with the name "Report Destination" pops up and if so it should press "Button7". I'm not sure if we can build in some sort of timeout that if the screen didn't popup for 10 seconds it will go out of the loop and wait until the script gets executed again(we don't want a loop that will eat up all CPU). I've no idea if this is possible with AutoIT and it would be great if someone can help me to get some better understanding of what the capabilities are of creating a loop. I was thinking of a another If / Else statement but this is probably not the "best" solution..
Thanks,