VBScript中的UDT:“错误:预期标识符”

时间:2011-05-22 22:06:26

标签: vbscript user-defined-types

我习惯使用ClassicVB / VB.Net而不是VBScript,从应用程序调用下面的脚本时出现错误:

# $language = "VBScript"
# $interface = "1.0"

'Microsoft VBScript compilation error
'Error: Expected identifier
Public Type MyType
    Caption As String
    Dir As String
End Type

Sub Main
    'Whatever
End Sub

我用谷歌搜索样本,但没有发现上面的错误。

谢谢。


编辑:通过使用哈希/字典解决问题:

Set hash = CreateObject ("Scripting.Dictionary")

hash.add "MyDir", "cd /usr/src/mydir"
hash.add "Linux", "cd /usr/src/linux"

keys = hash.Keys
for index = 0 to hash.Count - 1
    Set tab = crt.session.ConnectInTab("/s 192.168.0.3")
    tab.Caption = Keys(index)
    Set tabscreen = tab.Screen
    tabscreen.Send hash.item(Keys(index)) & vbcr
Next

1 个答案:

答案 0 :(得分:0)

vbscript中有no user-defined structures

但是有user-defined classes