Jump to content
Sign in to follow this  
Xylo

Auto restarting an application over time

Recommended Posts

Xylo

Hey there,
I just started my adventure with AutoIT and well, I have a problem.

Basically, I need my program to do:
1. Start an application

2. Wait 13 minutes

3. Close the application

4. Do the following all the time (infinite loop)

My code for now is:

HotKeySet("{ESC}", "_Terminate")


   Func RunBot()
      While 1
      Local $iPID = Run("directory to my application")
      Sleep(780000)
      ProcessClose($iPID)
      WEnd
   EndFunc


Func _Terminate()
   Exit
EndFunc

RunBot()
MsgBox ($MB_OK, "program is running somehow", "this is proof that this works")

It does nothing. Even MsgBox doesn't show up.
Can someone kindly help me please?

Share this post


Link to post
Share on other sites
JLogan3o13

You need to add error checking to your script. Add a ConsoleWrite after your $iPID declaration, to ensure you get that far. Then perhaps another ConsoleWrite when you enter Sleep. You need to determine where the break is, before you can resolve the issue.


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
Xylo

The error checking with ConsoleWrite shows me that everything is fine. It's just that the program doesn't start. Destination is all good, as I have checked that. 
The directory is : D:folder1folder2Application.exe

Share this post


Link to post
Share on other sites
Xylo

Unfortunately, no.

Share this post


Link to post
Share on other sites
Xylo

That works :D 
Thank you very much for help! 

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  

×