Wolfshare Posted January 15, 2011 Share Posted January 15, 2011 I really need to create an autoIT script which would check if the program is launched/connected or not, if not windows would trigger restart. Any ideas? Thanks. Link to comment Share on other sites More sharing options...
smartee Posted January 15, 2011 Share Posted January 15, 2011 I really need to create an autoIT script which would check if the program is launched/connected or not, if not windows would trigger restart.Any ideas? Thanks.Your question seems a bit vague, however the functions ProcessExists,Shutdown may be helpful to you, refer to the help file for usage. Link to comment Share on other sites More sharing options...
Wolfshare Posted January 15, 2011 Author Share Posted January 15, 2011 Your question seems a bit vague, however the functions ProcessExists,Shutdown may be helpful to you, refer to the help file for usage.What about the time? i would like to set 'x' time.. Like ~200 seconds program *TITLE* not exist then restart computer, how the code should look? Link to comment Share on other sites More sharing options...
smartee Posted January 15, 2011 Share Posted January 15, 2011 What about the time? i would like to set 'x' time.. Like ~200 seconds program *TITLE* not exist then restart computer, how the code should look? ; this program waits 10 seconds for the process myexe.exe to be started else it reboots $IsStarted=ProcessWait("myexe.exe",10000) If ($IsStarted==0) Then Shutdown(6) EndIf Link to comment Share on other sites More sharing options...
somdcomputerguy Posted January 15, 2011 Share Posted January 15, 2011 (edited) Look also at TimerInit, TimerDiff, and the Do Until loop. edit: ya, smartee, ProcessWait is better.. Edited January 15, 2011 by somdcomputerguy - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Wolfshare Posted January 15, 2011 Author Share Posted January 15, 2011 ; this program waits 10 seconds for the process myexe.exe to be started else it reboots $IsStarted=ProcessWait("myexe.exe",10000) If ($IsStarted==0) Then Shutdown(6) EndIf Thanks, but i mean about title, example if firefox still not runing ~10 sec (still not opened) then restart it not process Link to comment Share on other sites More sharing options...
smartee Posted January 15, 2011 Share Posted January 15, 2011 Thanks, but i mean about title, example if firefox still not runing ~10 sec (still not opened) then restart it not processHmm firefox's process is firefox.exe, if u want to restart process, look at ProcessClose and ShellExecute Link to comment Share on other sites More sharing options...
somdcomputerguy Posted January 15, 2011 Share Posted January 15, 2011 (edited) @Wolfshare - Use WinWait then. But I think ProcessWait would be better to use in this case. Edited January 15, 2011 by somdcomputerguy - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Wolfshare Posted January 15, 2011 Author Share Posted January 15, 2011 Hmm firefox's process is firefox.exe, if u want to restart process, look at ProcessClose and ShellExecuteI know :< But isn't that possible to make it by title? Example if the program: "Name - Signed on" not exist more than ~200 then do - restart computer.. Not the process :< Link to comment Share on other sites More sharing options...
smartee Posted January 15, 2011 Share Posted January 15, 2011 Thanks, but i mean about title, example if firefox still not runing ~10 sec (still not opened) then restart it not processIf however you are talking about window titles, a similar logic to the code above can be used, implementing WinWait instead of ProcessWait and ProcessClose and or ShellExecute instead of Shutdown Link to comment Share on other sites More sharing options...
smartee Posted January 15, 2011 Share Posted January 15, 2011 I know :< But isn't that possible to make it by title? Example if the program: "Name - Signed on" not exist more than ~200 then do - restart computer.. Not the process :<See helpfile for the Shutdown function. Link to comment Share on other sites More sharing options...
Wolfshare Posted January 15, 2011 Author Share Posted January 15, 2011 (edited) If however you are talking about window titles, a similar logic to the code above can be used, implementing WinWait instead of ProcessWait and ProcessClose and or ShellExecute instead of Shutdown You mean that? ; this program waits 10 seconds for the process myexe.exe to be started else it reboots $IsStarted=ProcessWait("Sign On",10000) If ($IsStarted==0) Then Shutdown(6) EndIf Edited January 15, 2011 by Wolfshare Link to comment Share on other sites More sharing options...
smartee Posted January 15, 2011 Share Posted January 15, 2011 You mean that? ; this program waits 10 seconds for the process myexe.exe to be started else it reboots $IsStarted=ProcessWait("Sign On",10000) If ($IsStarted==0) Then Shutdown(6) EndIf ok, What is it that you want to do? I understood from your question that you want to check (for some time) if some program is open and if it is not, restart windows. Am i right? Link to comment Share on other sites More sharing options...
Wolfshare Posted January 15, 2011 Author Share Posted January 15, 2011 ok, What is it that you want to do? I understood from your question that you want to check (for some time) if some program is open and if it is not, restart windows. Am i right?Yep, that's right, because there sometimes that program has problems, so only computer restart would help So example if the program with *TITLE* not opened like ~200 sec then restart computer Link to comment Share on other sites More sharing options...
smartee Posted January 15, 2011 Share Posted January 15, 2011 Yep, that's right, because there sometimes that program has problems, so only computer restart would help So example if the program with *TITLE* not opened like ~200 sec then restart computer $IsStarted = WinWait("AutoIT script to check if program is working in timeloops - AutoIt Forums - Mozilla Firefox","", 10000) If ($IsStarted == 0) Then Shutdown(6) EndIf Link to comment Share on other sites More sharing options...
Wolfshare Posted January 15, 2011 Author Share Posted January 15, 2011 (edited) $IsStarted = WinWait("AutoIT script to check if program is working in timeloops - AutoIt Forums - Mozilla Firefox","", 10000) If ($IsStarted == 0) Then Shutdown(6) EndIf Thanks, what do you recomend? add it to my main script or create another au3 script? And btw it should restart, not ShutDown. Edited January 15, 2011 by Wolfshare Link to comment Share on other sites More sharing options...
smartee Posted January 15, 2011 Share Posted January 15, 2011 Thanks, what do you recomend? add it to my main script or create another au3 script?And btw it should restart, not ShutDown.You're welcome, the code above would work fine either way, however it would be great if you took a leisurely glance at the helpfile to understand how it works. Link to comment Share on other sites More sharing options...
smartee Posted January 15, 2011 Share Posted January 15, 2011 Thanks, what do you recomend? add it to my main script or create another au3 script? And btw it should restart, not ShutDown. reboot is exactly what the below code does 6=2+4=reboot+force now you're just being lazy, Please look at the helpfile or at least try the code before posting about it Shutdown(6) Link to comment Share on other sites More sharing options...
Wolfshare Posted January 15, 2011 Author Share Posted January 15, 2011 (edited) You're welcome, the code above would work fine either way, however it would be great if you took a leisurely glance at the helpfile to understand how it works.Great, working Edited January 15, 2011 by Wolfshare 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