如何在VBscript中将字符串数组转换为变体数组? [英] How can I convert a string array to a variant array in VBscript?

查看:194
本文介绍了如何在VBscript中将字符串数组转换为变体数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在vbscript中使用一个函数,该函数返回字符串的变体数组.

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

JobIDs = objDoc.ConnectedSubmit(objServer)

问题是我无法从该数组获取Job ID值,因为vbscript无法处理类型变量.当我尝试对JobIDs数组执行任何操作时,它只会给出类型不匹配的情况.我在此处找到了一些有希望的信息,但是当我使用转换功能:

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())

这给了我相同类型的不匹配错误.我在这里遗漏明显的东西吗?显然,这是一个正式的Microsoft解决方案,所以我不确定为什么它似乎也有相同的问题,即,首先不能真正使用字符串数组执行任何操作.我已经看到我的问题的第一部分在很多地方都得到了回答,都指向MS解决方案,但是我还没有看到有人成功使用该解决方案的后续报道.

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.

推荐答案

我不确定我是否理解为什么它不起作用,因此此答案可能不会很有帮助.我本来以为这样的事情可能会起作用(在您之前的问题之后,我假设您正在尝试使取消生效):

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

这篇关于如何在VBscript中将字符串数组转换为变体数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆