jslegers Posted December 14, 2011 Posted December 14, 2011 Hello, I'm using this script at a customer of mine to cleanup locale user profiles : Const LocalDocumentsFolder = "C:\Documents and Settings\" set objFSO = createobject("Scripting.FileSystemObject") set objFolder = objFSO.GetFolder(localdocumentsfolder) on error resume next for each fldr in objFolder.SubFolders if not isexception(fldr.name) then objFSO.DeleteFolder fldr.path, True end if next Function isException(byval foldername) select case foldername case "All Users" isException = True case "Default User" isException = True case "LocalService" isException = True case "NetworkService" isException = True case "Administrator" isException = True case "Nood" isException = True case Else isException = False End Select End Function Is there an Autoit version for this. Would be nice if the exceptions could be set in a ini file. John
JohnOne Posted December 14, 2011 Posted December 14, 2011 Without knowing VB script, it does not look to hard to recreate I'll start you off... Global Const $LocalDocumentsFolder = "C:Documents and Settings" $objFSO = ObjCreate("Scripting.FileSystemObject") If Not IsObj ($objFSO) Then MsgBox(0,"","Error") Exit EndIf AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
somdcomputerguy Posted December 14, 2011 Posted December 14, 2011 I don't know VB script either, but perhaps the IsException function could be rewritten like this Func _$isException($foldername) Switch $foldername Case "All Users" $isException = True Case "Default User" $isException = True Case "LocalService" $isException = True Case "NetworkService" $isException = True Case "Administrator" $isException = True Case "Nood" $isException = True Case Else $isException = False EndSwitch EndFunc - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
JohnOne Posted December 14, 2011 Posted December 14, 2011 You might want to add "Return $isException" after "EndSwitch" in the function AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Blue_Drache Posted December 14, 2011 Posted December 14, 2011 that original VB script looks like a recursive nightmare ... and won't do anything but eat memory. Why are you calling your function ... inside the function? Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
spudw2k Posted December 14, 2011 Posted December 14, 2011 (edited) that original VB script looks like a recursive nightmare ... and won't do anything but eat memory. Why are you calling your function ... inside the function? Which function are you referring to? isException? That's how to return the function in vbscript. edit: msgbox isEven(7) msgbox isEven(10542348) Function isEven(varNum) if varNum mod 2 = 0 Then isEven = True else isEven = False end if End Function Edited December 14, 2011 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
Blue_Drache Posted December 14, 2011 Posted December 14, 2011 *facepalm* Right ... it's been a while since I had to do anything with VB. Sorry about that. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
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