Jump to content
Sign in to follow this  

DirGetSize and display a graphical image

Recommended Posts



Sorry for my english but i don't speak well english :)

I would like to know if there's a way to create a small rectangular graphical image (bmp or jpeg, or another format) which show in a visual image the size of a directory (there's a limit of storage, 20mo, and i would like to display a graphical image in pourcentage used/permitted) ?

How can i do that ?


Edited by bonjour

Share this post

Link to post
Share on other sites


Bienvenu to the Autoit forums.

Have a look at this:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

GUICreate("", 200,250)

$iDriveSize = DriveSpaceTotal( "c:\" )
$iDriveFree = DriveSpaceFree( "c:\" )

$iDriveFreewidth = Int($iDriveFree / $iDriveSize * 180)

    GUICtrlSetBkColor(-1, 0xff0000)
GUICtrlCreateLabel("", 190 - $iDriveFreewidth, 10, $iDriveFreewidth, 40)
    GUICtrlSetBkColor(-1, 0x00ff00)

$iUsed_PerCent = 100 * ($iDriveSize - $iDriveFree) / $iDriveSize

GUICtrlCreateProgress(10, 80, 180, 20)
    GUICtrlSetData(-1 , $iUsed_PerCent)

$iUsed_Angle = 360 * ($iDriveSize - $iDriveFree) / $iDriveSize

GUICtrlCreateGraphic(50, 120, 100, 100)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0x00ff00)
        GUICtrlSetGraphic(-1, $GUI_GR_PIE, 50, 50, 50, 0, 360)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0xff0000)
        GUICtrlSetGraphic(-1, $GUI_GR_PIE, 50, 50, 50, 0, $iUsed_Angle)


While 1

    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit


That should give you some ideas of how to do what you want!


P.S. Avec un surnom comme ca, il y a une site francais a www.autoitscript.fr si tu prefere utiliser ta langue maternelle. Mais ton anglais suffit largement si tu veux rester ici!

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


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