jvanegmond Posted April 26, 2006 Share Posted April 26, 2006 (edited) I'm looking for a way to make the script restart itself.. in stead of using 2 files that run each other and close themselves.. Something like EnvUpdate () but then AutoItScriptUpdate() Edited April 26, 2006 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
taurus905 Posted April 26, 2006 Share Posted April 26, 2006 I'm looking for a way to make the script restart itself.. in stead of using 2 files that run each other and close themselves..Something like EnvUpdate () but then AutoItScriptUpdate()Manadar,This worked for me to restart a compiled script (.exe)If PrgName.exe is running, and it calls _Restart_Prg(), it restarts.I hope this helps.taurus905Func _Restart_Prg() ; Restart Program Run("PrgName.exe") WinClose("PrgName")EndFunc ; ==> _Restart_Prg "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs Link to comment Share on other sites More sharing options...
jvanegmond Posted April 26, 2006 Author Share Posted April 26, 2006 (edited) Manadar,This worked for me to restart a compiled script (.exe)If PrgName.exe is running, and it calls _Restart_Prg(), it restarts.I hope this helps.taurus905Func _Restart_Prg() ; Restart Program Run("PrgName.exe") WinClose("PrgName")EndFunc ; ==> _Restart_PrgThanks taurus,I changed WinClose("PrgName") for ProcessClose('PrgName.exe') and then it worked.[edit] I figured by using Exit in stead of WinClose you get a bit more security. So i used Exit now. Edited April 26, 2006 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
taurus905 Posted April 26, 2006 Share Posted April 26, 2006 Manadar, I will try changing WinClose("PrgName") to ProcessClose('PrgName.exe') It makes better sense. Thanks. taurus905 "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs Link to comment Share on other sites More sharing options...
Uten Posted April 26, 2006 Share Posted April 26, 2006 I thougth the task at hand was to restart the running script? As in restart PrgName from PrgName? If that is the case, I think you should locate the PID of PrgName before starting new PrgName, and then close the PID. Othervice you could be closing the PrgName you just started Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
taurus905 Posted April 26, 2006 Share Posted April 26, 2006 I thougth the task at hand was to restart the running script? As in restart PrgName from PrgName?If that is the case, I think you should locate the PID of PrgName before starting new PrgName, and then close the PID. Othervice you could be closing the PrgName you just started Uten,I agree with all you said. And I knew there had to be a better way, because I was restarting another instance before I closed the first one. I felt it was a timing issue and that's why it worked. Not sure. :"> I was just glad that it worked without any bad side-effects, that I knew of.taurus905 "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs Link to comment Share on other sites More sharing options...
RagnaroktA Posted April 26, 2006 Share Posted April 26, 2006 #Region --- Restart Program --- Func _RestartProgram(); Thanks UP_NORTH If @Compiled = 1 Then Run(FileGetShortName(@ScriptFullPath)) Else Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit EndFunc; ==> _RestartProgram #EndRegion --- Restart Program --- Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki Link to comment Share on other sites More sharing options...
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