I want to run a script that sends some command taking input from an array. For each element of the array I want the print goes to a different log file.
The script I made so far is below but doesn't work. It seems that only stores the print of last command sent.
How would be the correct way to do it please?
#$language = "VBScript"
#$interface = "1.0"
crt.Screen.Synchronous = True
Sub Main
arr = "1,2,3"
a = Split(arr, ",")
For i = LBound(a) To UBound(a)
crt.Session.Log False 'Turn off log session
crt.Session.LogFileName = "C:\Users\Path\MyLogfile No." & a(i) & ".log" 'Define log file name
crt.Session.LogUsingSessionOptions 'Turn on log session
crt.Screen.Send "some command" & a(i) & ";" & Chr(13) 'Some command sent to each arr element, this part works fine
Next
crt.Session.Log False
'Restore the default log file
crt.Session.LogFileName = "C:\Users\myuser\Documents\default.log"
End Sub