Jump to content

Recommended Posts

Posted

OK, good thing i do this anyway, i usually have a directory called bacups with the scripts that i am working on. I created the following "Monster" to allow me to choose between Windows XP and Windows 2K for deleting some java files, temp files, etc.....

It kind of wiped out the script i was working on :o and didn't even bother to delete the file i wanted? Can someone please enlighten me as to where i stuffed up? I need about 3 things wiped per OS, and under the standard user's login. I have trolled through the forums and added this out of many great scripts.

#Include <process.au3>
#include <GuiConstants.au3>

; Set the RunAs parameters to use local adminstrator account
RunAsSet("Administrator", @ComputerName, "mypassword")

; Creating GUI, for prettiness.
If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
GUICreate("Cache Cleaner", 259, 180, (@DesktopWidth - 259) / 2, (@DesktopHeight - 180) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
GUICtrlCreateGroup("Choose Operating System", 10, 40, 180, 80)
$osxp = GUICtrlCreateRadio("Windows XP", 20, 60, 150, 20)
$os2k = GUICtrlCreateRadio("Windows 2000", 20, 80, 150, 20)

; Default Windows XP is checked.
GUICtrlSetState($osxp, $GUI_CHECKED)

$apply = GUICtrlCreateButton("Clean", 40, 130, 80, 20)
$exit = GUICtrlCreateButton("Exit", 140, 130, 80, 20)

$status = GUICtrlCreateLabel("Ready", 5, 150, 40, 15)
$by = GUICtrlCreateLabel("** V0.1 ** 31/01/2006 - By:KegRaider", 55, 150, 200, 15)
GUICtrlSetState($by, $GUI_DISABLE)
GUICtrlSetData($status, "Ready")

While 1
    $msg = GUIGetMsg()
Select
Case $msg = $apply
            GUICtrlSetData($status, "Working...")
            If GUICtrlRead($osxp) = 1 Then _RunDOS("del /F /Q c:\windows\java\com\document\components\data\datafile """)
            ;_RunDOS("del /F /Q c:\windows\Downloaded Program Files\*.* """ )
                
            ;_RunDOS("rmdir /s /q %temp% """)
            If GUICtrlRead($os2k) = 1 Then _RunDOS("del /y C:\winnt\Downloaded Program Files\*.* """ )
                
                                
            GUICtrlSetData($status, "Ready")
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $exit
            ExitLoop
        Case Else
    EndSelect
WEnd

; Reset user password as before.
RunAsSet()

Can i safely run _RunDOS under my other rundos, or do i have to create another if guictrlread section?

Thanks,

Troy.

Posted

Hey,

Just trolled through the help file some more.....heaven forbit "RTFM"...lol

FileDelete does everything that i wanted anyway. It's just hard to break old habbits, old MS-DOS batch writer from way back!

If GUICtrlRead($osxp) = 1 Then FileDelete("c:\Program Files\Documen\jre\142_04\com\document\components\data\datafile")
FileDelete("c:\windows\Downloaded Program Files\*.*")

works a treat.

Oh well, thanks for reading at least :o

Troy.

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...