views:

46

answers:

1

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.

+1  A: 

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
ho1
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 Majsterski
@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: http://support.technetex.ca/devguide/vbscript_functions.aspx
ho1
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 Majsterski
@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.
ho1
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!
Joe Majsterski