am632 Posted March 14, 2011 Share Posted March 14, 2011 Hi, I have an imputbox which when you click the browse buton you can choose a directory - then when you click ok, the inputbox is automatically updated with the directory you chose which works fine, but id like to display a lable of the freespace of that folder in MB. I think i need to do this using drivespacefree but im not sure exactly what i need to do, can anyone help please? thanks Link to comment Share on other sites More sharing options...
JohnOne Posted March 15, 2011 Share Posted March 15, 2011 (edited) $folder = FileSelectFolder("Choose a folder.", "") MsgBox(0,"",$folder) $space = DriveSpaceFree( StringLeft($folder,3) ) MsgBox(4096, "Free space on " & StringLeft($folder,3) , $space & "MB") Edited code Edited March 15, 2011 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
am632 Posted March 15, 2011 Author Share Posted March 15, 2011 (edited) Hi, thanks for the reply - works gr8. Just 1 question, how do I round it so there isnt a long decimal? thanks EDIT: I changed the line of code to read $SPACEDETECTEDRESULT = GUICtrlCreateLabel($FREESPACEONDRIVE /1024 & " GB", 220, 400, 170, 22) which works and displays the correct number 134 in my case, but there are loads of numbers behind the decimal point. how can i get rid of them? thanks Edited March 15, 2011 by am632 Link to comment Share on other sites More sharing options...
JohnOne Posted March 15, 2011 Share Posted March 15, 2011 $SPACEDETECTEDRESULT = GUICtrlCreateLabel(Floor($FREESPACEONDRIVE /1024) & " GB", 220, 400, 170, 22) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
am632 Posted March 15, 2011 Author Share Posted March 15, 2011 Thanks a lot, I appreciate your help Link to comment Share on other sites More sharing options...
JohnOne Posted March 15, 2011 Share Posted March 15, 2011 If you want there to be decimal places, use Round($FREESPACEONDRIVE /1024, 2) ; 2 meaning 2 decimal places. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Grangato Posted March 31, 2011 Share Posted March 31, 2011 If you want there to be decimal places, use Round($FREESPACEONDRIVE /1024, 2) ; 2 meaning 2 decimal places.What would be the final full code? Link to comment Share on other sites More sharing options...
hannes08 Posted March 31, 2011 Share Posted March 31, 2011 $folder = FileSelectFolder("Choose a folder.", "") MsgBox(0,"",$folder) $space = Round(DriveSpaceFree( StringLeft($folder,3) ) / 1024, 2) MsgBox(4096, "Free space on " & StringLeft($folder,3) , $space & "MB") Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now