AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Free Space] Slick tool to know each drive's free space

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Eleria



Joined: 09 May 2006
Posts: 90

PostPosted: Fri Jul 14, 2006 8:49 pm    Post subject: [Free Space] Slick tool to know each drive's free space Reply with quote

Hello once more folks ^_^
Today i am sharing one of my lil' tool.
Actually its the one i used the most. (almost 1000 times a day)
And when i was relooking it today, i thought that maybe someone would like to use it aswell Surprised

It's not a kick ass script, like you would see at lazlo's or titan's T_T .... but anyway, im quite proud of it as there wasn't anyone who posted something similar before.

The gui is adaptative, which means depending on how many drives you got, and the size on it, the aligement will still be good, and hopefully the gui will not be messy (Still, if there are bugs report them!).

And yes, there are no useless pixel, everything was calculated just to be slick... using a magnifier proggy to be sure of it x_x

CTRL+SHIFT+S => show the gui.... that's all you need to know...

This tool is made for use with programming fonts (single spaced), or the alignements will be really messy Razz
You can change it in the script.
My favourite : S8 Dina ^^"

Download Dina Font

So, here we are :
Code:

#SingleInstance Force
SetBatchLines, -1
SetFormat, float, 5.1

Menu, Tray, Add, Exit
Menu, Tray, Tip, Free Space
Menu, Tray, Nostandard
Return

GuiEscape:
Default:
^+s::
If Toggle
{
   Gui, Destroy
   Toggle--
}
Else
{
   Gosub, Get_List
   Gosub, Gui_Create
   Gui, Show, w178 h%Height%, Free Space
   WinSet, Region, % "0-8 3-6 9-6 9-1 64-1 64-6 176-6 178-8 178-"Height-4 " 175-"Height " 2-"Height " 0-"Height-4, Free Space
   Toggle++
}
Return

Get_List:
DrvNum = 0
DriveGet, FD_List, List, Fixed
Loop Parse, FD_List
{
   
   Spaces := "       "
   DriveGet, Cap_%A_LoopField%, Cap, %A_LoopField%:\
   DriveSpaceFree, Free_Space, %A_LoopField%:\    ;Get the free space in each drive
   Percent_Free :=  Free_Space / (Cap_%A_LoopField%) * 100
   If (Free_Space > 1000)
   {
      SetFormat, Float, 0.3
      Free_Space = %Free_Space%.0            ;Treat free space like a float
      Free_Space /= 1000
      Unit = Go
      StringTrimRight, Spaces, Spaces, % (Strlen(Free_Space) - 1)   ;Reduce the number of spaces
   }
   Else
   {
      StringTrimRight, Spaces, Spaces, %  (Strlen(Free_Space) - 1)
      Unit = Mo
   }
   SetFormat, float, 5.1
   Result := (Result . A_LoopField ":\" Spaces . Free_Space " " Unit " [" Percent_Free "%] `n") ;Create the list
   DrvNum++                        ;Count drives
}

StringTrimRight, Result, Result, 1    ;Delete the tailing linefeed char
Return

Gui_Create:
Height := 17+12*DrvNum          ;Height depends on how many drives are present
Gui, Margin, x0, y0
Gui, Add, GroupBox, x0 y0 w178 h%Height%, Free Space
Gui, -Caption +AlwaysOnTop +ToolWindow
Gui, Font, s8, Dina
Gui, Add, Text, xp+9 yp+13, %Result%
Result =             ;Frees the result list
Return

Exit:
ExitApp


Please feel free to add any comments.




Updates : Fixed bug with number format and unit.
_________________


Looking for a game/anime ost?


Last edited by Eleria on Sat Jul 15, 2006 10:25 am; edited 7 times in total
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4710
Location: Boulder, CO

PostPosted: Fri Jul 14, 2006 9:03 pm    Post subject: Reply with quote

Neat! If you need it so often, have you considered putting it in the taskbar, or over the start button and update the data regularly?
Back to top
View user's profile Send private message
Eleria



Joined: 09 May 2006
Posts: 90

PostPosted: Fri Jul 14, 2006 9:14 pm    Post subject: Reply with quote

"Its useless to update it from time to time , using processor cycles for about nothing.. just hit ctrl+shift+s when you want to know about your free space, and it will re calculate the date in no time Razz..... "
Thats what i came up with ^^"

You can say i am some kind of minimalistic and i like using my keyboard to activate stuff, so the timer thing is not an option... for me ...

But if someone want it that way... just go ahead and modify it ... ^_^
_________________


Looking for a game/anime ost?
Back to top
View user's profile Send private message
Eleria



Joined: 09 May 2006
Posts: 90

PostPosted: Sat Jul 15, 2006 9:06 am    Post subject: Reply with quote

Now it shows the free space in percentage of the total volume size to the right side ^_^, updated code consequently...
_________________


Looking for a game/anime ost?
Back to top
View user's profile Send private message
Julien
Guest





PostPosted: Fri Apr 23, 2010 5:04 pm    Post subject: Up ! Reply with quote

Seems like you should not have too many disks, as the windows does not expand itself.
But useful anyway.
Back to top
rataplan



Joined: 23 Jan 2010
Posts: 6

PostPosted: Wed Apr 28, 2010 9:45 am    Post subject: Reply with quote

Code:
Height := 25+12*DrvNum

in Gui_Create 25 in stead of 17 seems better to me.
I also got rid of Fixed
Code:
DriveGet, FD_List, List,Fixed

in Get_List so that removable devices would be recognized too
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group