PASSPORT Knowledge Base
Object Interface

Date Published: January 19, 2005
Date Updated: March 13, 2008

Title

Send Keystrokes to an Active Session

Product

PASSPORT PC to Host, PASSPORT Web to Host

Emulation Types

TN3270, TN5250, VT, SCO ANSI, Wyse 60

Issue

Programmers may have a need to send keystrokes to an active PASSPORT session from an external application.

Solution

Beginning in version 2002 of PASSPORT, the terminal emulation contains a new object layer (PASSOBJ.DLL) that allows programmers to create a COM object that may be used to send keystrokes to an active PASSPORT session.

Example

Below is sample Visual Basic code that sends a text string to a specific PASSPORT session, followed by the ENTER key:

 

Sub Main()

    Set objPassport = CreateObject("PASSPORT.System")

        num =objPassport.Sessions.Count

        if  num > 0 then

            for i=1 to num

                if objPassport.Sessions.Item(i) = "MySession" then

                set ActiveSess = objPassport.Sessions.Item(i)

                end if

            Next

        end if

    ActiveSess.Activate

    ActiveSess.Screen.WaitHostQuiet(gkHostSettleTime)

    ActiveSess.Screen.SendKeys"MyText<ENTER>"

End Sub

More Information

Keywords

api, object, screen, application, integration, keystrokes, automation