Jump to content

Restarting a compiled script ?!


Recommended Posts

by far i'm using a somewhat stupid mathode:

- i'm making the script create a "RestartMyAPP.bat" File with the commands to wait 5 secs and start my app again.

- then i've added it to start without waiting in the ONEXIT func

any normal way to make it ?!

If $RestartAPP = 1 Then
        $file = FileOpen(@TempDir & "\RestartMyAPP.bat", 1)
        FileWriteLine($file, "ping -n 5 127.0.0.1 >nul")
        FileWriteLine($file, @ScriptFullPath)
        FileClose($file)
        ShellExecute("RestartMyAPP.bat", "", @TempDir, "open", @SW_HIDE)
    EndIf
Edited by Armand

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

Hi,

If Not $CMDLINE[0] Then
    If UBound(ProcessList(@ScriptName)) > 2 Then Exit
ElseIf $CMDLINE[1] <> '/restart' Then
    Exit
EndIf

;...
;...
;...

While 1
    Switch GUIGetMsg()
        Case $buttonGO
            Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptFullPath & '" /restart')
            Exit
    EndSwitch
WEnd

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

by far i'm using a somewhat stupid mathode:

- i'm making the script create a "RestartMyAPP.bat" File with the commands to wait 5 secs and start my app again.

- then i've added it to start without waiting in the ONEXIT func

any normal way to make it ?!

It sounds like you are starting a second instance of your script in the ONEXIT function. Then the first instance exits. If you know you need to have the script running then why allow the first instance to exit? Why not just reinitialise all the conditions and variables and start it over from the top? It sounds like you need to put your code inside a never ending loop. Have I missed something?

Link to comment
Share on other sites

Well...

I want my script to check for updates if there are some then it shoul'd download them and replace the running compiled script with the ones downloaded - so far so good ! but then, as the script finishes the download it seems like it's continuing with the NEW SCRIPT from the same place it stoped in the OLD SCRIPT, so maybe i do need to just send it to the start...

but how do i do that ?! (should i insert the entire script into a func and then just call it ?!)

@Xenobiologist

what does your script do man ?!

Edited by Armand

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

Maybe this will help :

If $RestartAPP = 1 Then
        $file = FileOpen(@TempDir & "\RestartMyAPP.bat", 1)
        FileWriteLine($file, "ping -n 5 127.0.0.1 >nul")
        FileWriteLine($file, @ScriptFullPath)
        FileClose($file)
        ShellExecute("RestartMyAPP.bat", "", @TempDir, "open", @SW_HIDE)
    EndIf

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

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