PASSPORT Knowledge Base
Macros

Date Published: April 28, 2009

Title

Using VBscript in macros

Product

PASSPORT PC to Host, PASSPORT Web to Host

Emulation Types

TN3270, TN5250, VT, SCO ANSI, Wyse 60

Issue

I have written a macro using VBscript. The script performs as expected when executed as a standalone script, but when I copy it into a PASSPORT .zmc macro, some of the functionality does not perform as expected.

 

The following simple VBScript program (using the InputBox VBScript function) works perfectly "standalone".  My HLP file, "OVERPAYMENT.hlp" opens just fine when the HELP button is clicked.

 

Dim sPrompt, sTitle, sHelpfile, sRes

Dim vDef

Dim nYPos, nXPos, nContext

sPrompt = "Where do you live?" : sTitle = "Personal Data"

vDef = "Kansas"

nXPos = 100 : nYPos = 100 : nContext = 1

sHelpfile = "C:\MyDocu1\OVERPAYMENT.hlp"

sRes = InputBox(sPrompt, sTitle, vDef, nXPos, nYPos, sHelpfile, nContext)

 

Now, when I take the same exact code and place it inside a PASSPORT macro, it doesn't work at all.  How can this be resolved?

Solution

In PASSPORT, when using the *.zam macro interface, the object API does not use the Visual Basic scripting language; instead, it uses the SAX ActiveX scripting language.  In order for you to use this macro, you will have to use the *.zmc macro interface with VBscript or rewrite the macro using the SAX ActiveX scripting language.  See below:

 

Sub ZMain

 

Dim sPrompt, sTitle, sHelpfile, sRes

Dim vDef

Dim nYPos, nXPos, nContext

sPrompt = "Where do you live?" : sTitle = "Personal Data"

vDef = "Kansas"

nXPos = 100 : nYPos = 100 : nContext = 1

sHelpfile = "C:\MyDocu1\OVERPAYMENT.hlp"

sRes = InputBox(sPrompt, sTitle, vDef, nXPos, nYPos, sHelpfile, nContext)

     

End Sub

More Information

Keywords

vb, script, vbscript, macro, zam, zmc, sax, api