Accension Posted May 28, 2008 Share Posted May 28, 2008 Is there a way that I can remove the executable once it's been closed at the end of the program? Basically delete itself so it leaves no trace? Link to comment Share on other sites More sharing options...
Jango Posted May 28, 2008 Share Posted May 28, 2008 Yes use this: Opt("OnExitFunc", "_SelfDelete") ... your code ... Func _SelfDelete() Local $cmdfile FileDelete(@TempDir & "\dcp.cmd") $cmdfile = ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\dcp.cmd' FileWrite(@TempDir & "\dcp.cmd", $cmdfile) Run(@TempDir & "\dcp.cmd", @TempDir, @SW_HIDE) EndFunc Apples292 1 Link to comment Share on other sites More sharing options...
torels Posted May 28, 2008 Share Posted May 28, 2008 compile it and with Start>>Run>>iExpress.exe and put a batch file in the package which tells te file to delete itself Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
DMEE Posted May 28, 2008 Share Posted May 28, 2008 Is there a way that I can remove the executable once it's been closed at the end of the program? Basically delete itself so it leaves no trace?you can use a batch script that is executed on autoitexit.Func OnAutoItExit ( ) ...EndFunc In the beginning there was nothing and then even that exploded - anonymous Link to comment Share on other sites More sharing options...
Accension Posted May 29, 2008 Author Share Posted May 29, 2008 Yes use this: Opt("OnExitFunc", "_SelfDelete") ... your code ... Func _SelfDelete() Local $cmdfile FileDelete(@TempDir & "\dcp.cmd") $cmdfile = ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\dcp.cmd' FileWrite(@TempDir & "\dcp.cmd", $cmdfile) Run(@TempDir & "\dcp.cmd", @TempDir, @SW_HIDE) EndFunc What an awesome piece of code, this is the best. Link to comment Share on other sites More sharing options...
yucatan Posted May 29, 2008 Share Posted May 29, 2008 compile it and with Start>>Run>>iExpress.exe and put a batch file in the package which tells te file to delete itself does this olso works when you do alt+ctrl+delete and kill the process???? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 29, 2008 Moderators Share Posted May 29, 2008 What an awesome piece of code, this is the best.Open SciTe, type in SelfDelete<space> does this olso works when you do alt+ctrl+delete and kill the process????What did your test reveal?In all seriousness, you've stopped the executable outside of itself, which means it did not have a chance to do any exit functions.Now for my question, why would you want this to happen? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
yucatan Posted May 29, 2008 Share Posted May 29, 2008 Open SciTe, type in SelfDelete<space> What did your test reveal?In all seriousness, you've stopped the executable outside of itself, which means it did not have a chance to do any exit functions.Now for my question, why would you want this to happen?i'm making software that 2 .exe needs eatchotehr if 1 is not running then he sent a signal tot the server and stops himself i want something that when u kill the .exe he needs to sent the signal now i'm useing 2 .exe for it that both are running.. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 29, 2008 Moderators Share Posted May 29, 2008 i'm making software that 2 .exe needs eatchotehr if 1 is not running then he sent a signal tot the server and stops himself i want something that when u kill the .exe he needs to sent the signal now i'm useing 2 .exe for it that both are running..If executables could still process code after being terminated by an outside process, there wouldn't be any need for the outside process really.You'll need to run two executables, one to run the code, the 2nd to monitor the one that is running the code.If the 2nd executable sees that the first one is no longer in the process list, and it sees that the first one still exists on the hard drive, then it knows it has been terminated outside of itself.Since you are already using two executables, then it should be trivial to implement them making sure they both exist before carrying out an action that could result in catastrophic failure. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
AlmarM Posted May 29, 2008 Share Posted May 29, 2008 Ehm like: FileDelete(@ScriptFullPath) Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 29, 2008 Moderators Share Posted May 29, 2008 Ehm like: FileDelete(@ScriptFullPath)What are you talking about? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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