lgkoliveira Posted December 29, 2020 Share Posted December 29, 2020 I´m having difficulties while using autoit to automate a process of opening a software on a determined screen. Actually, I´ve already built the script to open it, the fact is that sometimes this software is updated, and when I run it, an update message shows on the screen, and when it is closed the script pauses. The script below works perfectly, but pauses when the sw receives an update: $SisMirage = "C:\Mirage2011\MIRAGE2011.EXE" Run ($SisMirage) If WinActive("Aviso") Then Sleep(2000) Send("{ENTER}") Run ($SisMirage) EndIf WinWaitActive("Módulo de Acesso ao Sistema") Send("STATUS") Send("{TAB}") Send("mrgconprod") Send("!c") Sleep(6000) MouseClick("", 85, 30, 1) Send("{DOWN 20}") Send("{ENTER}") The script below only works when it receives an update: $SisMirage = "C:\Mirage2011\MIRAGE2011.EXE" Run ($SisMirage) If WinWaitActive("Aviso") Then Sleep(2000) Send("{ENTER}") Run ($SisMirage) EndIf WinWaitActive("Módulo de Acesso ao Sistema") Send("STATUS") Send("{TAB}") Send("mrgconprod") Send("!c") Sleep(6000) MouseClick("", 85, 30, 1) Send("{DOWN 20}") Send("{ENTER}") The image attached is the update message, in case of questions. Can anyone help me? Link to comment Share on other sites More sharing options...
mikell Posted December 29, 2020 Share Posted December 29, 2020 As you don't know whether this message will appear or not, you need to make the script wait for a while right after the first Run So you might put a Sleep() between this Run and the WinActive (1st script) , or use a timeout in the WinWaitActive (2nd script) lgkoliveira 1 Link to comment Share on other sites More sharing options...
lgkoliveira Posted December 30, 2020 Author Share Posted December 30, 2020 Thank u very much Mikell, I did this and some changes in the script and it worked. I noticed that when the software received an update, the path name changed to Mirage2011_Ant.exe , so when I clicked on it it would change to Mirage2011.exe. Then I decided to always run the old one, and if the sw haven´t been updated, it would close (WinClose) and run the new one. If it was updated, I´d just click the OK button, and run the most recent one. Take a look: $SisMirageAnt = "C:\Mirage2011\MIRAGE2011_ANT.EXE" $SisMirage = "C:\Mirage2011\MIRAGE2011.EXE" Run ($SisMirageAnt) Sleep(8000) If WinActive("Aviso") Then Sleep(2000) Send("{ENTER}") EndIf WinClose("Módulo de Acesso ao Sistema") Run($SisMirage) WinWaitActive("Módulo de Acesso ao Sistema") Send("STATUS") Send("{TAB}") Send("mrgconprod") Send("!c") Sleep(6000) MouseClick("", 85, 30, 1) Send("{DOWN 20}") Send("{ENTER}") I noticed that when the software received an update, the main name changed to Mirage2011_Ant.exe , so when I clicked it would change to Mirage2011.exe. 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