potitpanda Posted May 5, 2008 Posted May 5, 2008 (edited) Hello Everybody I Want Script to Kill and restart it after clicking on Yes in a MSGBOX How to do this ? Edited May 5, 2008 by potitpanda
Andreik Posted May 5, 2008 Posted May 5, 2008 (edited) Use this function Func Restart() If @Compiled = 1 Then Run( FileGetShortName(@ScriptFullPath)) Else Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit EndFunc Edited May 5, 2008 by Andreik
Triblade Posted May 5, 2008 Posted May 5, 2008 Does that work when killing your script? Anyway, I do know that when ppl want to delete there script they usually use a batch file to do that... My active project(s): A-maze-ing generator (generates a maze) My archived project(s): Pong3 (Multi-pinger)
d4rk Posted May 5, 2008 Posted May 5, 2008 $path=@ScriptFullPath run($path) exit [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys
FreeRider Posted May 5, 2008 Posted May 5, 2008 Hello potitpanda I know you already had some answers... But as I already needed to do the same as you want to, I developed a short function which allows me to update "myself" and restart the application. If you just want to perform a restart modify the script below and replace the "To be removed" line by something which would make the script to loop until the application stops. Ex : When the application starts an Text file is generated and when it shuts down this file is deleted. Of course the "@ScriptFullPath" must be replaced by the full path to the text file. Func Restart($FileToRename,$NewFileName,$Restart) $SC_File = @TEMPDIR & "\automaj.bat" FileDelete($SC_File) $SC_batch = 'loop:' & @CRLF & _ 'del "' & @ScriptFullPath & '"' & @CRLF & _; <<<<<< To be removed 'if exist "' & @ScriptFullPath & _ '" goto loop' & @CRLF & _ 'ren "' & $FileToRename & '" ' & $NewFileName & @CRLF & _ 'del "' & $FileToRename & '"' & @CRLF If $Restart = "YES" Then $SC_batch = $SC_batch & '"' & @ScriptFullPath & '" ' & '"' & "RESTART" & '"' & @CRLF $SC_batch = $SC_batch & 'del automaj.bat' & @CRLF FileWrite($SC_File,$SC_batch) Run($SC_File,@TEMPDIR,@SW_HIDE) Exit EndFunc Salut Camarade, FreeRider FreeRiderHonour & Fidelity
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now