Nova Posted July 10, 2004 Posted July 10, 2004 (edited) I was searching through the forum when I found a topic about making a script delete itself. This is done by making the script write a batch file that deletes the script and then runs the batch. FileWriteLine("c:\byebye.bat", 'del "'& @ScriptFullPath & '"') FileWriteLine("c:\byebye.bat", 'del c:\byebye.bat') Run("c:\byebye.bat") I have found that this script works when ur dealing with small ammounts of code. But I want to use it in a script that is quite large. I find when I run the script it creates the batch file and runs it but only deletes the batch file and not the script aswell I think this is because the script takes longer to finish that it dose for the batch file to finish and the batch file cant delete the script while its running. I know larry asked how to make the script loop and keep trying to delete the script untill its done and I have tryed to edit that sample script but cannot get it to work. Can anyone show me how I can make the script loop the delete command untill the script deletes itself ? Edited July 10, 2004 by nova
Developers Jos Posted July 10, 2004 Developers Posted July 10, 2004 This version has a loop back to the beginning until the del command was successful. The ping is to make it pause a few seconds. FileWriteLine("c:\byebye.bat", ':start') FileWriteLine("c:\byebye.bat", 'del "'& @ScriptFullPath & '"') FileWriteLine("c:\byebye.bat", 'ping dummy') FileWriteLine("c:\byebye.bat", 'If exist "'& @ScriptFullPath & '" goto start') FileWriteLine("c:\byebye.bat", 'del c:\byebye.bat') Run("c:\byebye.bat") SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Nova Posted July 10, 2004 Author Posted July 10, 2004 (edited) I left out the ping because I though it was part of larrys program,and im guessing I must have damaged the code by doing so ! Tnx for teh quick reply JdeB I owe u 1 ! Edited July 10, 2004 by nova
Developers Jos Posted July 10, 2004 Developers Posted July 10, 2004 nova said: I left out the ping because I though it was part of larrys program,and im guessing I must have damaged the code by doing so !Tnx for teh quick reply JdeB I owe u 1 !the ping can be left out ... but the batch file will take a lot of CPU when the scriptfile can't be deleted... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
warsur Posted July 10, 2004 Posted July 10, 2004 We are discussing this here, take a look,...........maybe I should post it under v3 support.http://www.autoitscript.com/forum/index.php?showtopic=3614
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