List Example

The following example demonstrates how to create and pass list parameters between a parent and child script that test the Notepad application.

The parent script contains:
Public Module Main
 Dim _desktop As Desktop = Agent.Desktop

  Public Sub Main()
    Dim numList As New List(Of Integer)
    For i As Integer = 0 To 10
    numList.Add(i)
    Next
 
    Dim args As New Dictionary(Of String, Object)
    args("Numbers") = numList

    Workbench.RunScript("ChildScriptArgs", args)
  End Sub
End Module

The child script includes:
Public Module Main   
  Dim _desktop As Desktop = Agent.Desktop
  Public Sub Main(args As IDictionary(Of String, Object))
    Dim nums As List(Of Integer) = args("Numbers")
  
    With _desktop.Window("/Window[@caption='Untitled - Notepad']")
    For Each num As Integer In nums
    .TextField().TypeKeys(num.ToString() + "<Enter>")
    Next
    End With

  End Sub
End Module