Jump to content

Recommended Posts

Posted (edited)

Hi m8´s, im trying making this litle program but im with some problems.

I want a script that restart a program every 5 seconds.

Im waiting for some Help, thanks for all. :mellow:

Ric

Edited by underfenix
Posted

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.

Posted

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.

Posted

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

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

Posted (edited)

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
Posted

Because you run the application, resulting in a visible window, which you then hide.

Specify @SW_HIDE as a parameter for the initial run(), so the window is never made visible.

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
  • Recently Browsing   0 members

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