pille24 Posted July 3, 2006 Share Posted July 3, 2006 How can i delete my script, after I have run it? I dont want another script to do it. And FileDelete is obviously not working, as the Script itself is still running... thx Link to comment Share on other sites More sharing options...
ending Posted July 3, 2006 Share Posted July 3, 2006 FileDelete("path") should work, but if it doesn't you can run a cmd and delete it that way. Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 3, 2006 Share Posted July 3, 2006 Hi, Func _SelfDelete() Local $cmdfile FileDelete(@TempDir & "\scratch.cmd") $cmdfile = ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.cmd' FileWrite(@TempDir & "\scratch.cmd", $cmdfile) Run(@TempDir & "\scratch.cmd", @TempDir, @SW_HIDE) EndFunc ;==>_SelfDelete 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 More sharing options...
pille24 Posted July 3, 2006 Author Share Posted July 3, 2006 cheers that works! @ending it doesnt work with FileDelete... Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 3, 2006 Share Posted July 3, 2006 No, prob. I think MHz wrote it. 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 More sharing options...
WTS Posted July 3, 2006 Share Posted July 3, 2006 (edited) This calls autoits built in functions.. no second script. you have to exit the script before you can delete it with filedelete, the other way that th.meger is good too. Opt("OnExitFunc","_Suicide") While 1 ;Your func msgbox(0,"",'Goodbye Cruel World!') Exit WEnd Func _Suicide() FileDelete(@ScriptFullPath) EndFunc Edited July 3, 2006 by WTS Link to comment Share on other sites More sharing options...
Josbe Posted July 3, 2006 Share Posted July 3, 2006 This calls autoits built in functions.. no second script. Opt("OnExitFunc","_Suicide") While 1 ;Your func msgbox(0,"",'Goodbye Cruel World!') Exit WEnd Func _Suicide() FileDelete(@ScriptFullPath) EndFunc This alternative surely doesn't works with scripts compiled. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
herewasplato Posted July 4, 2006 Share Posted July 4, 2006 (edited) This calls autoits built in functions.. no second script...Compile/run this little test:MsgBox(0, '', 'Goodbye Cruel World!') If FileDelete(@ScriptFullPath) = 0 Then MsgBox(0, '', 'Failed to delete.') The OP does hint that the script is compiled and thus in use... but that is not why I posted... ...this is: http://www.autoitscript.com/forum/index.ph...st&p=159428 Edited July 4, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] 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