Sign in to follow this  
Followers 0
SMOKE1990

Delete Compiled topic from 09

8 posts in this topic

Orininal thread

Hate to bump a thread from 09 but instead of posting a new one I thought i would ask on here. I'm looking to let my friends use my storage script but don't want it to be passed around if one of them decides to. I have a set in the script when it opens to check a ini file and look for a keyword to proceed.

$Accept_value = IniRead('start.ini', 'continue', 'Accept','')
If $Accept_value = 'go' Then

I want the value 'go' to proceed and it just completes the If script. I am looking to setup a ElseIf $Accept_value = 'delete' Then

()Delete

This is the function i want to destroy my compiled script and make sure its gone from the computer buy deleteing the recycle bin to.

I have found this somewhere awhile ago. I DO NOT take credit for this but it works great at self destruction if compiled.

This is written on that script and im having trouble understanding this, any enlightenment would be appreciated

If @Compiled Then
        $sCMDLine = ':CheckFile' & @CRLF & _
                    'If exist "' & @ScriptFullPath & '" GOTO :DelFile' & @CRLF & _
                    'Goto :CheckFile' & @CRLF & _
                    ':DelFile' & @CRLF & _
                    'del /f /q "' & @ScriptFullPath & '"' & @CRLF & _
                    'del /f /q "' & @TempDir & '\~deltmp.bat"'
        $sCMDLine = _StringANSI2OEM($sCMDLine)
        $hFile = FileOpen(@TempDir & "\~deltmp.bat", 2)
        FileWrite($hFile, $sCMDLine)
        FileClose($hFile)
        Run(@TempDir & "\~deltmp.bat", @TempDir, @SW_HIDE)
    EndIf

Edit:

Forgot this function:

Func _StringANSI2OEM($strText)
    Local $buf = DllStructCreate("char["& StringLen($strText)+1 &"]")
    Local $ret = DllCall("User32.dll", "int", "CharToOem", "str", $strText, "ptr", DllStructGetPtr($buf))
    If Not(IsArray($ret)) Then Return SetError(1, 0, '')
    If $ret[0]=0 Then Return SetError(2, $ret[0], '')
    Return DllStructGetData($buf, 1)
EndFunc  ;==> _StringANSI2OEM

Share this post


Link to post
Share on other sites



Look in my signature for _SelfDelete(), run it at the start of your script and it will monitor in the background your process. When the process closes it will delete the executable.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

$Accept_value = IniRead('start.ini', 'continue', 'Accept','')
If $Accept_value = 'go' Then
WinExists("Notepad")
ElseIf $Accept_value = 'delete' Then
SelfDelete()
Exit
Else
Exit
EndIf

by going to the SelfDelete() function which i copied and pasted into my script deleteing the _ in front will just delete it if need be?

Share this post


Link to post
Share on other sites

I used your script and it works nicely deletes the script when the word delete is present, it only puts it into the recycle bin however and you can just drag it back out. any ideas on this? like force empty of recycle bin

Share this post


Link to post
Share on other sites

Weird because for me the _SelfDelete function doesn't send it to the recyclebin. I'm using Windows 7 x64.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

I to am on windows 7 64 bit ultimate

Share this post


Link to post
Share on other sites

nevermind the second time i did it just now it was gone for good thank you

Share this post


Link to post
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
Sign in to follow this  
Followers 0