4

I'm using a function in vbscript which returns a variant array of strings.

JobIDs = objDoc.ConnectedSubmit(objServer)

The problem is I can't get the Job ID values from that array, as vbscript doesn't handle typed variables. It just gives a type mismatch when I attempt to do ANYTHING with the JobIDs array. I found some promising information here, but when I used the conversion function:

Set objConverter = CreateObject("ADS.ArrayConvert")
ConvertedJobIDs = objConverter.CStrArray(JobIDs())

It is giving me the same type mismatch error. Am I missing something obvious here? This is, apparently, an official microsoft solution, so I'm not sure why it seems to have the same problem, namely, not being able to actually do anything with a string array in the first place. I've seen the first part of my question answered in many places, all pointing to the MS solution, but I have yet to see any follow up reports of someone successfully using that solution.

2 Answers 2

1

I'm not sure if I understand why it doesn't work, so this answer might not be very helpful. I would have thought that something like this might work (following on from your previous question I'm assuming you're trying to get the cancellation to work):

For Each id In JobIDs
    WScript.Echo id
    YourJob = YourOutgoingFaxQueue.GetJob(id)
    YourJob.Cancel()
Next
Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for that reply. What you suggest is what I had tried initially, before looking for an alternative. It gives the type mismatch error on the "For Each..." line. Basically, it seems that any attempt to examine the contents of that JobIDs object, or extract its values, is met with a type mismatch error.
@Joe: Is the Submit working so it's actually sending the faxes? So it's not failing and returning a Nothing or something similar? I'd suggest calling IsArray, IsNull, IsEmpty and/or VarType on the JobIDs variable to find out exactly what it is. You can find more info about those calls + a lookup of the values returned by VarType here: support.technetex.ca/devguide/vbscript_functions.aspx
Yes, thanks again. Submit is correctly throwing a fax into the outbox of the fax console. I'd already tried VarType on the JobIDs, and it's returning 8200, which is an array of strings.
@Joe: No idea then I'm afraid. If I were in the same situation I'd try to write the code in VB6 and/or VB.Net (since the syntax would be pretty much the same, just needing to give a datatype to the variables) and seeing if you can make that work. Those environments give better error messages which might be helpful in figuring it out. If you don't have either of those available, you can download VB.Net express 2010 for free, just google for it.
Thanks. That's what I've decided to do. I was hoping to just whip it together, but it looks like I'll have to actually compile some code here. Again, thanks for all your help!
1

This behavior is by design, VBScript can't do anything with a non-variant array, there was a KB article from Microsoft that explained this but it is not on-line anymore:

Q165967 - PRB: Script Error Occurs When Referencing Non-variant Array

An archived copy of the article can be found at:

https://ftp.zx.net.nz/pub/archive/ftp.microsoft.com/MISC/KB/en-us/165/967.HTM

1 Comment

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.