I've been using this script made by A.J. Gyomber for monitoring drive space. It works very well except now I want to monitor my laptop as well. However, if the laptop isn't on, I'll get an error about path not found. I'm not sure where to add the IF statement and exit out the step if no network connection found.
Here's the codes:
<pre class="ip-ubbcode-code-pre">Sub Main()
GetSpace "C:", "t8"
GetSpace "\\pic_frame\c$", "t9"
End Sub
Sub GetSpace(byref DrivePath, byref DeviceCode)
Dim fso, drv, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set drv = fso.GetDrive(fso.GetDriveName(DrivePath))
s = FormatNumber(drv.TotalSize / 1073741824, 2)
s = s & " Total Gb / "
s = s & FormatNumber(drv.FreeSpace / 1073741824, 2) & " Gb Free"
hs.SetDeviceString DeviceCode, "<img src='hard_drive.gif' align=absmiddle>" & " " & s, TRUE
Set drv = Nothing
Set fso = Nothing
End Sub
</pre>
What I'm trying to do is to keep the same status text if it can't find the laptop and skip the check so it doesn't return error.
Your help is much appreciated.
Simon
Here's the codes:
<pre class="ip-ubbcode-code-pre">Sub Main()
GetSpace "C:", "t8"
GetSpace "\\pic_frame\c$", "t9"
End Sub
Sub GetSpace(byref DrivePath, byref DeviceCode)
Dim fso, drv, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set drv = fso.GetDrive(fso.GetDriveName(DrivePath))
s = FormatNumber(drv.TotalSize / 1073741824, 2)
s = s & " Total Gb / "
s = s & FormatNumber(drv.FreeSpace / 1073741824, 2) & " Gb Free"
hs.SetDeviceString DeviceCode, "<img src='hard_drive.gif' align=absmiddle>" & " " & s, TRUE
Set drv = Nothing
Set fso = Nothing
End Sub
</pre>
What I'm trying to do is to keep the same status text if it can't find the laptop and skip the check so it doesn't return error.
Your help is much appreciated.
Simon
Comment