Ch1ldProd1gy Posted April 17, 2007 Share Posted April 17, 2007 I made a program, which I want to delete using autoit, but I cant get it to delete itself, I've tried this... FileDelete(@ScriptFullPath)oÝ÷ Ù©Ýjëh×6 FileDelete(@AutoItExe) any idea's? Link to comment Share on other sites More sharing options...
Developers Jos Posted April 17, 2007 Developers Share Posted April 17, 2007 I made a program, which I want to delete using autoit, but I cant get it to delete itself, I've tried this... FileDelete(@ScriptFullPath)oÝ÷ Ù©Ýjëh×6 FileDelete(@AutoItExe)oÝ÷ Ù©ò×ßÛ?ªê-xú,µçfj|g¬jëh×6Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '" > nul' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc 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. Link to comment Share on other sites More sharing options...
Ch1ldProd1gy Posted April 17, 2007 Author Share Posted April 17, 2007 how would I go about making it delete itself if I didnt know the name of the file? Link to comment Share on other sites More sharing options...
Developers Jos Posted April 17, 2007 Developers Share Posted April 17, 2007 how would I go about making it delete itself if I didnt know the name of the file?What do you think this Func does ?oh ... and make sure you understand it before using it ... 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. Link to comment Share on other sites More sharing options...
Ch1ldProd1gy Posted April 17, 2007 Author Share Posted April 17, 2007 (edited) What do you think this Func does ?oh ... and make sure you understand it before using it ...lol, I keep second guessing myself while trying to figure out what it does...before I go and run it lol hurting my head lolDont know what scratch.bat is Edited April 17, 2007 by Ch1ldProd1gy Link to comment Share on other sites More sharing options...
lolwut Posted April 17, 2007 Share Posted April 17, 2007 (edited) @ScriptFullPath This does it for you, so you don't need to know the name of the script. This function just creates a batch file and deletes the script from the batch file. Edited April 17, 2007 by lolwut Link to comment Share on other sites More sharing options...
Xand3r Posted April 17, 2007 Share Posted April 17, 2007 (edited) If FileExists(@TempDir&"\temp.au3") Then FileDelete(@TempDir&"\temp.au3") EndIf $f=FileOpen(@TempDir&"\temp.au3" , 2) FileWrite($f , "If (ProcessExists('"&@ScriptName&"')) Then") FileWrite($f , @CRLF) FileWrite($f , " ProcessClose('"&@ScriptName&"')") FileWrite($f , @CRLF) FileWrite($f , "EndIf") FileWrite($f , @CRLF) FileWrite($f , "FileDelete('"&@ScriptName&"')") FileWrite($f , @CRLF) FileClose($f) Run(@ScriptName&" /AutoIt3ExecuteScript "&@TempDir&"\temp.au3") Exit kinda like the batch code onli autoit Edited April 17, 2007 by alexmadman Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro Link to comment Share on other sites More sharing options...
Ch1ldProd1gy Posted April 17, 2007 Author Share Posted April 17, 2007 @ScriptFullPath This does it for you, so you don't need to know the name of the script. This function just creates a batch file and deletes the script from the batch file.Well, guess I dont need to understand it...it works...thanks lol 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