0

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
  • 2
    why doesn't it work? more code would help Commented May 18, 2012 at 1:16
  • Sorry set should have been used but it turns out it was a completely different error. Commented May 23, 2012 at 19:00

2 Answers 2

2

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
Sign up to request clarification or add additional context in comments.

Comments

0

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

Never mind it turn out to be another error and so I fixed it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.