alucard Posted March 29, 2005 Share Posted March 29, 2005 hi, sorry for my bad english I would like to make a script and convert it in a .exe then when i lauch the .exe , it run the script but at the end , i want it delete itself automatically. How i can make that. thank you Link to comment Share on other sites More sharing options...
zcoacoaz Posted March 29, 2005 Share Posted March 29, 2005 FileWrite ( "onexit.bat", "delete " & @ScriptFullPath ) Func OnAutoItExit() Run ( "onexit.bat", "", @SW_HIDE ) EndFunc im not sure but i think that will do it [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
MHz Posted March 29, 2005 Share Posted March 29, 2005 A goto maybe better. Call the function last. 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 Link to comment Share on other sites More sharing options...
alucard Posted March 29, 2005 Author Share Posted March 29, 2005 FileWrite ( "onexit.bat", "delete " & @ScriptFullPath )Func OnAutoItExit() Run ( "onexit.bat", "", @SW_HIDE )EndFuncThis solutionis good but it don't run well because when script write in the .bat file , it don't write "c:\....................." Link to comment Share on other sites More sharing options...
SlimShady Posted March 29, 2005 Share Posted March 29, 2005 MHz's version should work. Put the following in your script. Func OnAutoItExit() _SelfDelete() EndFunc 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 Link to comment Share on other sites More sharing options...
alucard Posted March 29, 2005 Author Share Posted March 29, 2005 thanks your solution run very well bye 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