Jump to content

delete it self


Recommended Posts

so my program is almost done...

the only thing I need is to make it delete it self after one use

or atleast make it unable to work again

FileDelete ( "path" )

thats what I found in help file but I got no idea how to make it work

if I write the path its not going to work because it might not be there anymore

its a program im going to give to others when they use it

it will delete before restarting computer or just when its closing

ANYTHING TO MAKE THEM NOT BE ABLE TO USE IT AGAIN

Link to comment
Share on other sites

Just add this to your script:

Func OnAutoItExit()

    Local $sCmdFile, $iDelay=0
    FileDelete(@TempDir & "\scratch.bat")
    $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _
            & ':loop' & @CRLF _
            & 'del "' & @ScriptFullPath & '"' & @CRLF _
            & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _
            & 'del ' & @TempDir & '\scratch.bat'
    FileWrite(@TempDir & "\scratch.bat", $sCmdFile)
    Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE)
EndFunc
Edited by monoceres

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

wow thx mate :P xD ur awesome!!!

I have been trying to figure this out all day :P

finally my script/program is done ^^ >Nuke is happy<

*edit*

dangit...

so the script is working fine and it does delete it self IF you get to close it your self (which you dont get to do = blockinput(1))

when I restart or close my computer the script doesnt get to delete it self

as if the computer close too fast :)

Edited by Nukex1
Link to comment
Share on other sites

wow thx mate :P xD ur awesome!!!

I have been trying to figure this out all day :P

finally my script/program is done ^^ >Nuke is happy<

*edit*

dangit...

so the script is working fine and it does delete it self IF you get to close it your self (which you dont get to do = blockinput(1))

when I restart or close my computer the script doesnt get to delete it self

as if the computer close too fast :)

Why don't you add another script to startup then that deletes both of them at startup?

And I'm not even going to ask what your script does.

children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...