我习惯使用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