Glyph Posted October 30, 2008 Share Posted October 30, 2008 ;FileSystemObject (FSO) Working with Drives and Folders ;Converted from Javascript to AutoIt by Glyph ;Converted from http://msdn.microsoft.com/en-us/library/ch28h2s7(VS.85).aspx $Path = "c:" ShowDriveInfo($Path) func ShowDriveInfo($drvPath) Dim $fso, $drv, $s $fso = ObjCreate("Scripting.FileSystemObject") $drv = $fso.GetDrive($fso.GetDriveName($drvPath)) $s = "Drive " & $drvPath & " - " $s = $s & $drv.VolumeName & @crlf $s = $s & "Total Space: " & $drv.TotalSize / 1024 $s = $s & " Kb" & @crlf $s = $s & "Free Space: " & $drv.FreeSpace / 1024 $s = $s & " Kb" & @crlf msgbox(0,"",$s) Endfunc Original code: function ShowDriveInfo1(drvPath) { var fso, drv, s =""; fso = new ActiveXObject("Scripting.FileSystemObject"); drv = fso.GetDrive(fso.GetDriveName(drvPath)); s += "Drive " + drvPath.toUpperCase()+ " - "; s += drv.VolumeName + "<br>"; s += "Total Space: " + drv.TotalSize / 1024; s += " Kb" + "<br>"; s += "Free Space: " + drv.FreeSpace / 1024; s += " Kb" + "<br>"; Response.Write(s); } Just thought I would share, i'm getting into javascript now tolle indicium Link to comment Share on other sites More sharing options...
Pain Posted October 31, 2008 Share Posted October 31, 2008 Unfortunately AutoIt already have DriveSpaceFree() and DriveSpaceTotal() functions. Link to comment Share on other sites More sharing options...
jvanegmond Posted October 31, 2008 Share Posted October 31, 2008 I think this is a more accurate translation: func ShowDriveInfo($drvPath) Dim $fso, $drv, $s $fso = ObjCreate("Scripting.FileSystemObject") $drv = $fso.GetDrive($fso.GetDriveName($drvPath)) $s &= "Drive " & $drvPath & " - " $s &= $drv.VolumeName & @crlf $s &="Total Space: " & $drv.TotalSize / 1024 $s &=" Kb" & @crlf $s &= "Free Space: " & $drv.FreeSpace / 1024 $s &= " Kb" & @crlf msgbox(0,"",$s) Endfunc github.com/jvanegmond Link to comment Share on other sites More sharing options...
Glyph Posted November 2, 2008 Author Share Posted November 2, 2008 Unfortunately AutoIt already have DriveSpaceFree() and DriveSpaceTotal() functions.But then, you learn nothing. tolle indicium Link to comment Share on other sites More sharing options...
Pain Posted November 2, 2008 Share Posted November 2, 2008 Why make it more complicated than it has to be? Link to comment Share on other sites More sharing options...
Kip Posted November 2, 2008 Share Posted November 2, 2008 (edited) make it more complicated than it has to beSounds like a perfect C++ motto. Edited November 2, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Glyph Posted November 6, 2008 Author Share Posted November 6, 2008 Why make it more complicated than it has to be? Tell that to linux developers, it's similair because you're dictated by a command in autoit, you can control it more with WMI.This is only an example, there are many more WMI scripts that autoit simply does not have (yet?).For example, to detect a video card. I don't see a function in autoit for that, I see one in WMI though.And so we are clear, WMI can be used in many languages.With my example, a newbie can learn WMI and make his own script to detect video cards. tolle indicium Link to comment Share on other sites More sharing options...
Pain Posted November 6, 2008 Share Posted November 6, 2008 WMI is great and I use it from time to time, a great tool is the Scriptomatic tool for AutoIt. However as far as I can see your script doesn't use WMI, but another object so it would be more correct to say the example show how to use objects and how to add additional functions to AutoIt. Link to comment Share on other sites More sharing options...
Glyph Posted November 16, 2008 Author Share Posted November 16, 2008 WMI is great and I use it from time to time, a great tool is the Scriptomatic tool for AutoIt. However as far as I can see your script doesn't use WMI, but another object so it would be more correct to say the example show how to use objects and how to add additional functions to AutoIt.Agreed, I was thinking of my other script while I write that reply, lol.I was working on a script with a buddy of mine involving WMI and we got stuck on a couple things at the time, I was in the "WMI mindset". Scriptomatic is a very nice tool, easily adaptable to any script too! tolle indicium 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