Drive Space: Difference between revisions

From AutoIt Wiki
Jump to navigation Jump to search
(delete hidden link spam)
 
m (BrokenLinks: Samples, ...)
 
Line 1: Line 1:
Back to [[Samples]]
[[Category:Samples]]
Back to [[:Category:Samples|Samples]]<!-- look at possible separate samples page -->


'''Illustrates:'''
'''Illustrates:'''
Line 5: Line 6:
* Cheeky way of displaying a bar-chart.
* Cheeky way of displaying a bar-chart.


<syntaxhighlight lang="autoit">
     $sBar = "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
     $sBar = "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
     ;... in the absence of a StringRepeat("|",100)  ;o)
     ;... in the absence of a StringRepeat("|",100)  ;o)
Line 25: Line 27:
      
      
     Msgbox (0,"Free Space (NETWORK)",$sOut)
     Msgbox (0,"Free Space (NETWORK)",$sOut)
 
</syntaxhighlight>
 
[[Category:Samples]]

Latest revision as of 13:34, 17 November 2012

Back to Samples

Illustrates:

  • Cheeky way of displaying a bar-chart.
    $sBar = "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
    ;... in the absence of a StringRepeat("|",100)  ;o)
    $sOut = $sBar & " = 100% Capacity Baseline" & @LF
    ProgressOn("Scanning drives", "", "")
    
    $aNetDrives = DriveGetDrive( "NETWORK" )
    For $nDrv = 1 to $aNetDrives[0]
        $sDrv = StringUpper($aNetDrives[$nDrv])
        ProgressSet(100* $nDrv/$aNetDrives[0], $sDrv & " (" & $nDrv & " of " & $aNetDrives[0] & ")")
        sleep(10)
        $nSpaceFree = DriveSpaceFree($sDrv)
        $nSpaceTotal = DriveSpaceTotal($sDrv)
        $nPct = 100 * $nSpaceFree / $nSpaceTotal
        $sOut = $sOut & $sDrv & " (Free=" & StringFormat("%.2fMb",$nSpaceFree) & "; Total=" & StringFormat("%.2fMb",$nSpaceTotal) & ")" & @LF
        $sOut = $sOut & StringLeft($sBar, $nPct) & " = " & "(" & StringFormat("%.2f",$nPct) & "%)" & @LF
    Next
    
    ProgressOff()
    
    Msgbox (0,"Free Space (NETWORK)",$sOut)