SMOKE1990 Posted December 17, 2011 Share Posted December 17, 2011 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 Link to comment Share on other sites More sharing options...
guinness Posted December 17, 2011 Share Posted December 17, 2011 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. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
SMOKE1990 Posted December 18, 2011 Author Share Posted December 18, 2011 $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? Link to comment Share on other sites More sharing options...
SMOKE1990 Posted December 18, 2011 Author Share Posted December 18, 2011 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 Link to comment Share on other sites More sharing options...
guinness Posted December 18, 2011 Share Posted December 18, 2011 Weird because for me the _SelfDelete function doesn't send it to the recyclebin. I'm using Windows 7 x64. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
SMOKE1990 Posted December 18, 2011 Author Share Posted December 18, 2011 I to am on windows 7 64 bit ultimate Link to comment Share on other sites More sharing options...
JohnOne Posted December 18, 2011 Share Posted December 18, 2011 Me neither, when its gone, its gone. Not the copy I made first though AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
SMOKE1990 Posted December 18, 2011 Author Share Posted December 18, 2011 nevermind the second time i did it just now it was gone for good thank you 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