Sign in to follow this  
Followers 0
iHonda

Disklean

10 posts in this topic

Yey I finally finished making DisKlean more then just a notepad document. I'm going to be using this thread as a place to release all feature versions of DisKlean

Download DisKlean v.2 http://www.autoitscript.com/fileman/users/Zmaster/DisKlean/DisKlean%20v.2.exe

heres the script if u want that

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:        Zmaster <zmaster.atf@gmail.com>
;
; Script Function:
;   Clean your comp
;
; ----------------------------------------------------------------------------

; Script Start - Add your code below here

#region --- GuiBuilder code Start ---


#NoTrayIcon
#include <GuiConstants.au3>

GuiCreate("DisKlean By: Zmaster", 381, 200,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$start = GuiCtrlCreateButton("START", 10, 10, 80, 30)
$cclean = GuiCtrlCreateButton("GET Cclean", 10, 40, 80, 30)
$hlp = GuiCtrlCreateButton("HELP", 10, 70, 80, 30)
$exit = GuiCtrlCreateButton("EXIT", 10, 100, 80, 30)
$Label_5 = GuiCtrlCreateLabel("Thank you for chosing DisKlean. Please refer to the Help file if you need help. Install Ccleaner first!", 100, 10, 280, 30)
$edit_box = GuiCtrlCreateEdit("", 100, 50, 270, 147)

GuiSetState()
HotKeySet("{ESC}", "bugout")
While 1
    $msg = GuiGetMsg()
    Select
        
    Case $msg = $start
        Send("{TAB}")
        Send("{TAB}")
        Send("{TAB}")
        Send("{TAB}")
        Send("~~DisKlean By: Zmaster~~{ENTER} Please wait while the program loads{enter}")
        Send("Thank you for chosing DisKlean. This program is{enter} free to use. I recomend using this program at least{enter}  twice a month. This box will soon display{enter} instructions for you to follow.")
        Send("{enter}")
        Send("{enter}")
        Send("~~INSTRUCTIONS~~{ENTER}")
        Send("{ENTER}1. Wait for the Disk Clean for C: window opens once{enter} open select the following items:{enter}")
        Send("{Enter}a)Downloaded Program Files{enter}")
        Send("b)Temporary Internet Files{enter}")
        Send("c)Recycle Bin{enter}")
        Send("d)Temporary files{enter}")
        Send("e)WebClient/Publisher Temporary Files{enter}")
        Send("f)Compress old files{enter}")
        Send("{enter}2. Now press the OK button in the bottom left corner,{enter} then click the YES button in the new window{enter}")
        Run("cleanmgr.exe")
        WinWaitActive("Disk Cleanup for  (C:)")
        WinWaitClose("Disk Cleanup")
        Sleep(400)
        GUISetState(@SW_HIDE)
        ToolTip("Now starting Ccleaner. This part of the process is fully automated, all you need to do is press the ESC key when Ccleaner is done.", 452, 55)
        Sleep(500)
        ToolTip("Ccleaner now loading. Please wait...", 452, 55)
        Sleep(300)
        Run("C:\Program Files\CCleaner\ccleaner.exe")
        ToolTip("When Ccleaner finishs please press the ESC key on your keyboard", 452, 55)
        Sleep(300)
        WinWaitActive("CCleaner")
        Send("{TAB}")
        Sleep(100)
        Send("{TAB}")
        Sleep(100)
        Send("{TAB}")
        Sleep(100)
        Send("{TAB}")
        Sleep(100)
        Send("{TAB}")
        Sleep(100)
        Send("{ENTER}")
        Sleep(100)
        ToolTip("When Ccleaner finishs please press the ESC key on your keyboard", 452, 55)
        
    Case $msg = $hlp
        Run(@ProgramFilesDir & '\internet explorer\iexplore.exe http://zmastersdisklcleanhelpfilesfornoonetofinde.50webs.com/')
        
    Case $msg = $cclean
        Run(@ProgramFilesDir & '\internet explorer\iexplore.exe http://www.filehippo.com/download/fa9100fcf77113373783042ee6842092/download/')
        
    Case $msg = $exit
        MsgBox(64, "DisKlean", "Run this program again in 14 days.", 10)
        ExitLoop
    Case $msg = $GUI_EVENT_CLOSE
        MsgBox(64, "DisKlean", "Run this program again in 14 days.")
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd

Func bugout()
    MsgBox(64, "DisKlean", "Run this program again in 14-21 days.", 5)
    sleep(300)
    WinClose("CCleaner")
    Exit
EndFunc

Exit
#endregion --- GuiBuilder generated code End ---

p.s. also just in case something goes wrong and the program starts acting funny i put in an emergency hotkey to stop the script. the hot key is the ESC key


A great place to start Autoit 1-2-3

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I hope it's only for your personal use

edit :

what happens if the ccleaner is not in program files ?

what happens if the ccleaner lost focus .. where do you send

all the >> Send("{TAB}") ?

Edited by Lapo

Share this post


Link to post
Share on other sites

Yey I finally finished making DisKlean more then just a notepad document. I'm going to be using this thread as a place to release all feature versions of DisKlean

Download DisKlean v.2 http://www.autoitscript.com/fileman/users/Zmaster/DisKlean/DisKlean%20v.2.exe

heres the script if u want that

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:        Zmaster <zmaster.atf@gmail.com>
;
; Script Function:
;   Clean your comp
;
; ----------------------------------------------------------------------------

; Script Start - Add your code below here

#region --- GuiBuilder code Start ---
#NoTrayIcon
#include <GuiConstants.au3>

GuiCreate("DisKlean By: Zmaster", 381, 200,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$start = GuiCtrlCreateButton("START", 10, 10, 80, 30)
$cclean = GuiCtrlCreateButton("GET Cclean", 10, 40, 80, 30)
$hlp = GuiCtrlCreateButton("HELP", 10, 70, 80, 30)
$exit = GuiCtrlCreateButton("EXIT", 10, 100, 80, 30)
$Label_5 = GuiCtrlCreateLabel("Thank you for chosing DisKlean. Please refer to the Help file if you need help. Install Ccleaner first!", 100, 10, 280, 30)
$edit_box = GuiCtrlCreateEdit("", 100, 50, 270, 147)

GuiSetState()
HotKeySet("{ESC}", "bugout")
While 1
    $msg = GuiGetMsg()
    Select
        
    Case $msg = $start
        Send("{TAB}")
        Send("{TAB}")
        Send("{TAB}")
        Send("{TAB}")
        Send("~~DisKlean By: Zmaster~~{ENTER} Please wait while the program loads{enter}")
        Send("Thank you for chosing DisKlean. This program is{enter} free to use. I recomend using this program at least{enter}  twice a month. This box will soon display{enter} instructions for you to follow.")
        Send("{enter}")
        Send("{enter}")
        Send("~~INSTRUCTIONS~~{ENTER}")
        Send("{ENTER}1. Wait for the Disk Clean for C: window opens once{enter} open select the following items:{enter}")
        Send("{Enter}a)Downloaded Program Files{enter}")
        Send("b)Temporary Internet Files{enter}")
        Send("c)Recycle Bin{enter}")
        Send("d)Temporary files{enter}")
        Send("e)WebClient/Publisher Temporary Files{enter}")
        Send("f)Compress old files{enter}")
        Send("{enter}2. Now press the OK button in the bottom left corner,{enter} then click the YES button in the new window{enter}")
        Run("cleanmgr.exe")
        WinWaitActive("Disk Cleanup for  (C:)")
        WinWaitClose("Disk Cleanup")
        Sleep(400)
        GUISetState(@SW_HIDE)
        ToolTip("Now starting Ccleaner. This part of the process is fully automated, all you need to do is press the ESC key when Ccleaner is done.", 452, 55)
        Sleep(500)
        ToolTip("Ccleaner now loading. Please wait...", 452, 55)
        Sleep(300)
        Run("C:\Program Files\CCleaner\ccleaner.exe")
        ToolTip("When Ccleaner finishs please press the ESC key on your keyboard", 452, 55)
        Sleep(300)
        WinWaitActive("CCleaner")
        Send("{TAB}")
        Sleep(100)
        Send("{TAB}")
        Sleep(100)
        Send("{TAB}")
        Sleep(100)
        Send("{TAB}")
        Sleep(100)
        Send("{TAB}")
        Sleep(100)
        Send("{ENTER}")
        Sleep(100)
        ToolTip("When Ccleaner finishs please press the ESC key on your keyboard", 452, 55)
        
    Case $msg = $hlp
        Run(@ProgramFilesDir & '\internet explorer\iexplore.exe http://zmastersdisklcleanhelpfilesfornoonetofinde.50webs.com/')
        
    Case $msg = $cclean
        Run(@ProgramFilesDir & '\internet explorer\iexplore.exe http://www.filehippo.com/download/fa9100fcf77113373783042ee6842092/download/')
        
    Case $msg = $exit
        MsgBox(64, "DisKlean", "Run this program again in 14 days.", 10)
        ExitLoop
    Case $msg = $GUI_EVENT_CLOSE
        MsgBox(64, "DisKlean", "Run this program again in 14 days.")
        ExitLoop
    Case Else
;;;
    EndSelect
WEnd

Func bugout()
    MsgBox(64, "DisKlean", "Run this program again in 14-21 days.", 5)
    sleep(300)
    WinClose("CCleaner")
    Exit
EndFunc

Exit
#endregion --- GuiBuilder generated code End ---

p.s. also just in case something goes wrong and the program starts acting funny i put in an emergency hotkey to stop the script. the hot key is the ESC key

have you ever thought of guictrlsetdata instead of tabbing to your edit-control?

this whole send... send... send... is making me crazy

Share this post


Link to post
Share on other sites

have you ever thought of guictrlsetdata instead of tabbing to your edit-control?

this whole send... send... send... is making me crazy

lol, yeah, cool idea

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

hmm ya that would be a good idea i didnt think of that well this is still a work in progress but thanx guys


A great place to start Autoit 1-2-3

Share this post


Link to post
Share on other sites

Can't say much about the program, but I can say you're comming along!! Even though there are obvious improvement areas (ie... Nuffs suggestion), you obviously are taking some time to try and learn!


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

hmm ya that would be a good idea i didnt think of that well this is still a work in progress but thanx guys

I use this .. give it a try :

Run("C:\PROGRA~1\CCLEANER\CCLEANER.EXE")

   AutoItSetOption("WinTitleMatchMode", 4)

    WinWaitActive( "CCleaner", "", 5 )
  ControlFocus ( "CCleaner","" , "ThunderRT6CommandButton1" )
 ControlClick ( "CCleaner", "" , "ThunderRT6CommandButton1","left" )
 sleep(1500)
$a =ControlCommand ( "CCleaner", "", "ThunderRT6CommandButton2","IsEnabled", "" )

while $a = 0
 sleep(500)
$a =ControlCommand ( "CCleaner", "", "ThunderRT6CommandButton2","IsEnabled", "" )
Wend
; MsgBox(0, $a, $a)

 sleep(1000)
$text = WinGetText("CCleaner", "")

$temp1 ="c:\windows\temp\tmp.tmp" 

$file = FileOpen($temp1, 1)
; Check if file opened for writing OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
FileWrite($file, $text & @CRLF)

FileClose($file)

$file = FileOpen("c:\windows\temp\tmp.tmp", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

$line = FileReadLine($file,5)

FileClose($file)

If $line = "0 bytes to be removed. (Approximate size)" Then

   MsgBox(0, "0 bytes","")
FileDelete("c:\windows\temp\tmp.tmp")

exit
else
 sleep(500)
  ControlFocus ( "CCleaner","" , "ThunderRT6CommandButton2" )
 ControlClick ( "CCleaner", "" , "ThunderRT6CommandButton2","left" )
 endif

EDIT:

endif missed

PS:

ControlClick ( "CCleaner", "" , "ThunderRT6CommandButton2","left" )

LEFT or RIGHT depends on your Mouse settings

workaround for this

Dim $primary
Dim $secondary
;Determine if user has swapped right and left mouse buttons
$k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")

; It's okay to NOT check the success of the RegRead operation
If $k = 1 Then
    $primary = "right"
    $secondary = "left"
Else;normal (also case if could not read registry key)
    $primary = "left"
    $secondary = "right"
EndIf
Edited by Lapo

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

hey, i was overlooking this thing, it is pretty neat. :)

[nevermind]

Edited by slightly_abnormal

Share this post


Link to post
Share on other sites

Welcome to AutoIT Forums ZMaster

I don't know if you were aware of the fact that CleanMgr has switches: /SageSet:xxx and /SageRun:xxx. The "xxx" must be the same number, e.g. /SageSet:777. I chose the ...777; there is nothing special about the number.

To setup a permanent settings use "CleanMgr /SageSet:777".

To execute CleanMgr with the saved settings "CleanMgr /SageRun:777".

Here's the code I've been running on 3,000+ workstations and several servers.

;FileName:  SystemClean.exe
If $CmdLine[0] = 1 Then
   RunWait("CleanMgr /sageset:777")
EndIf
RunWait("CleanMgr /sagerun:777")

You can use a scheduler to execute CleanMgr by specifying "SystemClean" or

You can setup CleanMgr by running "SystemClean Setup". After setup, it will execute it with your settings.

Again, welcome to AutoIT.

Share this post


Link to post
Share on other sites

about the numbers thanx for letting me kno i had no clue about that. and about all the other problems in the script thank you im learning it slowly ill eventually get it good.


A great place to start Autoit 1-2-3

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