Jump to content

Restar program every 5 Seconds


Recommended Posts

Have a look at the documentation of

While <expression>
    statements
    ...
WEnd

and

Sleep
.

And if you want more detailed help, people might want to know what you want to do this for.

5 seconds sound like a short time for many tasks, so just in case - asking about help to trick in a game is at least frowned upon, more likely forbidden on this site, depending on the game.

Link to comment
Share on other sites

  • Developers

help me please :mellow:

Please be patient and less post happy, in stead spent the time to do some research yourself.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I see a few problems with your script:

while
Run("C:\ASS_L\program.EXE")
ProcessClose("program.EXE") ;this closes the process as soon as it starts
Sleep(5000)
Run("C:\ASS_L\program.EXE") ;you're not closing the program you're starting here
ContinueLoop ;Continueloop basically starts the loop from the top again. Your loop is going to do this anyways as it has reached the end.
WEnd

Try this:

while
$PID = Run("C:\ASS_L\program.EXE")
Sleep(5000)
ProcessClose($PID) ;using the $PID ensures that you close the program you just opened and not one that might have the same name.
WEnd

For future reference "i made this code but im having problems..." will ususally not be enough information to help you. You'll need to explain what it does and what you expect it to do aswell as any error messages if any.

Link to comment
Share on other sites

You are talking about batch files but you are calling .exe files. :mellow:

While 1
    $run = Run(@ComSpec & " /c " & "C:\Test.cmd")
    Sleep(5000)
    If ProcessExists($run) Then ProcessClose($run)
WEnd

BR,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Provided you app outputs an exitcode it could be as simple as this.

Do
    $exitcode = RunWait("C:\ASS_L\program.EXE")
    Sleep(5000)
Until $exitcode = ;sucsessful exit code of your exe here
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

My ideia is....

If the application is running, then whait 5 seconds then close application, and open application again, Or if appliacation is not runing, open apllication, whait 5 seconds, close application and open again and repeat this processe allways restarting the application every 5 seconds closing and open.

Im working on it i will place some code, to everyone see if is correct

Thanks for all help m8´s

Link to comment
Share on other sites

Well m8´s with the help of many good people the problem is solved.

Anyone know why when i make the window hide it allways flash when restart the program???

Here is the code:

While 1
    $run = run ("C:\Application.exe")
    WinWait("Advanced IP Scanner v1.5")
    WinSetState("Advanced IP Scanner v1.5","",@SW_HIDE) 
    Sleep(9000)
        If ProcessExists($run) Then ProcessClose ($run)
WEnd

Thanks m8´s

Edited by underfenix
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...