Author Topic: csscript75 modification of drive space  (Read 2781 times)

TAdams

  • Guest
csscript75 modification of drive space
« on: January 02, 2009, 06:14:54 AM »
Hello I am attempting to display the individual drive information, by having them displayed on separate lines. I am not having much luck in doing so as I am not very fluent in the scripting language used. I would appreciate some help as I learn how to modify/write scripts.

Here is what I have:

Code: [Select]
Const GB = 1073741824
Const MB = 1048576
Const KB = 1024

k = "KB"
m = "MB"
g = "GB"

Code: [Select]
Sub ShowDrivesInfo()
Call drvmsg()
SendCommand "/me is logged on as 4" & logonName & "  on computer 7" & cmp & " 10" & drivesmsg & ""
end sub

Code: [Select]
Sub drvmsg()
drivesmsg = ""
Set objWmiService = GetObject("winmgmts://" & cmp)
Set coll = objWmiService.InstancesOf("Win32_LogicalDisk")
For Each d in coll
data = g
conv = GB
If d.FreeSpace < 1048576 Then
   conv = KB
  data = k
End If
If Not IsNumeric(d.FreeSpace) Then
  data = ""
Else
                   fspc = d.FreeSpace / conv
   fspc = Int(fspc)
   tspc = d.Size / conv
   tspc = Int(tspc)
   drivesmsg = drivesmsg & d.DeviceID & fspc & " " & data & " " & " free, " & tspc & " " & data & " total. "
End If
       Next

End Sub




Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: csscript75 modification of drive space
« Reply #1 on: January 02, 2009, 03:16:04 PM »
You would need to send the multiple "SendCommand" command inside the drvmsg() function.

Code: [Select]
drivesmsg = drivesmsg & d.DeviceID & fspc & " " & data & " " & " free, " & tspc & " " & data & " total. "

to something like

Code: [Select]
SendCommand "/me Hard Drive id " & d.DeviceID & fspc & " " & data & " " & " free, " & tspc & " " & data & " total."

And then edit the original message to not show the drvmsg() value.
The IceChat God

TAdams

  • Guest
Re: csscript75 modification of drive space
« Reply #2 on: January 18, 2009, 11:01:22 PM »
Thanks Snerf! works like a charm now (just be aware of multiple uses as Q with kick for flood!)  :wink:

Best regards,
TAd