Hello I have set keyword used for an object in vbscript but it doesnt work with an array is their an alterative? Or do i just have to specify the arrays type specifically for set to work? heres the line of code causing fraustration: GenericHIDDev(i) = CreateObject("SoftHIDReceiver.HIDDevice.1")
2 Answers
In VBScript you should use Set Statement when you need assign an object reference to a variable.
Dim GenericHIDDev(0)
'GenericHIDDev(0) = CreateObject("SoftHIDReceiver.HIDDevice.1") ' wrong assignment
Set GenericHIDDev(0) = CreateObject("SoftHIDReceiver.HIDDevice.1") ' correct assignment
Comments
Dont't have your object but the following works, so use array(object)
GenericHIDDev = array(CreateObject("Scripting.FileSystemObject"))
wscript.echo GenericHIDDev(0).FileExists("c:\test.vbs")
1 Comment
jeffery
Never mind it turn out to be another error and so I fixed it.