Jump to content

Recommended Posts

  • Moderators
Posted (edited)

Does anyone no how to delet a script when it is done as not to leave anything behind? For central deployment

In SciTe type in SelfDelete + SpaceBar Edited by SmOke_N

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.

Posted

Very beginning or very end are the usual places you can put it.

Just remember make a call to _SelfDelete() before your script exits.

You could also use the OnAutoItExit feature (might require beta):

Func OnAutoItExit()
;following code causes script to delete itself
    Local $sCmdFile
    FileDelete(@TempDir & "\Scratch.bat")
    $sCmdFile = ':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
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

Func OnAutoItExit()
;following code causes script to delete itself
    Local $sCmdFile
    FileDelete(@TempDir & "\Scratch.bat")
    $sCmdFile = ':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

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
×
×
  • Create New...