Sign in to follow this  
Followers 0
Wolfshare

AutoIT script to check if program is working in timeloops

19 posts in this topic

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.

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Look also at TimerInit, TimerDiff, and the Do Until loop.

edit: ya, smartee, ProcessWait is better..

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

; 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 :x not process

Share this post


Link to post
Share on other sites

Thanks, but i mean about title, example if firefox still not runing ~10 sec (still not opened) then restart it :x not process

Hmm firefox's process is firefox.exe, if u want to restart process, look at ProcessClose and ShellExecute

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

@Wolfshare - Use WinWait then. But I think ProcessWait would be better to use in this case.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Hmm firefox's process is firefox.exe, if u want to restart process, look at ProcessClose and ShellExecute

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 :<

Share this post


Link to post
Share on other sites

Thanks, but i mean about title, example if firefox still not runing ~10 sec (still not opened) then restart it :x not process

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#12 ·  Posted (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 by Wolfshare

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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 :x So example if the program with *TITLE* not opened like ~200 sec then restart computer

Share this post


Link to post
Share on other sites

Yep, that's right, because there sometimes that program has problems, so only computer restart would help :x 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

Share this post


Link to post
Share on other sites

#16 ·  Posted (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 by Wolfshare

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

#19 ·  Posted (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 by Wolfshare

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0