开发者

UDT in VBScript: "Error: Expected identifier"

I'm used to ClassicVB/VB.Net but not VBScript, and I'm getting an error when calling the script below from an application:

# $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

I've googled for samples, but didn't find what's wrong with the above.

Thank you.


Edit: Problem solved by using a hash/dictionary instead:

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 = Key开发者_JAVA百科s(index)
    Set tabscreen = tab.Screen
    tabscreen.Send hash.item(Keys(index)) & vbcr
Next


There are no user-defined structures in vbscript.

There are user-defined classes, however.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜