Miscellaneous AiF Facilities

The following topics document several of the miscellaneous but often very important features within AiF.

For additional or modified AiF features, contact your dealer or Perforce directly. We have a policy of incorporating user feedback directly into future releases where these requests fall within the general development strategy. (For details of the latest enhancements available in HostAccess, refer to the READ.ME file on the HostAccess disk).

Closing HostAccess From Host

An AiF sequence is available to close HostAccess. This feature allows application developers to include 'close HostAccess' in their application menus.

HostAccess will NOT ask the user to confirm the close request as would be done if ALT/X was entered from the keyboard.

The user will be returned straight to DOS and without any warning if the HostAccess parameters have been changed.

Closing HostAccess From the Host AiF Sequence

Use the following AiF sequence:

ESC _ X ESC \

Note: After closing HostAccess the application should normally close the host process that was driving HostAccess.

This AiF sequence is often used in conjunction with automated File Transfer to or from the host but initiated from the PC through the use of HostAccess's Macro Language. It enables the PC to process file transfer(s) remotely, logoff the host session and then exit HostAccess to return to the controlling DOS process (batch file).

For more information on the macro language, see Using the Macro Language.

Getting HostAccess Run-time Status

This AiF sequence may be used to find out more information about HostAccess and its run-time environment.

Use the following sequence to get the HostAccess Run-time status:

ESC [ = 10 n

This returns:

<STX> <CR> a;b;c;d <CR>

Where:

<STX> Is the start of text character (ASCII decimal value 002).

<CR>

Is a carriage return (ASCII decimal value 013).

a

1 if Windows version running or 0 if DOS version.

b

1 if current PC is colour, 0 if mono.

c

1 if blinking is enabled on PC, 0 if not.

d

1 if this PC has a mouse that HostAccess can use, 0 if not.

Note: This sequence combines several AiF sequences into one. In time, we will extend the information returned by this sequence, and for this reason we recommend that developers use this sequence in preference to the individual sequences to get serial number, blinking status, etc.

Capturing Screen Text

As well as being able to dump the current screen text to an attached local printer or to a DOS file, you can also send that same screen text up to the host. This screen text can then be sent on to the system printer, saved in a file or indeed used anywhere else on the host system.

Upon sending the appropriate sequence, the PC will send the screen text back to the host. Each line of the screen is sent to the host with all non-printable characters replaced by spaces and terminated by a carriage return.

Capturing Screen Text AiF Sequence

Use the following AiF sequences to capture screen text.

ESC [ = 2 i

or

ESC [ 2 ; n i

Where:

n Is the optional parameter determining which screen is sent to the host, as:

 

HostAccess returns the screen to the host with each line separated by a carriage return and adds a leading and trailing start of text (ASCII value 002) character. The format of the reply to this AiF sequence is:

 

<STX> <CR> line1 <CR> line2 <CR> ... lineN <CR> <STX> <CR>

 

Where:

 

<STX>

Is the start of text character (ASCII decimal value 002).

 

<CR>

Is a carriage return (ASCII decimal value 013).

 

line1 ... lineN

Is each line of the screen. The number of lines will vary depending upon the current screen configuration.

Capturing Screen Text Example

As each line of the screen is terminated by carriage return, a  simple program can be written to retrieve each line of the screen image into an array.

For example:

screen = ""

counter = 1

 

send to PC 'ESC[=2i'

echo off

loop input resp until resp equals STX do repeat

loop

    input line

until line equals STX do

    screen(counter) = line

    counter = counter  1

repeat

echo on

display counter:"screen lines sent to host"

 

Note: Host echoing of terminal input must be switched off before requesting the screen image. Otherwise, the user's application screen will be corrupted.

This feature can be very useful for documenting applications screens as well as giving users the ability to capture any screen at any time back to the host system.

Another method of (automatically) sending the host session's screen back to the host would be to:

  1. Assign the DOS Print device to a DOS file name.

  2. Send the ANSI sequence to "print screen"

  3. File transfer the DOS file up to the host.

This method may be simpler in some circumstances and would enable you to capture IBM graphics within the screen.

Changing Emulation

In some applications areas it may be useful to be able to change the current terminal type that HostAccess is emulating. A special AiF sequence is provided for this.

ESC [ = n {

Where:

n

is the emulation number for the required emulation as follows:

 

0

VT100

11

SM 9400

 
 

1

VT220 (7 bit)

12

Ansi

 
 

2

VT220 (8 bit)

13

Videotex

 
 

3

Prism8/9

14

Microfusion

 
 

4

Prism9 Ansi

15

Ampex

 
 

5

QVT119

16

TV1920

 
 

6

Wyse50

17

Galileo

 
 

7

Wyse60

{

The literal character '{'.

 
 

8

AddsVp

 

 

 
 

9

UCL Term

 

 

 
 

10

DG 216

 

 

 

Changing Emulation Example

Applications which invoke other applications specifically enhanced for different terminals can now swap between the required emulation. In practice, this only occurs very rarely. However, we do know of one application that was built around one terminal type but has later been enhanced to call another "word-processing" application that was specifically targeted for a different terminal type.

Note: Changing emulations will effectively reset the terminal, wiping out all previous backpages,  screens, slots etc. If the previous environment needs to be saved, use the AiF sequence to "push environment", in Save Environment.

File Transfer

Use the following AiF sequence to start a file transfer:.

ESC _ mode ; hostdriven ; 1; append ; 0 ; protocol ; ist ; direction local ;

Remote {; FTP server} {; username} {; password}  ESC \

Where:

Mode

0 = binary.

 

1 = text.

hostdriven

0 = Displays progress dialog during the transfer.  User must close the dialog manually once the transfer is complete.

 

1 = Displays progress dialog during the transfer and automatically closes the dialog once the transfer is complete (DOS.PICK Flag = H).

 

2 = Suppress all progress output (DOS.PICK Flag = Z).

append

0 = Overwrite destination file.

 

1 = Append to destination file.

Note: If using protocol number 9, this parameter is ignored.

protocol

0 = Proprietary.

 

1 = Kermit.

 

2 = X/Ymodem.

 

3 = Zmodem.

 

9 = FTP

ist

0 = Transfer is to local PC file (normal).

 

1 = Intersession file transfer.

Note: If using protocol number 9, this parameter is ignored.

direction

{ = Send file to host.

 

} = Receive file from host.

local

Filename on the PC.

Remote

Filename on the host.

ftp server

The FTP server address.

Note:  Only relevant when using protocol 9.

username   

The username to be used when connecting to the FTP server.

Note:  Only relevant when using protocol 9.

password

The password for the username above

Note:  Only relevant when using protocol 9.

For example:

ESC_1;0;1;0;0;3;0{c:\monkey.txt;pigESC\

Will start a Zmodem file transfer to send the file 'c:\monkey.txt' on the PC to the file 'pig' on the host.

FTP example:

ESC_0;2;1;0;0;9;0;}c:\dn\drivers.zip;/services/technet/drivers.zip;ftp.microsoft.com;anonymous;

passwordESC\

 

Will download the binary file '/services/technet/drivers.zip' from the ftp.microsoft.com ftp server into the local file ‘c:\dn\drivers.zip’.  No progress dialog will be displayed.