Option Explicit
Dim p4, arr, str, info, errs, warns, files
Set p4 = WScript.CreateObject("P4COM.p4")
p4.port = "1666"
p4.client = "test_ws"
p4.user = "bruno"
p4.ExceptionLevel = 0
p4.connect
' p4.input = "brunopass"
' DisplayResult("login")
DisplayResult("info")
p4.disconnect
p4.parseforms
p4.connect
WScript.Echo("About to parse change -o")
info = p4.run_variant("change -o")
PrintArray "Warnings: ", p4.Warnings_variant
PrintArray "Errors: ", p4.Errors_variant
WScript.Echo("Info array count: " & (UBound(info) + 1))
dim i
For i = 0 To UBound(info)
WScript.Echo("Info[" & i & "]: " & info(i))
Next
' Check if VarExists works
WScript.Echo("Files var exists: " & p4.VarExists("Files0"))
WScript.Echo("Description var exists: " & p4.VarExists("Description"))
files = p4.arrayvar_variant("Files")
If IsArray(files) Then
WScript.Echo("Files array count: " & (UBound(files) + 1))
PrintArray "Files: ", files
Else
WScript.Echo("Files is not an array!")
End If
sub PrintArray(msg, arr)
if IsArray(arr) then
if (UBound(arr) >= 0) then
WScript.Echo(msg & join(arr, chr(13) & chr(10)))
end if
end if
end sub
sub DisplayResult(cmd)
WScript.Echo("Cmd: " & cmd)
PrintArray "Info: ", p4.run_variant(cmd)
PrintArray "Warnings: ", p4.Warnings_variant
PrintArray "Errors: ", p4.Errors_variant
end sub