Jump to content

AutoIT script to check if program is working in timeloops


Recommended Posts

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

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

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

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

Link to comment
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 :<
Link to comment
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

Link to comment
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.

Link to comment
Share on other sites

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
Link to comment
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?

Link to comment
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
Link to comment
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
Link to comment
Share on other sites

$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
Link to comment
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.

Link to comment
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)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...