moltra Posted May 21, 2007 Share Posted May 21, 2007 I am trying to write an Autoit script that will monitor for a window from a certain program to pop up and activate a control in it and restart the program again. my script seems to shutdown randomly, and at times it will work properly and others it will not. Can some one look at the code below and tell me what I am doing wrong. i=0 While $i <20000000 WinWait("program") ControlClick("Program popup", "", 2) sleep (15000) Run("C:\Program Files\program.exe") $i=$i+1 WEnd Link to comment Share on other sites More sharing options...
Zedna Posted May 21, 2007 Share Posted May 21, 2007 While 1 WinWait("program") ControlClick("Program popup", "", 2) ; wait for process close While ProcessExists("program.exe") Sleep(100) WEnd Run("C:\Program Files\program.exe") WEnd Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
PaulIA Posted May 21, 2007 Share Posted May 21, 2007 While 1 WinWait("program") ControlClick("Program popup", "", 2) ; wait for process close While ProcessExists("program.exe") Sleep(100) WEnd Run("C:\Program Files\program.exe") WEnd Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
moltra Posted May 21, 2007 Author Share Posted May 21, 2007 Will that allow the autoit script to keep running and restart the program.exe when it stops? I am trying to keep this program running 24/7 Link to comment Share on other sites More sharing options...
November Posted May 21, 2007 Share Posted May 21, 2007 Will that allow the autoit script to keep running and restart the program.exe when it stops? I am trying to keep this program running 24/7Yeap.The code will go on and on and on...The problem is your computer... can he manage? Cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
moltra Posted May 21, 2007 Author Share Posted May 21, 2007 Small addition/correction: While 1 WinWait("program popup") WinActivate("program popup") ControlClick("program popup", "", 2) ; wait for process close While ProcessExists("program.exe") Sleep(100) WEnd Run("C:\Program Files\program.exe") WEnd I changed the program using the above code, but the system tray icon keeps flashing a RED X. Is that normal? Link to comment Share on other sites More sharing options...
Kogmedia Posted May 21, 2007 Share Posted May 21, 2007 I changed the program using the above code, but the system tray icon keeps flashing a RED X. Is that normal?Yes it normal [font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search Link to comment Share on other sites More sharing options...
PaulIA Posted May 21, 2007 Share Posted May 21, 2007 I changed the program using the above code, but the system tray icon keeps flashing a RED X. Is that normal?It's just making sure the "program popup" is the active window. You can take it out. I'm just the paranoid type. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
Zedna Posted May 21, 2007 Share Posted May 21, 2007 I changed the program using the above code, but the system tray icon keeps flashing a RED X. Is that normal? If you click on tray icon script pauses. You can unpause it. You can avoid this behaviour by: Opt('TrayAutoPause',0) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
moltra Posted May 22, 2007 Author Share Posted May 22, 2007 I noticed that if I have this script running and the popup pops up it will not do anything, but if I have the popup active and I start this script it gets rid of the popup, but does not restart the program. 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