PASSPORT Knowledge Base
Macros

Date Published: April 7, 2010

Title

Running a Macro Without Seeing Commands Executed

Product

PASSPORT PC to Host, PASSPORT Web to Host

Emulation Types

TN3270, TN5250, VT, SCO ANSI, Wyse 60

Issue

How can I have a macro run without the user seeing the commands being executed?

Solution

There are two known solutions, which both utilize the PASSPORT Object API as described below:

 

  1. The Visible property of the Session object may be used to hide the PASSPORT window while the macro commands are being executed, then un-hide after all commands have finished executing.

    Sample .ZAM macro:

Sub Main()
  Dim Sys, Sess
  Set Sys = CreateObject("PASSPORT.System")
  Set Sess = Sys.ActiveSession
  Set MyScreen = Sess.Screen
  Sess.Visible = False
  MyScreen.SendKeys "MyCommand<ENTER>"
  MyScreen.WaitHostQuiet(2000)
  MyScreen.SendKeys "MyUserID<ENTER>"
  MyScreen.WaitHostQuiet(2000)
  MyScreen.SendKeys "MyPassword<ENTER>"
  MyScreen.WaitHostQuiet(2000)
  MyScreen.SendKeys "3.4<ENTER>"
  MyScreen.WaitHostQuiet(2000)
  Sess.Visible = True
End Sub
  1. The ColorScheme property of the Session object may be used to temporarily set the text color equal to the background color while commands are executed, then set the colors back to default settings after all commands have finished executing. You must create a custom color scheme that sets the Unprotected Normal, Unprotected High, Protected Normal and Protected High categories to the same color as the Screen Background, then specify this color scheme file in the macro.

     

    Sample .ZAM macro:

Sub Main()
  Dim Sys, Sess
  Set Sys = CreateObject("PASSPORT.System")
  Set Sess = Sys.ActiveSession
  Set MyScreen = Sess.Screen
  Sess.ColorScheme = "MyColorScheme"
  MyScreen.SendKeys "MyCommand<ENTER>"
  MyScreen.WaitHostQuiet(2000)
  MyScreen.SendKeys "MyUserID<ENTER>"
  MyScreen.WaitHostQuiet(2000)
  MyScreen.SendKeys "MyPassword<ENTER>"
  MyScreen.WaitHostQuiet(2000)
  MyScreen.SendKeys "3.4<ENTER>"
  MyScreen.WaitHostQuiet(2000)
  Sess.ColorScheme = "<default>"
End Sub

More Information

Keywords

run, macro, invisible, visible, colorscheme, command, executed, hidden