PASSPORT Knowledge Base
Object Interface

Date Published: August 15, 2008

Title

Passing a Macro Name as a Parameter

Product

PASSPORT PC to Host, PASSPORT Web to Host

Emulation Types

TN3270, TN5250, VT, SCO ANSI, Wyse 60

Issue

With Attachmate EXTRA! we were able to run the ebrun.exe program and pass the name of a macro to it as a parameter, for example:

 

ebrun.exe "C:\EXTRA\Macros\MyMacro.ebm"

 

How can this be done with PASSPORT?

Solution

Using the NavigateTo method of the Session object, a developer can write an application which utilizes the PASSPORT Object Interface to accomplish this.

 

See the VB example below:

 

Sub Main()

'--------------------------------------------------------------------------------

' Get the main system object

    Dim Sessions As Object

    Dim System As Object

    Set System = CreateObject("PASSPORT.System")   ' Gets the system object

    If (System Is Nothing) Then

        MsgBox "Could not create the PASSPORT System object.  Stopping macro playback."

        Stop

    End If

    Set Sessions = System.Sessions

    If (Sessions Is Nothing) Then

        MsgBox "Could not create the Sessions collection object.  Stopping macro playback."

        Stop

    End If

'--------------------------------------------------------------------------------

' Set the default wait timeout value

    g_HostSettleTime = 3000     ' milliseconds

    OldSystemTimeout& = System.TimeoutValue

    If (g_HostSettleTime > OldSystemTimeout) Then

        System.TimeoutValue = g_HostSettleTime

    End If

' Get the necessary Session Object

    Dim Sess0 As Object

    Set Sess0 = System.ActiveSession

    If (Sess0 Is Nothing) Then

        MsgBox "Could not create the Session object.  Stopping macro playback."

        Stop

    End If

    If Not Sess0.Visible Then Sess0.Visible = True

    Sess0.Screen.WaitHostQuiet (g_HostSettleTime)

    

' Run the macro specified as parameter (i.e. "RunMacro.exe C:/Program Files/PASSPORT/MyMacro.zmc")

    Sess0.NavigateTo Command$()

    System.TimeoutValue = OldSystemTimeout

 

End Sub

More Information

Keywords

macro, engine, parameter, object interface