Defrag Tool!

Discussion in 'Windows Desktop Systems' started by chaos945, Aug 13, 2004.

  1. chaos945

    chaos945 Moderator

    Messages:
    934
    I was fooling around today and decided I needed to make an application that had a progress bar. So after fiddling with a few ideas I started to make a new defrag tool to replace my aging batch files.

    I came up with this simple tool that detects all FIXED drives then uses the windows defragmenter to defragment them, with a progress bar of course. After the tool is finished defragmenting it then utilizes the 'ProcessIdleTasks' command, which then re-arranges files on the disk to match the exact order they are loaded during startup. This list is in %systemroot%\Prefetch\Layout.ini.

    Anyone get errors please post them.

    Enjoy!

    /Revision
    I've added the actual progress values rounded to the nearest whole number as they go by.

    *see latest post for new version*
     
  2. Perris Calderon

    Perris Calderon Moderator Staff Member Political User

    Messages:
    12,332
    Location:
    new york
    that looks pretty good chaos.

    I'm using an after market defrag, but I can't wiat to see what people that try this think
     
  3. Maveric169

    Maveric169 The Voices Talk to Me

    Messages:
    1,148
    Location:
    Elkhart, IN
    I am trying it out right now for ya, I will update this post with my results.

    Update: Well, the progress bar really didn't do much other than show a percentage of the process as a whole. It stayed at 0% till it was done with C:, then jumped to 58% when it worked on D:, so on and so forth. Not bad if that was what you intended it to do. I use DK and it runs nightly so my system never really gets fraged.

    ohhh the only slightly annyoing part was that you can't minimize the status bar to your tray (IE like when your DL'ing something you can see the percentage in the taskbar as it is DL'ing.), having it on top while trying to do other things just a bit of a pain.

    But overall, very nice.
     
  4. chaos945

    chaos945 Moderator

    Messages:
    934
    Thanks for trying it out!

    I modified the MsgBox so that it does not stay on top.

    The progress bar determines the overall percentage based on the number of drives you have on the computer, I'm working on a new formula for it so it takes the size of each drive, the total number of drives, then based on the average time it takes to defragment x.x mb of space determine a new percentage.

    This is the only way I could think of doing it, anyone with other ideas please post them.

    Code:
    Old Formula
    ( ( $i - 1 ) * 100 ) / $var[0]
    $i current drive
    $var[0] total number of drives
    $1 - 1 because the progress needs to start at 0% not at the finished % of the current drive
    I ended up with this nifty Drive Info tool while testing out how to make the new forumla. This tool finds the free/total/label/type of drives on your computer and displays it all.
    • Esc to Exit
    • Page Down for next drive
    • Page Up to go back
    Anyone with some good ideas on what to add to the Drive Info tool?


    Enjoy!

    *link removed: see below*
    Download Part 1
    Download Part 2
     
    Last edited: Apr 25, 2005
  5. Maveric169

    Maveric169 The Voices Talk to Me

    Messages:
    1,148
    Location:
    Elkhart, IN
    I will test the new bar for ya, and will update this post

    oooops, I need to learn to read post a little more carefully, you said you are "working on" a new formula, sorry I am just illiterate..................
     
  6. chaos945

    chaos945 Moderator

    Messages:
    934
    Well I modified the way the progress bar works; it is more accurate now and will determine progress based on drive sizes instead of the number of drives.

    I tried to get it to sub-calculate values for each drive based on the time it takes to defrag x.x MB and the total size of the drive but it was more difficult than I expected, perhaps later I will add an Estimated Time Remaining: counter as well.

    *link removed: see below*
    Download Part 1
    Download Part 2
     
    Last edited: Apr 25, 2005
  7. Maveric169

    Maveric169 The Voices Talk to Me

    Messages:
    1,148
    Location:
    Elkhart, IN
    Good work though, it is a neat little program.
     
  8. Hipster Doofus

    Hipster Doofus Good grief Charlie Brown

    Messages:
    5,920
    Location:
    Melbourne Australia
    Any way of getting to choose which drives to defrag?

    And the same with drive info? Also what about a different colour other than white in the bar?
     
  9. chaos945

    chaos945 Moderator

    Messages:
    934
    I could make it so that either program gets its config info from an INI file, this would allow customization.

    The colours are based on the system's current style/theme setup, mine is blue. I'm sure its possible to force a colour or allow something like a hex change via an INI file, I'll look into it and post back if I'm able to do it. I'm using AutoIt as a scripting language so its pretty limited unless its ported out.