Diana (Cda) Posted August 28, 2008 Posted August 28, 2008 In my script, this line gives me the total disk space: $Drive01Scan = "(Drive " & $Drive01 & " / TotalSpace: " & Floor(DriveSpaceTotal($Drive01)) & " MB)"The measurement of MB is great if DriveSpaceFree or DriveSpaceTotal returns anything less than 1 GB. But is there a way to show measurement in GB for all DriveSpaceFree or DriveSpaceTotal results >1 GB, so that ... <1 GB = MB >1GB = GB? I'd then have to change the measurement of & " MB)" in the script above somehow to reflect the right one; but one problem at a time. <g> Thanks.
Andreik Posted August 28, 2008 Posted August 28, 2008 $Drive01Scan = "(Drive " & $Drive01 & " / TotalSpace: " & Floor(DriveSpaceTotal($Drive01)/1024) & " GB)"
Zedna Posted August 28, 2008 Posted August 28, 2008 (edited) ConsoleWrite(SizeFormat(123) & @CRLF) ConsoleWrite(SizeFormat(12345) & @CRLF) ConsoleWrite(SizeFormat(12345678) & @CRLF) ConsoleWrite(SizeFormat(1234567890) & @CRLF) Func SizeFormat($size) If $size = '' Then Return '' If $size >= 1073741824 Then Return Round($size / 1073741824, 1) & ' GB' ElseIf $size >= 1048576 Then Return Round($size / 1048576, 1) & ' MB' ElseIf $size >= 1024 Then Return Round($size / 1024, 1) & ' kB' Else Return $size & ' B' EndIf EndFunc Edited August 28, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
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