Discovery164 Posted April 27, 2011 Share Posted April 27, 2011 Hey all,I have been modifying VB code that some of you may have seen that is supposed to delete user profiles. I have made it through Object creation, pinging, and connecting to a remote PC. I have learned a few things. However, I am struggling with what is in red:if not objItem.SID = "" then if objItem.SID = "S-1-5-20" then deleteResponse = 7 elseif objItem.SID = "S-1-5-19" then deleteResponse = 7 elseif objItem.SID = "S-1-5-18" then deleteResponse = 7 else deleteResponse = MsgBox (strMessage,35,"Profile Found") end ifend if Select Case deleteResponse Case 6 Err.Clear objItem.Delete_ If Err.Number = 0 Then MsgBox("Profile " & objitem.localpath & " on " & strComputer & " deleted") Else MsgBox("Profile " & objitem.localpath & " on " & strComputer & " NOT deleted - Is user logged in?") End If End SelectWhat is the Err.Clear equivalent in AutoIt along with ObjItem.Delete_ ?? Link to comment Share on other sites More sharing options...
GEOSoft Posted April 27, 2011 Share Posted April 27, 2011 Err.clear should probably be SetError(0) I have a feeling that ObjItem.Delete_ is calling another function but I can't be sure without seeing all the code involved and even then it might be tough. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
kor Posted April 28, 2011 Share Posted April 28, 2011 (edited) Lol, I have some code already built in autoit that does exactly what you want. Deleting profiles. However I'm away from my work computer for another 3 or 4 days since I'm out of the country. If you don't have anything by then I'll post it when I get back. Edited April 28, 2011 by kor Link to comment Share on other sites More sharing options...
Discovery164 Posted April 28, 2011 Author Share Posted April 28, 2011 (edited) Thanks, Spammer. I may need that assistance. Until then I will add now that Objitem.delete_ is deleting the found object in VB. I can't figure out how that works in AutoIt. If I do figure this out, I will update. Edited April 28, 2011 by Discovery164 Link to comment Share on other sites More sharing options...
guinness Posted April 28, 2011 Share Posted April 28, 2011 Thanks, Spammer.It's kor! 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...
Discovery164 Posted April 28, 2011 Author Share Posted April 28, 2011 Ouch! My bad. Link to comment Share on other sites More sharing options...
kor Posted May 2, 2011 Share Posted May 2, 2011 After looking at my script it doesn't do exactly what you're doing, but it's close. I use this function. #NoTrayIcon #include <Date.au3> _DeleteOlderThan("C:\test", 5) Func _DeleteOlderThan($sDirectory, $iDays) ; must include <Date.au3> Local $sWorking = FileChangeDir($sDirectory) ; change working directory Local $sDate = (@YEAR & "/" & @MON & "/" & @MDAY) ; set date, must use year month day format Local $hSearch = FileFindFirstFile("*") ; show all files in current directory If $hSearch = -1 Then Exit ; no files/directories matched the search pattern While 1 Local $hFiles = FileFindFirstFile($hSearch) If @error Then ExitLoop If $hFiles = "." Or $hFiles = ".." Then ContinueLoop ; block output of root and current directories Local $aFileDate = FileGetTime($hFiles, 0, 0) If Not @error Then $sFormatDate = $aFileDate[0] & "/" & $aFileDate[1] & "/" & $aFileDate[2] Local $sDateDiff = _DateDiff("D", $sFormatDate, $sDate) If $sDateDiff > $iDays Then DirRemove($hFiles, 1) WEnd FileClose($hSearch) EndFunc ;==>_DeleteOlderThan 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