Transmitindo Parâmetros para o Método CallScript

Este tópico descreve como utilizar as diferentes assinaturas do método CallScript para transmitir dados de um script para outro. O exemplo utiliza dois scripts diferentes do Teste Funcional:

CallScript("TheCalled");

Dim ObjdataToPass as Object()
...
CallScript("TheCalled",ObjdataToPass)

O script Caller foi gravado da seguinte forma:

Public Class TheCaller Inherits TheCallerHelper

    ' Script Name   : TheCaller
    ' Generated     : Dec 17, 2005 8:47:45 PM
    ' Description   : Teste Funcional Script
 
   ' since 2005/12/17
    ' author Administrator

    Public Function TestMain (ByVal args() As Object)
        CallScript("TheCalled")
        Dim DataToPass(3)As String
        DataToPass(0) = "This"
        DataToPass(1) = "is"
        DataToPass(2) = "really"
        DataToPass(3) = "cool!"
        CallScript("TheCalled",DataToPass)
        Dim ObjdataToPass(3)As Object
        ObjdataToPass(0) = new String( _
          "Thought the previous was cool?")
        ObjdataToPass(1) = "Take this one!"
        ObjdataToPass(2) = new Float(0.02)
        ObjdataToPass(3) = new Integer(4711)
        CallScript("TheCalled",ObjdataToPass)
        End Function
   End Class

O script TheCalled utiliza um loop simples para imprimir os parâmetros recebidos para System.Console:

Public Class TheCalled Inherits TheCalledHelper

    ' Script Name   : TheCalled
    ' Generated     : Dec 17, 2005 8:48:12 PM
    ' Description   : Teste Funcional Script
    ' since 2005/12/17
    ' author Administrator

    Public Function TestMain (ByVal args() As Object)
        If args.Length < 1 Then
          System.Console.WriteLine _
            ("There were "+args.Length+" args. Less than expected!")
          Return
        Else
         System.Console.WriteLine( "There were: "+args.Length+" args")
        End If
       Dim I As Integer

       For I = 0 To args.Length - 1
          System.Console.WriteLine( " arg["+I+"] = " _
            + args(I) .ToString())

        Next
    End Function
End Class

Termos de uso | Feedback
(C) Copyright IBM Corporation 2002, 2004. Todos os Direitos Reservados.