B
BG - Ben Armstrong
Can someone explain what's going on here, and if there is a fix? Looks
like certain methods don't work, maybe because the type of object
returned isn't known.
require 'win32ole'
WIN32OLE.new('Scripting.FileSystemObject').Drives.each{|drive|
p [drive.driveLetter,drive.driveType,drive.shareName,drive.isReady,drive.path]}
# Generates:
#
# ["A", 1, "", false, "A:"]
# ["C", 2, "", true, "C:"]
# ["D", 4, "", false, "D:"]
# ["F", 3, "\\\\ntfs\\data", true, "F:"]
# ["H", 3, "\\\\ntfs\\users", true, "H:"]
# ["R", 3, "\\\\dyma\\r", true, "R:"]
# ["S", 3, "\\\\dyma\\s", true, "S:"]
# ["T", 3, "\\\\ntfs\\sales", true, "T:"]
# ["U", 3, "\\\\ntfs\\goldmine_ver4.0", true, "U:"]
# ["V", 3, "\\\\ntfs\\apps", true, "V:"]
# ["W", 2, "", true, "W:"]
# ["Y", 3, "\\\\Ntfs\\Data\\Medianet\\SRED", true, "Y:"]
# ["Z", 3, "\\\\NTFS\\users\\dm", true, "Z:"]
WIN32OLE.new('Scripting.FileSystemObject').Drives.each{|drive|
p [drive.driveLetter,drive.driveType,drive.shareName,drive.isReady,drive.path,drive.serialNumber]}
# Generates:
#
# C:/Work/diskid.rb:4:in `method_missing': serialNumber (WIN32OLERuntimeError)
# OLE error code:800A0047 in <Unknown>
# <No Description>
# HRESULT error code:0x80020009
# Exception occurred from C:/Work/diskid.rb:4
# from C:/Work/diskid.rb:3:in `each'
# from C:/Work/diskid.rb:3
#
like certain methods don't work, maybe because the type of object
returned isn't known.
require 'win32ole'
WIN32OLE.new('Scripting.FileSystemObject').Drives.each{|drive|
p [drive.driveLetter,drive.driveType,drive.shareName,drive.isReady,drive.path]}
# Generates:
#
# ["A", 1, "", false, "A:"]
# ["C", 2, "", true, "C:"]
# ["D", 4, "", false, "D:"]
# ["F", 3, "\\\\ntfs\\data", true, "F:"]
# ["H", 3, "\\\\ntfs\\users", true, "H:"]
# ["R", 3, "\\\\dyma\\r", true, "R:"]
# ["S", 3, "\\\\dyma\\s", true, "S:"]
# ["T", 3, "\\\\ntfs\\sales", true, "T:"]
# ["U", 3, "\\\\ntfs\\goldmine_ver4.0", true, "U:"]
# ["V", 3, "\\\\ntfs\\apps", true, "V:"]
# ["W", 2, "", true, "W:"]
# ["Y", 3, "\\\\Ntfs\\Data\\Medianet\\SRED", true, "Y:"]
# ["Z", 3, "\\\\NTFS\\users\\dm", true, "Z:"]
WIN32OLE.new('Scripting.FileSystemObject').Drives.each{|drive|
p [drive.driveLetter,drive.driveType,drive.shareName,drive.isReady,drive.path,drive.serialNumber]}
# Generates:
#
# C:/Work/diskid.rb:4:in `method_missing': serialNumber (WIN32OLERuntimeError)
# OLE error code:800A0047 in <Unknown>
# <No Description>
# HRESULT error code:0x80020009
# Exception occurred from C:/Work/diskid.rb:4
# from C:/Work/diskid.rb:3:in `each'
# from C:/Work/diskid.rb:3
#