1: Introduction, highlights and main topics

Click on any the following links for immediate help or introduction to various important topics:

NEW USERS
TABLE OF CONTENTS
MAJOR FEATURES
HELP ON HELP
FAQ
NEWS SCREEN
USER OPINIONS

Shortcut to All IVT.RC commands
Shortcut to All script keywords
Shortcut to All script function names
Shortcut to All script reserved variables

Welcome to the HELP-system of IVT. Click on this link if you want to find out what IVT is...

Below you'll find the most important topics in a logical order. There is also a table of contents that lists all chapters and sections. See "about" to get an idea of the size of these manual pages (when printed, the total manual is over an inch thick!).

Overview of topics in order of importance:

Starting IVT Command line parameters, environment and all that.
Session Management Making, managing and disconnecting sessions.
Status line Describes how to make most of the bottom line.
Cutting & Pasting Yank data into multiple buffers, paste anywhere.
Supported protocols Transport protocols and session protocols.
Special keys Summary of all IVT special keystrokes.
Scroll back history How to view lines that scrolled from the screen.
Kerberos V5 support IVT supports this MIT authentication protocol!
Secure shell (SSH) IVT supports Secure Shell version 2!
IVT.RC files Describes all things you can put in start-up files.
Setup screens Changing configuration on the fly.
Cut/Paste with mouse How to use the rodent to do the cut/paste.
Using a printer How to print to a device or file, auto or manual.
Keyboard macros How to make those repetitive tasks easier.
File transfer X, Y and ZMODEM file transfer with ALT+F9.
Crypt IVT.RC files To hide passwords.
Screen saver Timer controlled or manual idle task.
Locking the keyboard Automatically after some time or manually.
IVT Escape Sequences All recognized VT220 and IVT special sequences.
Challenge response How to do secure login over a network.
Various examples Example configurations, scripts, etc.

                  __ IVT supports serial lines __

Serial communication Tells you how to use RS232 communications.
Multiplex protocol Sorry, no multiplexing in this version

                  __ IVT supports a scripting language __

Script language Describes the major features of this powerful language.
Using Variables Global, session, parameter and local variables.
Expressions Valid expressions in scripts.

                  __ Support programs for IVT __

PRIVT Print Unix files on any IVT printer.
EMU_TYPE Determine type of emulator used at login-time.
LOGINC IVT Challenge/Response protocol server for Unix.
KEYP Program your (IVT/VT220) keys from Unix.
IVT.TIC Terminfo file for IVT.
IVTCOM A Unix script to run commands on your IVT PC.

1.1: Global description

IVT is a multi-session, LAN-oriented (but serial lines supporting) VT220 terminal emulation program for Windows.
Besides TELNET, this build also supports the SSH protocol.
The URL to download it from is described here.

If you are a Unix user who normally uses a PC to run some sort of VT100 emulator to contact your Unix hosts, this program is for you! IVT contains many features to make life easier  and is meant to be a program you want to spend most of your (working) time in.

"Multi-session" means it supports several simultaneous connections to one or more hosts in a SINGLE window.
Creating sessions is very easy, and there are numerous ways to switch between sessions, to monitor background session activity and to close sessions. The command line parameters can be used to do a variety of things, including automatic creation of all your sessions (including login).
There is the session group editor to allow interactive editing of groups.

When output scrolls from the screen, the history pager can bring it back.

One of the major features is copy and paste with the mouse and/or the keyboard. Check out the special way to copy words and phrases from the screen.
This really saves a lot of typing!

IVT is very, very configurable, using IVT.RC files.
This Windows version is also able to save the setup in the Windows registry.
See "IVT and the Windows registry" for details.

Also, IVT supports a scripting language. This powerful language can automate many tasks. It has variables and complex expressions.
It can, for example, automate the login process, while keeping your passwords hidden by encryption. The standard setup comes with a password learning system that does this for you already.

The bottom line of the screen is normally a status line that displays many important bits of information. Click the fields to change them, right-click them for help.

The keyboard is very customizable and programmable. It can automate many tedious tasks for you. You can program keys, for example. It can also lock the keyboard under timer control (or manually with ALT+l).

Almost all settings of IVT can be viewed and changed by using the setup screens.

IVT can drive a printer to save all output (or explicit screen prints) to a real printer or to a file. Printouts are automatically sized to fit the paper.

AUTOLOG is very handy for making transcripts of sessions (log to file).

IVT also transfers files, using X/Y/Zmodem protocols with automatic recognition of a ZMODEM file transfer. If you have RZ on Unix, you can drop a file on the IVT window and it will start the transfer.

There are many more features - see the table of contents for ideas...


1.2: Where can I obtain IVT?

Currently, IVT can be obtained from http://ivtssh.nl/downloads

This is the commercial version of IVT with support for Kerberos V5 authentication and DCE/Gradient integration.
It also supports SSH and GSSAPI.


1.3: List of major features.

Throughout the manual you'll find topics that are highlighted as being a "major feature". All such topics have a hyperlink to the previous and next topics. This screen serves as a start and an end of the list.

Follow this list to get a quick impression of the strong points of IVT.
Follow this link to go to the first such item.


1.4: Licence agreement

BEARSTAR SOFTWARE PRODUCT LICENSE AGREEMENT

This BearStar Software Product License Agreement (the "Agreement") is made between you, the end user customer ("Customer"), and BearStar Software, a Dutch Corporation  ("BearStar").

IMPORTANT - BY CLICKING ON THE "YES" OR "ACCEPT" BUTTON, OR INSTALLING, DOWNLOADING OR USING THE SOFTWARE, OR OPENING THE PACKAGE, YOU ARE CONSENTING TO BE BOUND BY AND ARE BECOMING A PARTY TO THIS AGREEMENT AND ARE REPRESENTING THAT YOU ARE DULY AUTHORIZED TO EXECUTE THIS AGREEMENT ON BEHALF OF YOUR COMPANY.  IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, CLICK THE "NO" OR "DO NOT ACCEPT" BUTTON, DO NOT USE, INSTALL OR DOWNLOAD THE SOFTWARE, OR IF APPLICABLE, DO NOT OPEN THE PACKAGE, AND, IF APPLICABLE, RETURN THE SOFTWARE TO BEARSTAR.  IF YOU HAVE EXECUTED A WRITTEN MASTER SOFTWARE LICENSE AGREEMENT WITH BEARSTAR FOR THIS SOFTWARE AND THE TERMS AND CONDITIONS OF THE MASTER SOFTWARE LICENSE AGREEMENT CONFLICT WITH THE TERMS AND CONDITIONS OF THIS AGREEMENT, THE APPLICABLE TERMS AND CONDITIONS OF THE MASTER SOFTWARE LICENSE AGREEMENT SHALL APPLY.  THIS LICENSE AGREEMENT CONTROLS AND SUPERSEDES ANY PURCHASE ORDERS ISSUED BY YOU FOR THIS SOFTWARE.
THIS SOFTWARE IS PROTECTED BY COPYRIGHT LAWS AND INTERNATIONAL COPYRIGHT TREATIES, AS WELL AS OTHER INTELLECTUAL PROPERTY LAWS AND TREATIES.

1.      Grant of License.  During the term of this Agreement, Customer will have a non-transferable and non-exclusive license (without right to sublicense) to: (i) use the specified version of the BearStar Software Product(s) in object code form and associated documentation, if any (collectively, the "Product") for the specified number of machines or servers and in accordance with the terms and conditions of this Agreement and (ii) reproduce the Product as reasonably needed solely for inactive backup or archival purposes.

2.      Intellectual Property Protection; Restrictions.  The Product and all intellectual property rights therein, including code, operation, architecture, implementation, and look and feel, are and shall remain at all times the exclusive property of BearStar and its licensors.  The Product is protected by international and United States copyright laws and treaty provisions.
Nothing contained in this Agreement shall give or convey to Customer any right, title or interest in the Product, except to the extent of the license rights expressly granted by this Agreement. Customer may not modify, translate, reverse engineer, decompile, disassemble, or create derivative works or emulators of the Product except to the extent that BearStar is required to grant such rights under law for the purposes of achieving compatibility with third-party software or hardware and in such event Customer shall notify BearStar and BearStar shall have a reasonable opportunity subject to a reasonable fee for doing so to create a version of the Product which is compatible with Customer's platform and environment.
However, BearStar shall not be obligated to create such version.
Customer may not use the Product in a service bureau or outsourcing arrangement.  Customer may not delete or alter any copyright, trademark or other proprietary rights notices of BearStar and its licensors, if any, appearing on the Product and Customer will reproduce such notices on all copies made of the Products.  Customer may not distribute, sublicense, rent, lease, sell, transfer or grant any rights for the Products in any form to any third party without the express written consent of BearStar.
In the event of any breach of this section BearStar has the right to seek injunctive or other equitable relief.

3.      License Fee; Payment.  In consideration of the rights granted herein, Customer will pay BearStar the associated license fees within thirty (30) days of invoice date in U.S. dollars or other agreed currency to the attention of accounts payable.  If Customer does not pay an invoice(s) when due, BearStar may charge a late payment fee on the unpaid amounts equal to the lesser of ten percent (10%) per annum, or the maximum legal rate.  Customer will be responsible for, and will promptly pay, all taxes of whatever nature (including but not limited to value added, sales and use taxes) and shipping charges associated with this Agreement or Customer's receipt or use of the Product, except taxes based on BearStar's net income.  Such taxes shall not be considered a part of, a deduction from or an offset against license fees.
At BearStar's option, once per calendar year, an independent certified public accountant selected by BearStar and reasonably acceptable to Customer may, at BearStar's expense, and upon reasonable notice and during normal business hours, and subject to a confidentiality agreement, audit the appropriate records of Customer to verify that Customer's use of the Product is in compliance with the terms of this Agreement and the associated license fees.
If the associated license fees pursuant to the audit are different than those paid, Customer will be invoiced or credited for the difference, as applicable.

4.      Termination. This Agreement is effective until terminated pursuant to this Agreement.  Either party may terminate this Agreement at any time on written notice to the other in the event of a material breach by the other party (which includes failure to pay license fees) and a failure to cure such default within a period of thirty (30) days following receipt of written notice specifying that a default has occurred.  Upon (i) the institution of any proceedings by or against Customer seeking relief, reorganization or arrangement under laws relating to bankruptcy, insolvency, receivership or liquidation which proceedings are not dismissed within sixty (60) days; (ii) the assignment for the benefit of creditors, or the appointment of a receiver, liquidator or trustee, of any of Customer's property or assets; or (iii) the liquidation, dissolution or winding up of Customer's business; then and in any such events this Agreement may immediately be terminated by BearStar upon written notice.  Upon termination, all licenses granted hereunder shall terminate and the Customer agrees to cease using the Product, purge from its electronic memory devices all copies of the Product and return to BearStar, promptly, the Product and all related documentation.  Termination shall not relieve Customer from paying all fees accrued prior to termination.
The provisions entitled Intellectual Property Protection, Confidentiality, Disclaimer of Warranties, Limitation of Liability and General Provisions shall continue in force even after termination of this Agreement.

5.      Confidentiality.  For purposes of this Agreement, "Confidential Information" shall mean any confidential, trade secret or other proprietary information, including the Product and software code, disclosed by one party to the other under this Agreement, except for information that: (i) was previously known by the receiving party free of any obligation to keep its confidence; (ii) is now or subsequently becomes generally known to the public through acts not attributable to the receiving party; or (iii) the receiving party rightfully obtains from a third party who has the right to transfer or disclose it.  Confidential Information (A) shall be used by the parties only for the purposes set forth in this Agreement; (B) shall not be reproduced or copied, in whole or in part, except as necessary for use as authorized herein; (C) shall be distributed only to those employees of receiving party with a "need-to- know" in order to exercise rights and to perform tasks or services called for under this Agreement; and (D) shall be treated in confidence by the receiving party, and not disclosed to any third party without the prior written consent of the disclosing party.
The terms of this Agreement are deemed Confidential Information and may not be disclosed without the prior written consent of the other party, except (i) either party may disclose such terms to the extent required by law, rules and regulations or as necessary to enforce this Agreement; (ii) either party may disclose the existence of this Agreement; (iii) either party may disclose the terms of this Agreement to such party's auditors, attorneys, bankers or investment bankers as necessary for their rendition of services to a party; and (iv) BearStar shall have the right to disclose that Customer is a customer of BearStar and the Product, including in BearStar's marketing materials and Web site.  This section shall survive termination of this Agreement.  In the event of any breach of this section the non-breaching party has the right to seek injunctive or other equitable relief.

6.      Maintenance and Support; Updates. Maintenance and support or updates may be purchased separately by Customer from BearStar in accordance with the BearStar maintenance and support plan and associated fees paid by Customer.

7.      LIMITED WARRANTY.  During the initial thirty (30) day period from the date the Product is shipped, BearStar warrants that the Product will perform substantially in accordance with the applicable accompanying published Product documentation.  Customer's sole remedy for breach of the foregoing limited warranty shall be to have the deficiencies remedied or the Product replaced or to receive a refund of the pro rata amount of the fees allocable to the use of the Product, at BearStar's option. The limited warranty hereunder is void if failure of the Product has resulted from the misapplication, abuse or unauthorized modification of the Product.  Any replacement Product will be warranted for the remainder of the original warranty period.
        
8.      DISCLAIMER OF WARRANTIES. EXCEPT FOR THE LIMITED WARRANTY SET FORTH HEREIN, THE PRODUCT IS PROVIDED "AS IS" WITHOUT ANY WARRANTY WHATSOEVER.  BEARSTAR AND ITS LICENSORS DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED OR STATUTORY, AS TO ANY MATTER WHATSOEVER, INCLUDING, WITHOUT LIMITATION, ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY RIGHTS.  WITHOUT LIMITING THE FOREGOING, BEARSTAR AND ITS LICENSORS DO NOT WARRANT THAT THE PRODUCT WILL MEET CUSTOMER'S REQUIREMENTS, THAT OPERATION OF THE PRODUCT WILL BE UNINTERRUPTED OR ERROR FREE OR THAT ERRORS IN THE PRODUCT WILL BE CORRECTED.  IF IMPLIED WARRANTIES MAY NOT BE DISCLAIMED UNDER APPLICABLE LAW, THEN ANY IMPLIED WARRANTIES ARE LIMITED IN DURATION TO THE ABOVE WARRANTY PERIOD.  NO BEARSTAR DEALER, AGENT OR EMPLOYEE IS AUTHORIZED TO MAKE ANY MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS WARRANTY.
        
9.      Indemnity.  BearStar at its own expense shall (i) defend, or at its option settle, any claim or suit against Customer on the basis of infringement of any UK patent, copyright, trademark, or trade secret by the Product in any country that has a bilateral trade agreement on intellectual property rights with the U.K. and (ii) pay any final judgement entered against Customer on such issue or any settlement thereof; provided (a) BearStar has the right to control and direct the defence and/or settlement, (b) Customer notifies BearStar promptly in writing of each such claim or suit and gives BearStar all information known to Customer relating thereto, and (c) Customer cooperates with BearStar in the settlement and/or defence. If all or any part of the Product is, or in the opinion of BearStar may become, the subject of any claim or suit for infringement of such intellectual property rights, BearStar may, and in the event of any adjudication that the Product or any part thereof does infringe or if the use of the Product or any part thereof is enjoined, BearStar shall, at its expense, have the option to: (i) obtain the right to continue use of the Product; (ii) replace or modify the Product so that it is no longer infringing and has substantially equivalent functionality; or (iii) if none of the foregoing remedies is commercially feasible, refund the license fees paid by Customer hereunder, if any, less depreciation for use assuming straight line depreciation over a five (5)-year useful life and terminate this Agreement. Notwithstanding the foregoing, BearStar shall have no liability under this section if the alleged infringement arises from (i) the use of other than the current unmodified release of the Product, (ii) use of the Product in a manner other than that specified in this Agreement, or (iii) modification of the Product or combination of the Product with other equipment or software not provided by BearStar, in each case if such action would have been avoided but for such use or combination.  Notwithstanding anything to the contrary in this Agreement, the foregoing states BearStar's entire liability and Customer's exclusive remedy for proprietary rights infringement relating to the Product.
        
10.     LIMITATION OF LIABILITY.  EXCEPT FOR A BREACH OF SECTION 5 (CONFIDENTIALITY), NEITHER BEARSTAR NOR ITS LICENSORS SHALL BE LIABLE TO CUSTOMER OR TO ANY THIRD PARTY FOR CONSEQUENTIAL, INDIRECT OR INCIDENTAL, SPECIAL OR EXEMPLARY DAMAGES, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOST DATA, RE-RUN TIME, INACCURATE INPUT, USE OF DIGITAL CERTIFICATES OR DIGITAL SIGNATURES, WORK DELAYS, INABILITY TO ACCESS THE INTERNET, TELECOMMUNICATIONS FAILURES, HACKERS, BUSINESS INTERRUPTIONS OR LOST PROFITS, EVEN IF CUSTOMER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, ARISING OUT OF THIS AGREEMENT OR USE OF THE PRODUCT OR SERVICES PROVIDED BY BEARSTAR.  EXCEPT FOR A BREACH OF SECTION 5 (CONFIDENTIALITY), UNDER NO CIRCUMSTANCES SHALL BEARSTAR'S LIABILITY TO CUSTOMER OR TO ANY THIRD PARTY ARISING OUT OF OR RELATED TO THIS AGREEMENT OR THE PRODUCT OR SERVICES, EXCEED THE AMOUNT PAID BY CUSTOMER HEREUNDER, REGARDLESS IF ANY ACTION OR CLAIM IS BASED ON CONTRACT, WARRANTY, INDEMNITY, NEGLIGENCE, STRICT LIABILITY OR OTHER TORT OR OTHERWISE.  

Customer acknowledges that no computer system or software can be made completely secure, and that the use of the Product does not guarantee the safety or security of Customer's systems or information.  Customer is responsible for implementing and monitoring appropriate security procedures and for making appropriate back-up copies of all data.

11.     Export Compliance and Foreign Reshipment Liability.
THE PRODUCT IS SUBJECT TO EXPORT, REEXPORT AND IMPORT RESTRICTIONS.  CUSTOMER SHALL NOT EXPORT, REEXPORT, OR IMPORT, DIRECTLY OR INDIRECTLY, THE PRODUCT OR INFORMATION PERTAINING THERETO TO ANY COUNTRY TO WHICH SUCH EXPORT, REEXPORT OR IMPORT IS RESTRICTED OR PROHIBITED BY THE GOVERNMENT OF THE UNITED STATES OF AMERICA OR THE LOCAL LAWS OF CUSTOMER'S JURISDICTION, OR AS TO WHICH SUCH GOVERNMENT OR ANY AGENCY THEREOF REQUIRES AN EXPORT OR IMPORT LICENSE OR OTHER GOVERNMENTAL APPROVAL AT THE TIME OF EXPORT, REEXPORT OR IMPORT WITHOUT FIRST OBTAINING SUCH LICENSE OR APPROVAL.
        
12.     U.S. Government End Users.  For any Products acquired directly or indirectly on behalf of a unit or agency of the United States Government, this provision applies.  For civilian agencies: the Products were developed at private expense; are existing computer software and no part of them were developed with government funds; are a trade secret of BearStar for all purposes of the Freedom of Information Act; are commercial items and thus, pursuant to Section 12.212 of the Federal Acquisition Regulations (FAR), the Government's use, duplication or disclosure of the Products is subject to the restrictions set forth in this Agreement and is incorporated into the contract or purchase order between BearStar and the U.S.  government agency; in all respects are proprietary data of BearStar; and are unpublished and all rights are reserved under the copyright laws of the United States.  For units of the Department of Defense ("DoD"): The Products are commercial computer software (and commercial computer software documentation), and pursuant to DoD FAR Supplement Section 227.7202, use duplication or disclosure of the Products is subject to the restrictions set forth in this Agreement and is incorporated into the contract or purchase order between BearStar and the U.S. Government agency.

13.     General Provisions.  This Agreement shall be governed by and construed in accordance with the laws of the Netherlands, irrespective of its choice of law principles.  The parties agree that the United Nations Convention on Contracts for the International Sale of Goods shall not apply to this Agreement.  Except as otherwise provided herein, this Agreement shall be binding upon, and inure to the benefit of, the successors, executors, heirs, representatives, administrators and assigns of the parties hereto.
Notwithstanding the foregoing, Customer shall not have the right to assign this Agreement, by operation of law or otherwise, without BearStar's prior written consent, not to be unreasonably withheld.  Any such purported assignment of this Agreement without obtaining written consent shall be void and of no effect.  If any provision of this Agreement shall be found invalid or unenforceable, the remainder of this Agreement shall be interpreted so as best to reasonably effect the intent of the parties hereto.  The failure of a party, at any time or from time to time, to require performance of any obligations of the other party hereunder shall not be deemed a waiver and shall not affect its right to enforce any provision of this Agreement at a subsequent time.  Any purchase orders or similar documents relating to the Product issued by Customer or otherwise will have no effect on the terms of this Agreement.  This Agreement constitutes the entire understanding and agreement of the parties hereto with respect to the subject matter hereof and supersedes all prior and contemporaneous agreements, understandings, or purchase orders between the parties.  Any term or provision of this Agreement may be amended, and the observance of any term of this Agreement may be waived, only by writing signed by the parties to be bound thereby.
Except as otherwise provided for in this Agreement, any notice, demand, or request with respect to this Agreement shall be in writing and shall be effective on the date received (unless the notice specifies a later date) only if it is sent by a courier service that confirms delivery in writing, or if sent by certified or registered mail, postage prepaid, return receipt requested, addressed to the respective address of the party, attention to Legal Department.  Any party may change its address for such communications by giving notice thereof to the other party in conformity with this Section.
In any action to enforce or interpret any part of this Agreement, the prevailing party shall be entitled to recover, as an element of the costs of the suit and not as damages, reasonable attorneys' fees to be fixed by the court (including without limitation, costs, expenses and fees on any appeal).

Snipweg 33,
7331 LS Apeldoorn, The Netherlands.


1.4.1: Copyright for Open Source parts of IVT

For the HIGHLIGHT and history search functions that use regular expressions, IVT uses the PCRE library (Perl Compatible Regular Expressions), details of which can be found at http://www.pcre.org.
As the website says: "The PCRE library is free, even for building proprietary software", and thank you very much for providing this excellent package.

The documentation for the Perl expressions can be found at: http://perldoc.perl.org/perlre.html

The PCRE library is released under the BSD license, which reads:

THE "BSD" LICENCE
-----------------

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

End of quote.


1.5: Copyright Notice PuTTY

Much was learned from studying the source of PuTTY, an SSH/TELNET client that is open source. Bits were copied and modified, improved and merged with IVT, as permitted by the licence as long as it is stated clearly and the text of the licence is copied. Unicode character handling and full-screen mode are examples of such derived code. So:
Start quote:
------------------
PuTTY is copyright 1997-2025 Simon Tatham.

Portions copyright Robert de Bath, Joris van Rantwijk, Delian Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, Justin Bradford, and CORE SDI S.A.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
------------------
End of quote.

And I would once more like to thank the authors of PuTTY for making this available. IVT also borrowed most of the SSH code from PuTTY, which was modified to support the multi-session feature of IVT and extended in various ways to integrate better with the rest of IVT. Having the source of a working SSH client for Windows made this a *lot* easier.


1.6: Command line parameters of IVT

IVT accepts the following parameters on the command line (click on any of the hyperlinks for more information):


VERSION: xx.yy. USAGE: IVT [{-|+}<options>] [VARS] <host> <loginname> [args]

-A      : Automatic startup from CREATE statements in IVT.RC
           Use +A to disable automatic creation of sessions on startup.
-agrp   : Automatic startup, use group code 'grp'.
           This option can be repeated to start multiple groups.
           Note: No space is allowed between the -a and the group name.
-B      : Suppress display of graphic introduction (banner) screen.
           See also SPLASHTIME.
           The banner is always suppressed if there is a "nosplash" file in
           the current directory.
-C<scr> : Call script scr when connection to host established (see ONCONNECT).
-c<file>: Use 'file' as the ONLY IVT.RC file.
           Note: No space is allowed between the -c and the file name.
-h      : Enter hypertext manual of IVT (complete on-line documentation!)
-I      : Ignore Windows startup mode (MAXIMIZED/MINIMIZED)
           See also IVT_SHOWNORMAL environment variable.
-n      : No attempt to do autologin.
-p      : Secure mode - No sub-processes started ever
-s      : Secure mode - No multiple sessions, no sub shell
-T      : Turn startup Tips off.
-Q      : Do NOT start the "Start group on startup" groups.
-u <url>: Parse URL and open a new tab in a running instance (or starts IVT).
-x      : Turns status line off
-L      : Suppress appending of .LOGIN to NetBios hostnames
-N      : Use NetBios protocol stack
-P<prof>: Select prof as startup PROFILE.
           Note: No space is allowed between the -P and the profile name.
-S      : Use serial protocol
-D      : use DUMMY protocol.
-W      : Use WINSOCK/TELNET protocol.
-2      : Use SSH Version 2 protocol.
-4      : Force use of IPv4
-6      : Force use of IPv6
File transfer available.
Scripting language available.
Receive file (ESC g) and Run command (ESC R) available.
Support for encrypted .RC files available.
Challenge/response protocol available.


1.7: Version number of IVT

IVT is under continuous development. New features get added regularly and the few bugs that may exist get fixed real fast.

When problems exist, it is important to be able to identify the version used.
Therefore, the version number is displayed when IVT is invoked with bad parameters (see usage).
It is also displayed in the about screen.
Furthermore, the support e-mail address is displayed there too, so you know where to send questions for support.

See the news screen for a detailed description of new features.

Compile time features are shown when you invoke IVT with bad parameters.


1.8: The news screen explained

The F4-N screen documents the development of IVT.

The BUILDNR uniquely identifies each build of IVT. Every time something significant is changed in the functionality, the change is documented in the news screen, identified by date and IVT version number.
The idea is that, every time you get a new version of IVT, you use F4-N to read up on the changes and extensions in functionality that might affect you.
When you run a new version for the first time, IVT will show this news screen automatically (but see NO_SHOWNEWS).

The last character of the version number is changed every time an executable is released (bug fixes, very minor changes).
The minor digit of the version number is changed every time something significant is changed (new features, changed functionality).
The major digit of the version number is changed after major overhaul.


1.9: Passing command line options

As shown in the usage screen of IVT, it is possible to specify a lot of different options on the command line. The options can either be preceded by a + or by a -. Using a - will turn an option ON, using a + will reverse the meaning of an option.

So -s will turn secure mode ON and +s will turn it off.

Some options take an argument. This must NOT be separated by spaces from the option letter itself, so:


  -cc:/my/startup.rc

must be used to force IVT to read only the specified start-up file and no others (the option is -c and the argument is c:/my/startup.rc).

You can also use the OPTIONS keyword in an IVT.RC file to change the options that were specified on the command line.

Currently, options are not stored in IVT variables so there is no easy way to find out (in a script) what options are in effect.


1.10: Assigning script variables from the command line

Between the last option and the hostname on the command line, you can specify multiple arguments in the form of:


   Variable=value
   "Variable=Value with spaces"

IVT will GSET all variables to the specified values, making these variables available in all subsequent sessions (unless destroyed using UNSET).

This way, you can pass information into IVT from the command line.
See also ONCONNECT, to start a script as soon as the session is established.
See also BATCHMODE, to specify you are using IVT as a batch application.
See also $ENV_ variables to reference the environment.


1.11: Specifying a hostname on the command line

The hostname IVT is to connect to initially, is either specified on the command line directly or specified using a CREATEGRP statement combined with the -A or -agrp options on the command line.

Hostnames depend on the protocol that you use to contact a host. For example, when you use a serial line connection there really is no 'host', but only a communications device that you must specify (a modem port). So a command line might look as follows:


        IVT -S com2,9600,n,8,1

This will direct IVT to use a serial protocol, and the initial connection should be to COM port 2, with a given baud rate, parity, data bits and stop bits setting. Once IVT is started, you can create other sessions (either to another serial port, or by changing the PROTOCOL, to an entirely different type of host).

I'm very proud of the multi-protocol support of IVT - it will run anything over anything, and different sessions are supported on different protocols simultaneously. I have used TCP/IP sessions from my home-PC to my home Unix box while at the same time using the modem to dial out to another Unix box that used IVTMUX to enable me to run several sessions there also.

You can read more about these protocols in this chapter.


1.12: Passing a URL on the command line (-u)

IVT is integrated with a browser (like Chrome, Firefox or IE).
A browser can follow a link of type:


   ivt://hostname/[Statement[;Statement;...]]

The code you need in the HTML would be something like:


   <A href="ivt://somehost">Login to somehost with IVT</A>

This will cause IVT to be executed, passing it the URL with a preceding "-u" option. This new instance of IVT will not create a window or a session, but first determine if there is an instance of IVT already running and available for a new session. If no instance is running, or the instance found is busy in some way, IVT continues with normal startup.
If an instance is available, the URL is passed to it.

Either way, the URL is interpreted as a command to open a new session.
If that instance of IVT is viewing the built-in manual, or using setup, or using some other dialog or feature, the user will have to return to normal session mode before the session can be created.

The hostname can be any form of hostname IVT normally accepts, and if that is the only information in the URL, IVT will open a session to that host with default settings. The "hostname" can even be the name of an IVT session group, in which case all the sessions described in that group are created.

Additional information can be passed in the URL.
As an example:


   "ivt://rohan.snipweg.wxs.nl/PROTOCOL DUM;NO_GUI_RESIZE"

Would cause IVT to behave as if those commands were read as part of a script, so the protocol will be DUMMY and resizing will be disabled.
There is no limit to the number of statements that can be passed this way.
All statements have to be separated using semicolons (;).
IVT understands escaped characters in the URL of form %XX (two hex digits) to encode a single ASCII character. So the above can be written as:


   ivt://rohan.snipweg.wxs.nl/PROTOCOL%20DUM;NO_GUI_RESIZE

All commands are synthesized into a script that is executed just like a PRECONNECT script - before the session is established. The same rules apply.
Another example:


   ivt://rohan.snipweg.wxs.nl/USER=ruurdb

This will connect to the given host and attempt to login as the given user.
By default (when no user is given), IVT will use the auto login system, which will select a default user for the host.

Note that this can be used from a command file (shell script) to cause new sessions to be opened inside a running IVT, or have an HTML page with links to your machines that IVT will connect and login to by clicking on those links.

For this to work, there must be a HKEY_ROOT_CLASSES\IVT key in the registry of Windows with the appropriate values to point the browser to the IVT executable.
IVT will attempt to insert those values into the registry every time it is started and when it is installed. However, this requires admin privileges, so depending on your environment, this may or may not work.

The -u command line option is always available from a command file, however.

If you have multiple copies of IVT running, the first one returned by Windows is asked to open a new session (the others are ignored).
It is, however, against the design idea to have multiple instances of IVT, the multi-session features of IVT make this unnecessary.

See also $IVT_URL_STARTUP and $URLUSER.

You are viewing this in a browser. If this feature works on your PC, clicking here:
ivt://DummySession/PROTOCOL "DUM";BEEP;Call NonExistingProc
should open a session to a host called DummySession using the DUMMY protocol. It should also BEEP and emit an error message about a CALL to a procedure that does not exist.
Every time you click it, the same IVT instance should open a new tab with an identical session.


1.13: Integration with password managers (like SecretServer)

Programs such as SecretServer manage secrets (like passwords) and often have a method of starting an external program to open a session to a certain host.
The password manager will then start that external program, passing it the name of the desired host, the user to login as, and the password.

When IVT is configured as the external program, you do NOT want a separate instance of IVT started for every session, but rather a new tab should appear for such a session. IVT can already do this using a URL, to integrate with a password manager is a matter of translating the command to start a session into a URL command. IVT has the "-u" command line option for that. For example, when "$h" is the host, "$u" is the user and "$p" is the password as provided by SecretServer, starting IVT like this will open a new tab to that host, log in as that user and will use that password when the host prompts for it:


   C:\path\IVT.exe -B2 -u ivt://$h;SecretUser=$u;SecretPasswd=$p

The "path" must be the full path to IVT, normally like:


   "C:\Program Files\BearStar Software\IVT Secure Access\ivt.exe"

A little scripting in the standard util.ivt module of IVT will intercept this command and make the proper arrangements for the tab to open.


This is an important feature, others are prev/next


2: Several useful facilities of IVT

2.1: The scrollback buffer

IVT can store text that has scrolled from the top (or bottom) of the screen. This is one of the major features of IVT, and one that you quickly learn to rely upon. Long running make's with lots of output, error messages that get displayed to be cleared immediately by broken software - IVT can bring it back to the screen.

The amount of memory that is used can be specified using HISTORY.
The default number of saved screens is 10.

IVT can page through the history screens by entering the pager, which is accomplished by typing one of the commands below. Once in paging mode, the ALT is optional, and the keys move the screen in the expected direction:

(ALT)-PageUp One screen up.
(ALT)-PageDown One screen down.
CursorUp One line up.
CursorDown One line down.
Home To first remembered line.
End To last remembered line.
ALT+s Save history screens to file.
F3,^F,/,? Search through the buffer (see also COLOR_SEARCH).

Using the scrollbar is an even easier way to access this history data.
Also, you can use the mouse wheel to scroll.
NOTE: When you use the mouse wheel, an extra feature is available. If data arrives on the session while you are viewing history, older versions of IVT would display all that data in a flash when you exited from the history viewer.
Starting with version 23.0 of IVT, this data silently becomes part of the history, so when you use the mouse to scroll to the end, more and more of this new data is displayed just as if it were part of the history data all along.
This works only when you use the mouse to scroll. When you use the keyboard and try to keep up with incoming data, some of the PgDown or Cursor-Down keys would be seen as history-viewing commands (and handled locally by IVT), but when you actually catch up with the incoming data and IVT exits the viewer, all these keystrokes would suddenly go to the remote host, with unpredictable results. So, when you use the keyboard, only ESC exits the viewer and all data that has arrived in the meantime is displayed as fast as IVT can manage.

Of course, you can also cut from the screen or print it (F2).
This can also be combined (use mouse or ALT+c to select part of the screen, then use F2 to print just the selected part).

Typing ESC exits the pager. Typing any data-generating key other than ESC will also exit the pager and send that keystroke on the session.
If you use the scrollbar or mouse wheel, the pager exits automatically when you reach the end (i.e. current screen) part of the history.

You can search through the history buffer using the same method as in the IVT manual pages, which may look familiar to users of VI:

Searches can also be started from the 'Edit' menu or from the pager menu bar. Normally, a search uses regular expressions. If you are not familiar with those, or you need to search for a string that contains special characters, you can use the 'search plain text' option, which will search for the literal string instead of a regular expression.

Incoming data on a session is blocked while you are viewing history.
You can also switch to another session from the history-pager! However, the session stays blocked until you return it to normal mode. This allows you to view error-messages from (say) a compiler on one session while fixing them on another.

For reasons of efficiency, duplicate lines are filtered from the history file.
For example, when the Unix 'vi' editor starts, it clears the screen, then prints a ~-character at the start of every line. Only one blank line and one line with a ~ are stored in the history file. This may sometimes distort the images of screens, but usually nothing important is lost this way.

The entire contents of the history buffer (for the current session only, of course) can be saved to a file. This makes it easier to search or edit it outside of IVT. This is only possible when the secure option is disabled.
To save the file, type ALT+s while in the pager (or use the menu).

The "Edit" menu on the menu bar contains three items to manipulate the scroll back buffer:

Note that the 'Extra' menu on the session menu bar has a command to print the contents of the clipboard.

Also note that AUTOLOG is normally on and everything that is displayed on the session is also logged to a file. The file can be accessed by clicking the notebook icon in the status line (on the far right).


This is an important feature, others are prev/next


2.2: Using the mouse

I have gone through considerable lengths to make the mouse usable in IVT.
The following possibilities exist:

Click on any of the above for more information.


2.2.1: Configuring the default mouse action.

The default action for the mouse can be programmed with the MOUSE command in your IVT.RC file.
The default is CUTPASTE, which means the LEFT mouse button will initiate a CUT operation, the RIGHT mouse button will paste the default buffer.
The default buffer is the clipboard.
You can, of course, change the mouse-action from this setup-screen and save the new setting into the registry.

Furthermore, the MOUSE_KEY command can be used to program actions that are initiated when a mouse button is clicked in combination with keyboard keys.
Such actions can be programmed for individual sessions (MOUSE_KEYLOC) or for all sessions (global MOUSE_KEY statements).


2.2.2: Simple cutting and pasting with the mouse

The basic mouse-driven CUT operation is started by clicking the LEFT mouse button (see MOUSE command to change this behavior).
At the start of the CUT, you have a select window (the colors of which can be set with the COLOR_CUT command).
Drag the mouse around to select the part of the text you wish to copy.
When the mouse nears the top or bottom of the screen, it will auto scroll up or down to show history data, see COPYSPEED. Pressing SHIFT will triple the scroll-speed.
Release the mouse button, the window will disappear (DO NOT BE ALARMED).
X-windows leaves the selection on-screen, which I think is wrong, since it alters the display more or less permanently. IVT will restore the application screen when you have finished a CUT operation.
Update: see the LEAVE_COPY_SELECTION to change this behavior.
Update: see the MOUSE_SELECTION make IVT behave like PuTTY/XTERM.

The selected area is now stored in the default buffer. It can be viewed by typing F4-K. It is also stored on the Windows clipboard, so you can paste the contents into other applications.

Pasting is accomplished (by default) by using the RIGHT hand mouse button.
This will actually paste the Windows clipboard again (in case you have used another application to modify the clipboard).
The contents are pasted into the current session.

For people with a minimalist mindset, this is all you need to know.
However, IVT supports various advanced actions to cut words and sentences in various efficient ways. See below for details. Please take the time to read that, it can save you lots of time in the long run!


2.2.3: Advanced copying and pasting with the mouse.

A common action is to select words and phrases from the screen. This can be done with the simple cutting, but there are quicker ways:

The F1 key can be used to toggle between BLOCK-select and LINE-select.
In the default BLOCK-select mode, IVT selects a rectangular block of characters. In LINE-select mode, all lines between the first and last are selected entirely (like most word-processors do).
The default behavior can be changed using the CUTMODE keyword.

All these keys allow you to quickly select a particular area of the screen using the default paste-buffer. See below for a description of MULTIPLE buffers.

Note: You can configure various levels of Putty compatibility using the MOUSE_PUTTY_WORDS and MOUSE_PUTTY_SELECT options.


2.2.4: Using multiple cut/paste buffers with the mouse.

The previous paragraphs describe how text can be selected and stored in the default paste-buffer. However, sometimes a single buffer is inadequate. An editor like VI maintains multiple (named) buffers to store text in. IVT can do the same.

During a CUT operation you can type a single alphanumeric key. This will end the CUT-operation and store the selected text into a paste-buffer with that name. A PASTE can be done either with the mouse or from the keyboard:

Special feature: When the alphanumeric key you type is in UPPER case, IVT will APPEND data to the buffer with the lower-case name, rather than replacing data. This is similar to what VIM (Vi Improved) does.
You can use this to grab bits and pieces of text into the same buffer. You cannot append data to the default (unnamed) buffer this way.
See also ESC<space>e, which allows the host to control the contents of the clipboard and the named IVT copy/paste buffers.

The current contents of all named (and default) paste buffers can be viewed on the F4-K screen.
Use F4-K-W to save them to a file. F4-K-R will read such files.
See also the LOAD keyword in IVT.RC files.


2.2.5: Programming the mouse in combination with the keyboard

It is possible to configure the mouse to send data on a session, or even to interact with the host in complex ways by means of a SCRIPT.
See the MOUSE_KEY statement, which allows you to configure this, either as the default action for a mouse button or an action that happens when you press a keyboard key in combination with a mouse button.


2.2.6: Cutting and pasting with the keyboard.

Normally, you would perform cut and paste operations with the mouse.
However, you can also perform cut/paste operations using the keyboard. You enter cut-mode by typing ALT+c. As a bonus, you can also edit the screen contents while performing a keyboard-driven cut-operation. This allows you to edit mistyped commands in environments that do not support command-editing.

The idea is to first move the cursor to the position on the screen that is the start of the area to cut (using cursor keys, HOME/END, etc). Then you press control (and keep it down) and use the same keys to extend the selected area. Press RETURN to terminate the cut-operation. Press ESC to abort.
When you do a SHIFT+RETURN, you can type a key to store the named buffer.

Valid keys while cutting with the keyboard are listed below:

Cursor-keys Move the upper left-hand corner of the cut-window
HOME/END Move to Begin/End of line
PageUp/Down Move to Begin/End of screen
TAB Move to next tab position
SHIFT+<move> Triples the number of characters/lines moved. When you use Shift+PgUp or Shift+PgDown, it moves to the very top of the buffer (Up) or to the end (Down) immediately.
CTRL+<move> Extends the cut-window in the move-direction
DELETE Delete the current character from the screen.
Any character Written to screen in either Insert or Replace mode.
INSERT Toggles between Insert and Replace mode.
RETURN Yank the cut-window into default buffer, ends cut mode.
SHIFT+RETURN Waits for a key and stores contents in this named buffer.
F1 Toggles the cut mode.
F2 Print the current selection.
F10 Interpret selection as host names and connect to them all.
F12 Select the current word, use again to select current line.
F11 Undoes last select-action.
ESC Abort cut mode (all paste buffers remain intact).

A keyboard paste is done by typing ALT+p (default buffer).
See also SHIFT+ALT+p for pasting named buffers.


2.2.7: Resizing the terminal window with the mouse.

The window can be resized in the normal Windows ways.
The new size will also be communicated to the remote host if the current protocol allows it (TELNET and MULTIPLEX, for example).
The upshot of this is that, when for example VI is running in a TELNET session, it will receive a notification from Unix that the window size has changed. This will cause VI to redraw the screen according to the new number of rows and columns.

The new window size will be the default for sessions created from the resized one. Different sessions can have different window sizes and positions, IVT will try to make the behavior of these sessions 'logical' (position of the window when switching between sessions of different sizes).
You can also choose to propagate a size change to all sessions using the SIZE4ALL feature (normally, every session's size is independent of the others).

The new size can also be saved into the registry by typing F3, followed by a click on <SAVE>. The chosen size is now the default terminal size for future invocations of IVT.


2.2.8: Clicking on the various parts of the status line.

The status line in an IVT session is mouse-aware. The following possibilities exist:

When you hover the mouse over the various parts of the status bar little tooltip windows try to make you aware of the possibilities.
These can be turned off using NO_TOOLTIPS.


2.2.9: Selecting a session in the F4-S screen with the mouse.

The F4-S screen allows session maintenance. It is entered by either typing the F4 key followed by an 's', or by clicking on the appropriate part of the status line.
Another way is to use the WINDOW item on the session menu bar, select the "Session overview" item there.

All existing sessions are displayed here. Simply double-click on the line that describes the desired session and IVT will switch to that session.

You can also rearrange the order of the sessions here by using the up/down buttons.


2.2.10: Interpret selection as host names and connect to them all

If you select text on the screen using either the mouse or the keyboard and press the F10 function key while selecting, IVT will interpret all words in the selection as host names and will create an instant group of sessions to them all. This can be very convenient if you have some selection of hosts on screen that you need to correct some problem on.

This function is also available from the "Edit" menu, so you can use some other application to store information on the clipboard and let IVT interpret the contents of the clipboard as host names.

This function will use the current value of $URLUSER as the name of the user to login. When not set, the password learning system will attempt to find a default user. If you have disabled password learning, you will have to login manually.
You can also use a PRECONNECT script to set the value of $URLUSER dynamically.

When the number of hosts in the selection is less than 4, a failed connection is treated normally (error messages, the session is kept so you can read the errors and close the session manually). For a larger number of sessions, the failures are quietly deleted, so if you select a large number of words, some of which are valid host names and many are not, the result will be that you end up with sessions (tabs) for the valid hosts only.


2.2.11: Store text on clipboard from a script

The IVTFUNCTION "Copy String to Clipboard" takes a string parameter.
The contents of that string are stored on the Windows clipboard.
This allows a script to control the contents of the clipboard: use with care.

Passing an empty string will clear the clipboard.

Example:

IVTFUNCTION("Copy String to Clipboard","WAIT", "My Example string");


2.2.12: Kill all session but this one

The IVTFUNCTION "Kill all sessions but this" can be used to perform the same function that the context menu of the session tab provides: Close all sessions except the current one.
Handle with care, as all other sessions are forcefully closed.


2.2.13: Show session events

This menu option in the 'Sessions' menu can be used to view the SSH or Telnet debug after a session has been established.
When something fails during session establishment, you can use the SSH_DEBUG or TELNET_TRACE options to view the details of the protocol. But if that is too late, the 'Show session events' menu option can be used to save the details to a text file and invoke the standard editor of the system on that file so you can study the details at your leisure.
This option can be used on any existing SSH or Telnet session.

The (temporary) work file with the log is removed when IVT exits.

Putty has the 'Show events' option in the menu for this, IVT was lacking that feature and that just wouldn't do :-)


2.3: Themes (manage color themes)

Themes are a new feature in IVT 26.1 (July 2018).
IVT is now shipped with 50 different color themes, which have been borrowed from Putty. Choosing and activating a color theme in Putty requires manually loading a bunch of settings into the registry and it has no preview of a theme.

In IVT, working with these themes is much easier:

That is all.
Note: The "Solarized Light" and "Solarized Dark" themes are particularly attractive.

Under the hood, a theme is an IVT script that can be called like any other.
So you can have custom scripts that can activate themes as they see fit, for example, in a default setup file:


   Script STARTUP
      Call THEME_COLOR_Solarized_Dark()
      NO_COLOR_FOR BOLD FOREGROUND      # But overrule the bold color
      BOLD_STYLE SHADOW                 # I like boldness
   END

will activate the "Solarized Dark" theme, but with a tweak. Most themes will arrange for bold characters to be shown using a color, and the Solarized theme uses a color that is almost the same as the default foreground (so you can hardly distinguish bold text from normal text). Personally, I like it better when bold is truly bold, so I disable the color-for-bold, and change bold display to a shadowed font. Likewise, any setting set by the theme can be tweaked or overruled by subsequent commands.

All themes are coded in a new plugin, see the "Plugins" directory of IVT for the details.

If you find a Putty theme that you want to use and is not part of IVT: In the "Support Programs" directory of IVT is the Perl script that I have made to convert the cryptic Putty registry names into IVT themes.
The script is meant to be self-explanatory.


2.4: Locking the keyboard

It is possible to lock the keyboard either explicitly or under timer control.
Unlocking the keyboard is done by typing the password followed by a RETURN.
First, the password must have been defined. This can be done by using the PASSWORD directive in an IVT.RC file. The password can be:

An encrypted password can be obtained by using the 'IVT-locking password' on this basic setup-screen. When a password is typed here, the one-way encrypted version is displayed. This 13-character long string must be used as the parameter for the PASSWORD directive in the IVT.RC file.

For your convenience, the encrypted version of the password is placed on the Windows clipboard, so it can be pasted into a PASSWORD statement in your IVT.RC file.

The keyboard is locked by typing ALT+L. A lock-icon (keys) will appear on the status line.

Another possibility is to use the LOCKTIMER keyword in the IVT.RC file (or by setting it using setup). This specifies the number of minutes that must pass before the keyboard is locked automatically when no keyboard activity is detected. 30 seconds before the keyboard is locked, IVT will beep and start a countdown in the status line. Type a key to abort the countdown.


2.5: The "Scripts" menu

IVT has had the possibility to create a "Custom" menu for many years. This allows you to have a home-rolled entry on the menu bar that contains entries to start scripts of your own making. Few people use this powerful feature, so in release 21.1 is has been made more prominent.
In release 23 the option was added to have MULTIPLE menus.

The standard configuration file of IVT now uses this to define an entry called "Scripts", and creates several menu-entries in there:

By editing the IVT.RC file, or - better - overriding or extending the default configuration in your own local IVT.RC file you can start your own scripts with just a few mouse clicks, too. The standard IVT.RC file uses INCLUDE_OPT on the HOMEDRIVE/HOMEPATH environment variables to load a personalized configuration file (normally C:\Documents and Settings\YOUR NAME\ivt.rc).
That file is typically intended to extend/alter (or suppress) such a menu and alter other settings of IVT.
The scripts menu bar contains an entry to start NOTEPAD on that file.

See the stock IVT.RC file for more examples, and the MENU keyword.
See also DELSCRIPT to delete a loaded script from memory so you can load a new version, convenient for development.


2.6: Project files

IVT is very configurable, through very many means, and can be used for very large projects, large groups of users, and is able to provide all sorts of powerful features to make life easier for those large groups of users.

Unfortunately, all this power is not always easy to find, or to use.
A script called "Projects.ivt" tries to make configuration of IVT in such complex environments easier.

In short, a "project" presents itself to the user as magically appearing entries in the address book, and magically appearing "Create groups" in the GROUP menu. Projects can also add custom menu to the menu bar.
Connecting to a host will use a proxy when required, and "knows" how to connect and login (ssh, telnet, special attributes, special login constraints like OS hardening, etc).

In more detail, what a "project" tries to achieve is:

The project files themselves must be written using a text editor. Every project has at least:

All files of a project (acme.rc, acme.hosts and acme.ssh) must be in the same directory. There is one directory built into the projects.ivt script where IVT will look for project files ($IVTDIR/Projects).
The standard distribution of IVT has an example project there. But that directory is private, and one of the major benefits of projects is that they can be shared by all people who work on a project.

To facilitate this, the projects.ivt script will use a FORALL on variables named "PROJECTSDIR_*".
Every such variable is assumed to name a directory that is searched for .RC project files. For example:


GSET PROJECTSDIR_ACME_GENERAL = "Q:/Program files/IVT/Projects"
GSET PROJECTSDIR_ACME_SALES   = "P:/Sales/IVT/Projects"

would cause IVT to look in those (network) directories for projects.
It is not an error to have variables for non-existing directories, the script will simply look for valid files and ignore bad directories, bad files or empty directories.

So, to summarize:

So, this tells the projects.ivt script where to FIND project files, but these files are not READ (loaded) automatically. There are various ways to get a project loaded:

See the example file in the distribution directory ($IVTDIR/Projects) for an example project. Since the whole project feature is not built into IVT itself but handled entirely by scripting, you are also free to modify or extend the scripts itself to better suit your needs.

See also the example script to provide a context menu per host, that demonstrates a real-life project example.

One of the things the project scrip arranges is the management of the special $HOSTLIST_EXTRA variable. You can use this to assign a bunch of attributes to a specific host (and the attribute vocabulary is easily extended). The standard script has support for:

As an example, consider this:

   HOSTLIST bamboo root "My favourite" EXTRA="TERM=ivt\nDIR=/tmp" SSH

When a session is established to the "bamboo" host, it will login as root and set the TERM variable to "ivt" and change directory to /tmp after login.

For more details, study the "projects.ivt" file in the IVT distribution.

NOTE: Set the global variable PROJECTS_DEBUG to 1 if you want to see what the system is actually doing below the covers. Very convenient for troubleshooting complex projects setups.


This is an important feature, others are prev/next


2.7: The session groups editor

A major new feature was introduced in version 16.1a of IVT - the group editor.
Before, the very powerful CREATEGROUP statement was available only to people who took the trouble to read the manual, understand what it was trying to say, then use a text editor to edit the IVT.RC file and add the proper incantations. The reward would be the creation of multiple sessions with a single mouse click, all of them logged in and ready for action (if you are new to creation groups, you are urged to read this).

However, it appeared only a small percentage of the user base actually found this functionality, so 16.1a adds a number of dialogs which require only the use of a mouse and a few keystrokes to add and maintain group definitions.
These definitions are stored in the registry, are loaded on start-up and can be modified and deleted at any time.
Obviously, CREATEGROUP and CREATE statements in the IVT.RC file still work as before, but these cannot be edited with this interface (if you try you will get an error message, but interactively created groups and groups from the IVT.RC file are all shown together and are started the same way).

The editor is available from the F4-G screen (or the <GROUPS> button from the login dialog, and various other ways).
It contains <ADD>, <EDIT> and <DELETE> buttons.
The <ADD> and <EDIT> bring you to a dialog that allows the maintenance of a single group. A group is identified by its name and an optional description which will appear in the F4-G screen.
You can also specify an optional script and parameters here. When given, the script is executed before the first session in the group is created. It can be used to set global variables to be used by all sessions in the group. The parameters are parsed before being used, for example:

   "First parameter" "Second parameter"

will pass two parameters to the script. Use quotes to protect parameters with spaces in them.

For descriptions of the "Preconnect" and "Onconnect" scripts, see the details at the CREATEGROUP manual page.

A group can have the "Start group when IVT starts up" option set.
If you check this box, IVT will pretend you have used the "-agroupname" command line option, and start all the sessions in the group automatically every time you start IVT. The saves you the trouble of having to create a special shortcut with special options to start IVT in a special way, at the price of ALWAYS having the sessions created when you start up (unless you start IVT with the +A option, which suppresses this).
Multiple groups can have this option set, all of them will be created when IVT starts up. Similarly, the "-a" command line option can be used multiple times to start multiple groups.
Use the -Q option to suppress the starting of these special groups, in case you have misbehaving groups or need to edit the definition of a complex group.

A group can contain zero or more CREATE statements, of which the most important attributes are shown in the dialog box. Choose <ADD> or <EDIT> to get a dialog to define a single CREATE statement. The attributes are:

These last 2 items offer very interesting possibilities. Take, for example, the script from the IVT.RC standard distribution called DirCmd (for change DIRectory and run a CoMmanD). It takes 3 parameters, the first being a directory, the second being a command to start after changing to that directory, the third the optional name of yet another script.
The DirCmd script looks like this:


Script DirCmd dir cmd ScriptNm
   LOCAL x
   DESCR "Use this in a session create, params are Dir and Command"

   # Give a decent error message when this script does nothing...
   x = Call IvtWaitLoggedIn
   IF $x == 0 THEN {
      ECHO Concat("DirCmd: Cannot do ",                 \
           ($dir != "") ? "CD $dir " : "",              \
           ($cmd != "") ? "do $cmd " : "",              \
           "because login failed or is disabled.\n")

      RETURN
   }

   WAIT_ONCONNECT("SetUnixEnv");
   WAIT_ONCONNECT("AutoPromptSetPrompt");

   # Highlight with edit-in-tab does this...
   WAIT_ONCONNECT("StartEditOnConnect");
   
   # When we get to this point, all known scripts that want to change the
   # working environment of the shell have done their thing.

   # When CMD is a Clearcase Setview that must PRECEDE the cd.
   LOCAL CmdDone = 0;
   if (substr($cmd,0,17) == "cleartool setview") THEN {
      send "$cmd\r"
      Call WaitPrompt();
      CmdDone = 1;
   }

   # When a directory is passed, CD to it.
   IF $dir != "" THEN {
      Send "cd $dir\n"
      Call WaitPrompt();
   }

   # When an initial command is given, execute it (and not done yet)
   IF $CmdDone == 0 && $cmd != "" THEN Send "$cmd\r"

   # If an IVT scriptname is given (3rd param), call it
   IF $ScriptNm != "" THEN CALL $ScriptNm
END

So, you could set the "Script" field to "DirCmd", and the "Params" to e.g.: /tmp "ls -lab\r" MyScript

Note that the parameters are parsed as if they occurred in an IVT.RC file, so they can be string expressions, reference variables, and so on.
Quotes are significant and important when you have spaces in arguments!

The example will change directory to /tmp, run ls -lab there, and then call the MyScript script (this will have to be written with a text editor, but it is optional, i.e. normally you will pass only two parameters to DirCmd).

After defining any number of entries for the group, click OK and you will return to the F4-G screen. All definitions are automatically saved for you.

The defined group can now be launched by double-clicking it (or select it and click the <LAUNCH GROUP> button).


2.8: Fixing broken groups

As explained in the previous chapter, a CREATEGROUP is a very powerful way to quickly create and initialise a number of sessions. If you use this feature often, you'll find that you rely on the fact that certain sessions are in certain logical positions (session 1 for your editor, 2 for the compiler, 3 for test runs, etc). However, sometimes one or more of these sessions can be lost due to network outage, machine crashes, accidental logout, etc. This leaves you with one or more "holes" in your logical ordering of sessions: a broken group.

One way to fix that would be to manually create the missing sessions and drag them to the proper position using the tab bar or the session re-ordering dialog. A better and quicker way is to use the "Fix" button in the create session groups dialog (Sessions->Start groups of sessions).
If you select a group there that has one or more sessions missing, but at least ONE session of a group left, clicking it will re-create the missing sessions in the proper sequence and place, restoring the normal situation.

When zero sessions of the current group are left, or all sessions of the current group are still intact, the "Fix" button will be disabled (you can't fix it if it ain't broken).

If you have a CREATEGROUP script, it will be run again with an adjusted value of the $IVT_GROUP_COUNT variable (the number of missing sessions).

The current state of a group can also be queried using the QuerySetting function with an argument of GROUPSTATE.

When you use IVTFUNCTION to start a group fix, the 3d parameter must specify the name of the group to fix.


2.9: Starting a session in a new window.

The CREATEPROT statement (used in an IVT.RC file) and the interactive session group editor both allow you to specify the "NEWWIN" option, indicating that a particular session should be started in a separate instance of IVT (in a new window).

Actually, this feature goes against the general design of IVT, which is a "multi-session terminal emulator". The multi-session features allow you to create and manage many sessions in a single instance of IVT. The idea behind its design is that you have one large window to view all that goes on in all sessions. Still, some users are so used to having a window-per-session that they have trouble working any other way. This NEWWIN feature is intended to allow such users to use the session-group features of IVT, so they can still create many sessions with a few mouse-clicks.
Of course, you can always start multiple copies of IVT and run single sessions in them, but this is tricky to manage that properly when you have many sessions.

In a normal session group, all sessions have the same size and color scheme, and share a single window position. You switch between the sessions by using the tabs bar, the keyboard or the mouse.

When you want to start a group of more than two or three windows, it becomes necessary to automatically position and size the various windows on your monitor. The easiest way is to assign a profile to each session that you start in a group. For example, suppose you have a group of 5 sessions, and you want to run each of those sessions in a separate window. You want each window to have its own size and position, and possibly color scheme.
To set this up, do:

You have now created a session profile (called "group-1") for the first session in your group. This profile stores all the ALTERED setup attributes of the session. Repeat as required for the other sessions, uniquely naming the profile (like group-2, group-3, etc). For each profile, make sure you size and position the window where you want it, and use the 'Copy current' button to obtain the proper coordinates. Save those coordinates and size as part of all the profiles.

Now create the group. If you use the interactive group session editor, enter the name of the profile (group-1, group-2) in the "Profile" text field and check the "Start in a new window" checkbox.
If you use CREATEPROT statements in an IVT.RC file, use the PROFILE=group-x clause and the NEWWIN option.
All other attributes in the CREATE can be used as well: Host name, user name, scripts, parameters and so on.

Now you can start the group. Every session that has the NEWWIN attribute will start in a new window and gets the specified profile assigned to it.
The profile will load and apply all settings (size, position, etc.) for that session. If something is not OK for a session, just use setup for that session, alter it, and re-save (overwrite) the profile.
When you start an IVT with the name of your group on the command line, or start IVT and just type the name of the group in the host name field, IVT will create all the other instances and the 'empty shell' that is left behind will terminate automatically.

Note that all your profiles are based on the default profile. So, if you change a setting in the default profile which is not explicitly set in the group profiles, the group-profiles will inherit the new default setting. That can save lot of work when you want to change a default setting and you have many profiles.

This way, a whole array of windows can popup with a single mouse click, every window can have 1 or more sessions, every session can connect to a host and start programs there.


This is an important feature, others are prev/next


2.10: Learn mode & Keyboard macros

It is possible to store a number of keystrokes under any key so when that key is pressed the pre-recorded keystrokes are 'played'. A key can be programmed in learn mode. Programmed keys can be saved in the F4-K screen and loaded upon IVT start-up by the LOAD command in an IVT.RC file.

Alternatively, programmed keys can be saved as part of setup, either as the default profile or a special profile.
Before using the interactive key macro feature, you might want to have a look at KEYMACRO, which allows you to write keyboard macro's in the form of a script, which is more easy to view and alter.
Interactive setup mode is easier to use, though.

Learn mode is entered through this setup screen (choose the button labelled <Keyboard macros>) in setup.

SUMMARY:

Every programmed key can either:

Type F3 and click on "Keyboard macros" to bring up a dialog that allows you to treat one key at a time.
First, you have to choose the key to program (or handle otherwise). Click on the button marked <Choose key to program>. The key you type next is always treated "raw", so if there is an action associated with that key it will not be executed when you type it now.

The original dialog will now show the full name of the key you typed, according to the options selected below.

There are a quite a few options you can choose:

Various fields and buttons will be enabled or disabled according to this choice. All selections are retained between various macro-definitions so you can quickly create many similar definitions.

Type of programming.
When you type a programmed key, the action the macro can take depends on this setting. It can be 4 different actions:

For the "Fixed string" or "Script call" types you will have to click <OK>.

When you click on the <Start recorder> button, programming will start for the other types.
You will now be returned to your session. Everything you type will now be remembered 'under' that key. The status line will show an icon to indicate learn mode ON.

Programmed keys can be nested (when recursion is in effect) up to ten levels deep. There is no practical limit to the length of the recording. Mouse action is NOT recorded.

Ending learn mode can be done by clicking on the menu bar (Keyboard, Stop recorder), or by going to setup and clicking on the <MACRO> button again (which will now be labelled <END MACRO>.
You can also type SHIFT+CTRL+END.
You can also click on the recorder icon in the status line, and it will disappear (and stop the recorder).

The macro can be triggered simply by typing the key again. As explained before, you may have to use the exact same keys (left/right shift, ctrl and alt), and optionally have to match the Capslock, Numlock and Scroll-lock keys.
By default, all the distinctions are turned off, so any way to produce the same character executes the macro.

All the macro's you program can be saved to the registry by saving setup.

Keys can also be saved to file using F4-K-W. The resulting file can be read using F4-K-R or the LOAD keyword in an IVT.RC file.
For your convenience, the <Read/Write macro files> button is a shortcut to the F4-K screen, where you can click on <Save keys>.
Files can be loaded interactively there by clicking on <Read keys>.

There is no way a key can be edited, but it can always be re-programmed or restored to the standard meaning by clicking on <Delete key>.

The Unix keyp program can also be used to program keys. This allows per-session function keys AND keyboard macros to be defined by a UNIX application.

See also KEYBOARDMOD for simple key translations, and BIND to bind scripts to a key from an IVT.RC file.
Most of all, see KEYMACRO to allow complex key-combinations to be defined in the IVT.RC file.


2.11: Help on help - The IVT manual system

IVT comes with its own built-in hypertext manual. You can get into the help system in many ways:

Exiting the manual-page system is done by typing ESCape. Click here for a list of valid keys in the help system.

You can scroll through the manual using the normal means (Cursor Up/Down, PageUp/Down, Home and End will do the expected things). You can also use the mouse to click on the appropriate places on the status line.
You can, of course, also use the vertical scroll at the right of the screen.
This bar also shows the size of each item.

Use F5 to go to the previous topic, F6 to go to the next topic.

The manual is a hypertext manual, which implies that there are words on the screen that are links to other parts of the manual. A link has to be selected first (by using the TAB key until that word is highlighted). The link is then followed by typing RETURN. This will take you to the appropriate part of the manual.
You can, of course, also simply CLICK on a link with the mouse.
Pressing BACKSPACE or clicking the RIGHT button of the mouse will return you to the previous place in the manual. IVT maintains a list of places when you follow hyperlinks, so you can backtrack your links.

You can, at any time, find where you are located inside the manual-system by typing an l for (Location) a w (for Where) or an F8. This will show a popup with the name of the chapter, topic (if any) and paragraph (if any).
This is taken from the table of contents which can also give you an idea about the contents of these manual-pages.

You can also search the entire manual for a word or phrase. Type a ?, or a / will prompt you for a word or phrase (just like VI!).
CTRL+f also works (just like Internet Explorer).
F3 also works (just like many Windows programs).

IVT will first check any word you type against the known list of keywords and topics in this manual. When a match is found, that topic will be jumped to.
This first topic-matching search is case insensitive. So, for example, if you type 'if', this will get you to the manual page of the IF statement, rather then one of the 2106 occurrences of the string 'if' in these manual pages :-)

If no match is found, the search restarts at the start of the manual, looking for a not-so-strict match.
Typing an n will take you to the next occurrence of the word or phrase, typing an N will take you to the previous occurrence (looks like VI!).
When no (more) matches are found, you will get a message stating this.
Normally, searches are case-sensitive, but you can toggle this with a C or c (for case). A popup will show the current setting.
The nearest hyperlink to the search-phrase will be automatically selected.

You can save the current topic to a file using ALT+s.
This is especially handy for the examples - save them and they are ready for use in your own IVT.RC files.

Finally, you can print the entire manual (or parts of it) by typing F2.
You will be prompted to select the appropriate part to print.
Printing will be done on whatever printer is selected.
You can print the entire manual, the current chapter (with all the topics and paragraphs it includes), the current topic (with all the paragraphs it includes) or the current paragraph (all the pages it includes), or just the current screen.
Whenever the printed output covers more than a few items, IVT will automatically generate a printed table-of-contents with correct page numbers.
Every page will also have a header showing the chapter, topic and paragraph names where appropriate. Topics are separated from each other by a solid line.


2.12: Hypertext help keyboard commands

TAB Position cursor on the next hyperlink.
RETURN Follow currently selected hyperlink. Can also be done by left-clicking on this link.
BACKSPACE Return to previous place (return from hyperlink). Can also be done by clicking the right-hand button of the mouse.
F6 Next topic.
CursorRight Next topic.
F5 Previous topic.
CursorLeft Previous topic.
/ Search for a string in the manual pages. Case sensitivity can be toggled using the C command.
? Alias for / (search string).
c (or C) Toggle case-sensitivity of the / command. Default off.
n Search Next search-string (set via / command).
N or P or p Search Previous search-string).
l (lower case L). Show current Location in popup (generated from the Table of contents.
w Where am I (alias for l).
F8 Another alias for l command.
F1 Jump to Help-On-Help screen (or THIS screen).
F2 Print part of a manual (screen, topic, chapter, manual).
ALT+c Enter CUT mode (to cut from manual pages).
Spacebar Scroll down one page.
PageDown Scroll down one page.
PageUp Scroll up one page.
CursorDown Scroll down one line.
CursorUp Scroll up one line.
HOME Jump to start of current topic.
END Jump to end of current topic.
H Jump to start of manual (HOME).
ALT-s Save current topic to a file.

2.13: Save current help-topic to a file.

One of the nice(r) features of the help-system is that it allows you to save the current topic to a file.
This is achieved by typing ALT+s while viewing a topic.
A popup will appear showing the description of the current topic (as taken from the table of contents).
When you acknowledge this popup with a RETURN (ESC aborts), you will be asked for a filename. When a valid filename is given, IVT will write the topic to the file you specify. Since I assume you want to use this feature to save examples of configurations and/or scripts, the following modifications are made to the output in the file:

Note: Saving files is impossible in secure mode.


2.14: Encrypting .RC files

IVT.RC files can contain passwords as part of logon-scripts. To avoid readable passwords in such files, IVT can read DES-encrypted files. Also, you might have other reasons to make your IVT scripts non-human readable.
This is, by the way, how the IVT password learning system works.
To set this up, do the following:

Upon start-up, IVT will ask for the proper password whenever it encounters an encrypted .RC file. When you do not know the proper password, type ESC (this will skip that particular .RC file). When you have multiple encrypted files, IVT will attempt to use the same password for all of them, and automatically prompt for all files that have different passwords.
Of course, IVT will always FIRST try the 'default' password, and if that works, it will not ask for a password at all.

The encrypt/decrypt feature can be used to encrypt ANY file. The algorithm is a slightly modified DES, and a proprietary IVT file format (i.e. pretty safe).

You can also manipulate encrypted files using SCRIPT functions:


2.15: Secure mode

When you pass the -s option on the command line or use the OPTIONS command in an IVT.RC file, IVT switches itself into secure mode.

This mode is intended to lock users into a particular session on a particular host without possibilities to create extra sessions, invoke sub shells or otherwise change the environment in which they work.
See also IVT_DIALOGSTATE.

This more or less assumes that you use IVT on an MS/DOS PC without windows, since on Windows PC's there are plenty of other ways a user may gain access to the environment. Anyway, when IVT works in secure mode the following things are not allowed:

In other words, everything to do with files and processes is forbidden. Also note IVT_DIALOGSTATE, which allows you to disable buttons, menu items or any other part of the IVT dialogs and menus.

See also the NO_STATUSCLICKS option.


2.16: Challenge response protocol

The LOGINC program can be incorporated into most modern Unices.
It is part of the distribution kit of IVT. It should be substituted for "/bin/login", at least for sessions initiated from IVT (TELNET/RLOGIN and/or serial connections you want to protect). Usually, you can specify the login program on the command line of "telnetd" in your inetd.conf file.

When used, LOGINC will do a normal prompt for a user name. It will then prompt for a "Password:" (which will appear on screen) and issue the challenge.
IVT will recognize the challenge. The next line of input you type is used to calculate the response. When you hit ENTER this response is transmitted back to LOGINC, which will check it. When OK, it is accepted as a normal password would have been, when not, it will ask again for a password (just like a normal login program would).

The upshot is that login using challenge/response is totally transparent.
I have changed IVT to issue a message Challenge received so you can see that it actually happens!


2.17: Show current cursor position

Sometimes, when you have a very large screen and a relatively small font and cursor, it is hard to find where the cursor is.
The IVTFUNCTION "Show current cursor position" briefly flashes a large red cross through the cursor so you can easily locate it.

The idea is to use a KEYMACRO to bind this function to a key you find easy to remember so you can hit that key to find the cursor.


3: IVT FAQ: Frequently Asked Questions

This chapter lists the answers to the most commonly asked questions about IVT. This is intended to be as complete as possible.
Please mail to support@ivtssh.nl if you find anything missing.


How do I start a new session?
How do I exit a session?
How can I select words/phrases on the screen with the mouse?
How do I view scrolled-away data?
How do I change and save the configuration of IVT?
The status line of IVT is hidden by the Windows taskbar. What to do?
CAPSLOCK seems to have no effect!
IVT beeps every time I touch a key
Password learning does not work if I don't HAVE a password
Can I use ALT as meta-key for EMACS?
Could IVT be used to emulate the MS Windows command prompt?
Why is there no Linux (or Unix) version of IVT?
Host-printing (controller mode) does not seem to work
HP-UX bizarre one-line display on bottom line problem
IVT fails VTTEST tests it claims to pass!


3.1: How do I start a new session?

QUESTION
I hear IVT is multi-session. How do I create an extra session?

ANSWER
Lots of ways.

Go to FAQ start page.


3.2: How do I exit a session?

QUESTION
How do I quit sessions? How do I get out of IVT?

ANSWER
Normally, NO_RECONNECT is in effect, which means that logging out of your host will normally make the session disappear. Quitting the last session will cause IVT to exit.
When RECONNECT is in effect, IVT will automatically reconnect to the same host whenever the session is normally terminated. Use ALT+F4 in this case to force a hang-up.
Another way is to use F4-S (or click on the hostname part of the status line) and use the DEL key. You will be asked to confirm the kill.
When the last session is deleted, IVT will exit. However, see EXPLICIT_EXIT to change this.

Yet another way: Click the close button. IVT will cleanly kill all sessions and exit ASAP.

Go to FAQ start page.


3.3: How can I select words/phrases with the mouse?

QUESTION
How can I quickly select words or phrases for pasting?

ANSWER
Configure the mouse for CUT/PASTE (default).
Point the mouse somewhere in the word. Click-AND-HOLD left mouse button.
While holding the left button, click-and-release the right-hand button.
Every time you do a right-click, IVT extends the definition of 'word'.
Release left button to finish cutting, the selection is removed from the screen (unlike X, which leaves the selection visible).

Click right-hand button to paste (or type ALT+p).
See here for more info.

See also MOUSE_SELECTION, which allows a more traditional multiple-click selection mode to be configured.

Go to FAQ start page.


3.4: How do I view scrolled-away data?

QUESTION
When data has scrolled of the screen, how do I get it back? What if I want to store more lines?

ANSWER
Type Alt+PgUp or Alt+CursorUp or Alt+Home or Alt+End to enter the viewer. The status line shows the amount of history data.
The scrollbar or mouse wheel is a better way in newer versions of IVT.
The HISTORY command can be used to configure the number of retained screens.

Go to FAQ start page.
Go to FAQ start page.


3.5: How do I change and save the configuration of IVT?

QUESTION
I want to make changes to the setup of IVT but can't be bothered to learn all that complex IVT.RC stuff.

ANSWER
Use F3 to get to the setup screens (or use the menu bar).
Try the myriads of settings there.
Modifications will only affect the current session.
When you are satisfied, click on SETUP and "Save into registry".
Choose the default profile to change default startup settings.
Save as another profile allows you to select that profile when creating a new session.

See "IVT and the Windows registry" for details.

Go to FAQ start page.


3.6: The status line of IVT is hidden by Windows. What to do?

QUESTION
When the screen size of IVT is set to 100% using the WINDOW_SIZE command, it can happen that the resulting window is slightly too large for the physical screen. Part of the TITLEBAR or the status line is obscured by the Windows task bar at the bottom of the screen.

ANSWER
Option 1: Use 98%, or 95% instead of 100% for the screen size. IVT will calculate the number of rows based on the font and such, and should end up with one fewer row.

Option 2: Use the WINDOW_POS command with a small negative value for the Y coordinate. This will position the top of the window off-screen, making the bottom of the window visible. A value of -6 (six pixels) usually suffices.

Go to FAQ start page.


3.7: CAPSLOCK seems to have no effect!

QUESTION
CAPSLOCK is on, yet IVT still produces lower case!  What gives?

ANSWER
It's not a bug - it's a feature - see CAPSLOCK!

Go to FAQ start page.


3.8: IVT beeps every time I touch a key

QUESTION
Every time I type something, or every time the host sends something, IVT rings the bell. How do I turn the noise off?

ANSWER
You probably typed ALT+a (toggles Alert Mode). Again, it is a feature, not a bug, meant to wake you up if the machine is quiet for a long time before producing some output. Another ALT+a disables it.

Go to FAQ start page.


3.9: Password learning fails if I don't HAVE a password

QUESTION
The password learning system does not recognize that I am already logged in, it keeps waiting for a "Password:" prompt until it times out. This account has no password...

ANSWER
Correct. It is surprisingly difficult to analyze all different responses hosts can give when logging in. Therefore, you have to tell the system explicitly to set an empty password. Use F4/X, choose the password learning configuration. From the menu, choose "Add a user manually". When prompted for the password, type RETURN.
Of course, not having a password is not such a good idea...

Go to FAQ start page.


3.10: Can I use ALT as meta-key for EMACS?

QUESTION
I use EMACS extensively, how can I get IVT to send meta- commands (i.e. M-x <command>). I can, of course, use ESC-, but is there I way to get the ALT key to function as a meta key?

ANSWER
Yes. IVT supports keyboard macros that can be used to customize the keyboard.
Newer versions of IVT support the EMACS command.

Go to FAQ start page.


3.11: Could IVT be used to emulate the MS Windows command prompt? 

QUESTION
Could IVT be used to emulate the MS Windows command prompt?

ANSWER
Short answer: No.

Long answer: Just because a Unix (or VMS) prompt looks like the CMD prompt of Windows does not mean they are the same thing. IVT uses some sort of transport protocol to connect to a host (telnet, rlogin, ssh) and the host talks back in a well-defined way. There is no such protocol to connect to a command prompt on Windows. There *do* exist telnet servers for Windows which turn the Windows machine into something that IVT can connect to, but then it is not IVT doing the hard work. Depending on how well such a telnet server works, you may be able to run multiple IVT sessions to it and use IVT's session switching and cut/paste.

But even then, if you start anything on the CMD prompt that requires a GUI interface (and even NOTEPAD needs that), it won't work, since the TELNET interface is restricted to text only.
On the other hand, if you install Unix-like text-utilities such as available from Cygwin, that might provide a workable environment.

See also the next FAQ: Why is there no Linux (or Unix) version of IVT?


3.12: Why is there no Linux (or Unix) version of IVT?

QUESTION
Why is there no Linux or Unix version of IVT?

ANSWER
IVT is a VT220 emulator for the Windows platform. When you run on Linux (or Unix), a text-mode application is already running on a terminal (such as a console). Emulating a terminal is done by the operating system, so IVT would be solving a non-existent problem. Even if IVT were ported (for example because its emulation of a VT220 is better and more complete than what an Xterm has to offer), a platform like Linux already offers multi-session (multiple windows), TELNET, RLOGIN and serial lines support.
What people usually mean is "I would like to use the session switching and cut/paste possibilities of IVT in my Linux environment". I consider that a compliment, since this indicates that these mechanisms are better in IVT than in operating systems such as Linux.

Porting IVT to Unix is possible, but it is a huge amount of work:

In other words, it would be a re-write, not a port, and I have not got the time to do it in, so sorry.

Go to FAQ start page.


3.13: Host-printing (controller mode) does not seem to work?

QUESTION
When the host tries to print data on an IVT-connected printer, it produces a print job but the printer prints nothing.

ANSWER
Your printer driver probably does not support RAW-mode printing. Turn on COOKED mode with PR_CONTROLLER (for all printers) or in this setup-screen for individual printers.

Go to FAQ start page.


3.14: HP-UX bizarre one-line display on bottom line problem.

QUESTION
When IVT is used to login to an HP-UX machine, all output gets printed on the bottom line of the display. Scrolling is broken.

ANSWER
The problem is the TERMINFO entry for a vt220 terminal on HP-UX.
There is an "is2" command in there to reset the terminal (initialization string 2). That command contains the wrong sequence "\E[1;24r".
What that INTENDS to do, is to reset the scroll-region of the terminal to the entire screen. The assumption there is that the terminal has 24 lines. The error is that the command "\E[r" explicitly means "reset scrolling region to entire screen", so it works for ANY size screen. That error has been there since forever. Other terminal emulators work because either their default screen size is 24 lines, the TERM environment variable is set to vt100, or both.

When the IVT window is larger than 24 lines, setting a scrolling region from 1 - 24 means that NO scrolling occurs on lines outside the scrolling region (defined by VT220 emulation rules). Thus, everything displayed there gets hammered on the same line(s), over and over again.

Various solutions:

This is an important feature, others are prev/next


4: How to create, close and switch between sessions

IVT can handle multiple, simultaneously active sessions. Sessions behave like completely independent virtual terminals.
F4-S gives an overview of existing sessions and a re-ordering possibility.
Here you can also change the name of the host in the status line and the status comment.
These functions are easily accessed from the session menu bar.

You can create or close a session at any time and hot-key between them.
To CREATE a session you use:

Menu bar Click on the sessions menu.
TABSBAR Double-click in an empty part of the tabs bar, or right-click there for the session overview.
CTRL-PgDown Create a session and perform auto-login when possible.
CTRL-PgUp Create a session.
CREATE Statements in IVT.rc, combined with -A or -agrp flag.
CREATEGROUP Create a group of logically related sessions quickly.

A session can be cloned, which means that the current session is used to find the host, username and protocol and IVT attempts to create an identical session and do auto-login there. It also copies the window size, font, and all other possibly modified settings of the current session.
Cloning uses the ORIGINAL hostname and username, so when you use scripts to modify the hostname and/or username, those scripts will work correctly for the cloned session, too.

Also, see the PRECONNECT statement to execute a script before a connect is made (to redirect connections, for example).
See also the ONCONNECT statement to execute a SCRIPT after successful connect.
See also WAIT_ONCONNECT to synchronize multiple ONCONNECT scripts.
The panel can be modified by setting the $HOSTPROMPT variable.

For a SERIAL connection, type a DEVICE (e.g. COM2,9600,n,8,1). Only the port name (COM1, COM2, etc) is required, the baud rate defaults to 19200, the parity to none, data bits to 8, stop bits to 0.

For TCP/IP, type HOST[:port]. HOST can be an IP address, port is optional.
You can, of course, also specify the name of a host. See the RESOLVE statement on ways to configure IVT to use non-standard ways of translating hostnames.

To SWITCH TO an existing session you can use:

ALT+1 to ALT+9 Switch to session with that number (1-9)
CTRL-Cursor-key Switch to previous (UP/LEFT) or next (DOWN/RIGHT) (actually switches to the next member in the group). See SESWRAP to configure what happens when you reach the last (or first) session.
ALT+t Toggles between two sessions.
Shift+CTRL+Cursor Switch to FIRST (UP/LEFT) or LAST (DOWN/RIGHT). Also see the SESWRAP command to alter this behavior.
Use the menu bar.

To CLOSE a session (after logout) use ALT+F4. Exiting the LAST session will cause IVT to exit. You can also set the NO_RECONNECT feature, this will cause sessions to be closed automatically when the host disconnects.

Using EXPLICIT_EXIT will close all but the last session.

See also NO_GUI_CLOSE, which can force you to do a clean log off instead of forcibly killing sessions.

See also BATCHMODE, to prevent errors under certain circumstances.

Don't use ALT+F4 as the normal way to log off - some hosts or applications get upset when you force a hang-up this way!

F4-S will display a screen that shows all existing sessions. Here you can edit various attributes.
You can also quick-select the F4/S screen by clicking the mouse on the slash in between the current and maximum session numbers.
An even easier way is to use the menu bar.


This is an important feature, others are prev/next


5: IVT and the Windows registry

5.1: Saving IVT setup to the registry

Configuring IVT can be done in two basic ways:

Saving setup parameters can be done in 2 ways:

If there is a current profile in the registry, IVT will ask if you want to overwrite it.
After saving a setup, IVT will make that setup the global default (you do not have to exit and restart IVT).

During start-up, IVT will first read all IVT.RC files in the normal way.
Then, if the NO_REGISTRY keyword has NOT been used, it will attempt to find a saved profile in the registry. When found, the settings from the registry are loaded "on top of" those from the IVT.RC files.

The upshot is that you no longer need to worry about the syntax of IVT.RC files. You experiment in the setup screens until you find a setup that works for you. Then, you save that. That's all.

However, there is a problem with having two different mechanisms to accomplish the same thing. If you modify IVT.RC settings after you have saved your setup to the registry, that would have no effect since the registry overrules the IVT.RC file setup. This can be very confusing.

Therefore, whenever you save the setup to the registry, IVT will also save the result of your IVT.RC commands in the registry. During start-up of IVT, the CURRENT results of your IVT.RC settings are compared with the saved copy in the registry. When a difference is found, you have used BOTH mechanisms (IVT.RC files AND registry) to modify the SAME value. In that case, IVT will warn you with a popup saying that you should either re-save or delete the registry settings to resolve the conflict.

As a consequence it is best to stick to one configuration mechanism.
When you use the NO_REGISTRY directive, the menu bar entries for manipulating the registry will be greyed out, and the buttons in the setup screens for the same functionality are greyed out, too.


5.2: Removing IVT setup from the registry

As described in the previous topic, the setup of IVT can be saved to the Windows registry. This can, however, give conflicts with your IVT.RC files.
As you grow to appreciate the power of IVT's setup files you might want to abandon the simplicity of saving a setup in the registry and write your own configuration files, scripts and so on.

When you click on DELETE in this setup screen, IVT will remove any saved settings from the registry.
It will then use the current IVT.RC settings as the current defaults, and restore those for the current session as well.

In other words, deleting a setup is the exact reverse of saving one, and making that work properly is harder than it sounds :-)

Another way to delete the registry setup is to use the SETUP menu on the menu bar, and select "Delete from registry".


5.3: Exporting/importing IVT configurations

When IVT saves setup in the registry, that data is more or less invisible to the average user. The data grows over time:

Besides the data in the registry, there are files with saved passwords, configuration, private settings and so on.

When a new PC is going to be used, it would be nice if all that accumulated data could be transferred to the new PC, and that is what the export/import functions in the 'Setup' menu are for.

The import function will check the validity of the file before using it. When it seems okay, it will replace any current configuration data in the IVT registry with the contents of the file and overwrite any files with the data from the ZIP file.

So use this with care!


This is an important feature, others are prev/next


6: The IVT keyboard guide

6.1: Summary of special IVT function keys

IVT has a lot of special keys that do the most wonderful things. Many of these things can make life a lot easier. Also, all keys can be programmed.
Last, but not least, the HOST can program keys, see the 'keyp' program.
The complete list of special IVT keys is:


F1              - Hold Screen (but see also F1F4).
F2              - Print Screen. Also usable during a CUT operation.
F3              - Setup. Changes IVT configuration on the fly.
F4              - Help. See also help-on-help.

CTRL+F6         - Obtains a sub shell when not in secure mode.

CTRL+CursUp     - Switch to the previous session.
CTRL+CursLeft   - Switch to the previous session.
CTRL+CursDown   - Switch to the next session.
CTRL+CursRight  - Switch to the next session.
CTRL+SHIFT+Curs - Switch to FIRST (up/left) or LAST (down/right) session.
ALT+1 to ALT+9  - Switch to session 1 - 9.
ALT+0           - Type a (hexa)decimal or octal (unicode) character code.
ALT+t           - Toggles back to previously active session.
ALT+g           - Switch to the next group.

CTRL+PageDown   - Create a new session (auto logon)
                  NOTE: Combine with shift and it CLONES a session.
CTRL+PageUp     - Create a new session (no auto-logon)
                  See also the $HOSTPROMPT variable.

CTRL+SHIFT+END  - Ends learn mode (key programming).

CTRL+BREAK      - Sends a ^C on the session.
CTRL+DELETE     - Sends a DEL character.
CTRL+BACKSPACE  - Sends a DEL character.
CTRL+@          - Sends a NULL character.

ALT+F4          - Session hang-up (immediate abort of session).
SHIFT+ALT+s     - Invoke screensaver immediately.

HOME            - VT220 'FIND' key.      Also CTRL+F7.
INSERT          - VT220 'INSERT' key.    Also CTRL+F8.
DELETE          - VT220 'REMOVE' key.    Also CTRL+F9.
END             - VT220 'SELECT' key.    Also CTRL+F10.
PageUp          - VT220 'PAGE UP' key.   Also ALT+F1.
PageDown        - VT220 'PAGE DOWN' key. Also ALT+F2.

CTRL+F7         - VT220 'FIND' key (if you lack a HOME key).
CTRL+F8         - VT220 'INSERT' key (if you lack an INSERT key).
CTRL+F9         - VT220 'REMOVE' key (if you lack a DELETE key).
CTRL+F10        - VT220 'SELECT' key (if you lack an END key.
ALT+F1          - VT220 'PAGE UP' key (if you lack a PageUp key).
ALT+F2          - VT220 'PAGE DOWN' key (if you lack a PageDown key).

ALT+Enter       - Flip Full screen mode.
ALT+Shift+M     - Maximize/restore window.

ALT+PgUp        - Enter history pager, one page back.
ALT+PgDown      - Enter history pager, one page down.
ALT+CursUp      - Enter history pager, one line up.
ALT+CursDown    - Enter history pager, one line down.
ALT+HOME        - Enter history pager, start of history buffer.
ALT+END         - Enter history pager, end of history buffer.
                  Using the mouse wheel is easier...

ALT+F9          - Invoke IVT file transfer functions.

ALT+a           - Toggle ALERT mode.
ALT+c           - Enter CUT mode.
ALT+L           - Lock keyboard.
ALT+p           - Paste the default buffer (clipboard).
Shift+Insert    - Same as ALT+p
SHIFT+ALT+p     - Paste a named buffer.

ALT+s           - Slower output. Repeat as necessary.
                  When used from the PAGER or this help system, it saves text
                  to a file on disk.
ALT+q           - Speed up output (Quicker). Repeat as necessary.


6.2: CTRL+F6: Escape to operating system (Sub Shell)

Using CTRL+F6 will give you a shell (command prompt) on the Windows operating system.
The command is only valid when secure mode is off.
It can be that the administrator has disabled access to the command prompt.
See also SHELLEXECUTE, SYSTEM and COMMANDOUTPUT script functions.


6.3: ALT+t: Toggle between two sessions

This is one of the handy features of IVT that you quickly become very fond off.  Whenever you switch between sessions, the number of the session you came from is remembered by IVT. When you use ALT+t, IVT switches back to that session (and again remembers where you came from).

This toggling between two sessions is very handy when you have many sessions active but find yourself switching between two of them many times.
For example, having error messages from a compiler on one session and doing something about them on another.

It is also usable as a quick screen-at-a-time DIFF program. When there are small differences between two screens, lean on the ALT+t. IVT will rapidly switch between two sessions, which will make the differences apparent.


6.4: ALT+a: Alert mode (ring bell on activity)

This is a very useful feature of IVT when you have to wait for a long time before the host is going to respond.

Typing an ALT+a will toggle alert-mode. This will cause IVT to ring the bell as soon as a character is received from the host (actually, once for every received network packet).
When the receiving session happens to be in the background, the activity indicator will show a red background and the bell will sound muffled.

Typing another ALT+a will turn the alert-mode off again.
The current setting can be made visible from this setup screen.
There is no way to initialise this setting from an IVT.RC file.
However, using IVTFUNCTION this function is accessible to a script.


6.5: ALT+0: Generate any character.

Most Windows programs allow you to enter a special character by holding down the ALT key and then typing a decimal character code on the numeric keypad.
Even old DOS programs allowed you to do that, and long ago people used to enter diacritical characters in WordPerfect or Word using this technique.

IVT reserves the ALT+number keys for very fast and convenient switching between sessions. To allow you to enter such special characters anyway, the unused ALT+0 is used to bring up a dialog in which you can conveniently enter a decimal, hexadecimal or even octal character code.

When you use a normal codepage, the resulting code must lie between 0 and 255 (inclusive), and is transmitted to the host if you choose OK.
When you use UTF-8, the character code can be any valid Unicode character point.

Note that the simple display of the character is only one of the possible results!  For example, if you send a "3", which is ^C, most Unix hosts will consider this an interrupt. If you send 127, it is a DEL character, usually that will cause either a backspace or an interrupt. Depending on the settings on the host, it may either accept 8-bit characters or reject them, or change them. Even if a character gets displayed, the result depends on the selected CODEPAGE in IVT, and a number of other related settings...

In other words: Your Mileage May Vary.

The important thing is that this allows you to send any character value to the host, just like other programs allow you to do...

When an invalid string is entered, the BELL will sound if you click OK.


6.6: Names of the VT220 programmable keys

In an IVT.RC file, a key can be programmed using the KEYNAME directive.
Valid names for these keys are:


PF1 - PF4       - Normally CTRL+F1 to CTRL+F4, but see F1F4.
PF1 - PF4       - In Windows, top row of numeric keypad.
PF5             - A VT220 lacks this key, but IVT maps the F5 key there.

F6  - F10       - Same as on a PC. You can also use F11 and F12 when available.
F11 - F20       - These are mapped from SHIFT+F1 to SHIFT+F10

FIND            - The HOME     key or CTRL+F7.
INSERT          - The INSERT   key or CRTL+F8.
REMOVE          - The DELETE   key or CTRL+F9.
SELECT          - The END      key or CTRL+F10.     See also the KEYBOARD.
PRVSCR          - The PageUp   key or ALT+F1.
NXTSCR          - The PageDown key or ALT+F2.

The VT220 "DO" key is a fancy name for F16 (so you have to use SHIFT+F6).

So for example:

   NXTSCR "ls -lab\r"

Will program the PageDown and ALT+F2 keys of the PC to the Unix command "ls -lab" followed by a return.
When such a statement occurs inside a script, the key is programmed for the current session only (after normal variable-substitution).

It is also possible to redefine any key using keyboard macros or to start a script when you press a key.
The newer KEYMACRO command is even more powerful.
Last but not least, the keyp program can be used on Unix to reprogram the keyboard.
See also MOUSE_KEY, which allows you to bind scripts to mouse actions.
Since a possible action is the SEND statement, this allows you to send data to the host when you press a mouse button.


This is an important feature, others are prev/next


7: The status line and what it can do for you

7.1: Introduction to the status line

The (optional) status bar of IVT shows lots of information about the current status of the foreground session, plus general information about the other sessions and groups of sessions.

The status bar uses icons to indicate various conditions, such as printer active, keyboard lock, autolog active, security, etc.
The various parts of the status bar can be clicked to perform actions on them (such as editing the hostname and comment parts).
A right-click will display help about any item.

It looks like the example below, click on any part to get more info:


______________________________________________________________________________

M x/y/G    HOSTNAME    HH:MM NNxYY 123456789 G      Comment          Icons

______________________________________________________________________________

Explanation of the various fields:

M Is the modem indicator (serial lines only). It can have several values, and is usually displayed with a red background.
x/y The current session number (x) and current total number of sessions (y).
/G Optional group code of the current group. A + indicates that other groups exist. Clicking it performs an ALT+g function (next group).
HOSTNAME The name of the remote machine (editable by clicking it).
HH:MM The STATMIDDLE command can be used to configure this field. The default is the current time. Click to alter.
NNxYY The current session size (NN=Rows, YY=Columns).
123456789 Current activity on other (background) sessions.
G A G appears to indicate activity in other groups.
Comment Free session comment (See F4-S screen). Clicking it will enable you to edit it.
Icons Icons show for the LEDS (1-4), a key for a locked keyboard, a padlock for an SSH or Kerberos session. Also a recorder icon for a keyboard macro, printer icon for an active printer and a notebook icon for AUTOLOG. Last but not least, an IPv6 icon indicates that the current connection uses IPv6. There is no icon for "normal", IPv4.

All parts of the status line can be clicked with the mouse:

See also STATUS, STATMIDDLE, STATBORDERS, STATUSCLICKS and PRSTATLINE.


7.2: Status line Modem indicator for serial lines

When the current session is a serial one, the leftmost position of the status line can show the following values:


7.3: The status line indicators and icons.

These icons indicate various important aspects of the current status of IVT.
The following ones can appear:


7.4: Status line hostname

This part of the status line shows the name of the host the session is connected to. Initially, this is whatever was used from either the Create session dialog or the command line.

It can also be edited using the F4-S screen (type an 'E' there) or using a STATUSHOST command from a script.
An easier way is to click on the host name in the status line, which brings up the edit dialog immediately.
Yet another way is by right-clicking the tab of the session and choose 'Edit'.

For serial lines, this field will show the name of the COM port, baud-rate and such. In this case, when you use F3-SERIAL to change any of these settings, the host name will be updated automatically.


7.5: Status line clock

Traditionally, the middle part of the status line was used as a simple clock that could be turned on or off using the CLOCK keyword or the setup screen.

Later, functionality was added to show the current cursor position in this place, or to show the current position of the mouse instead. This allows you to measure the exact position or length on the screen of certain objects.
In one of these modes it will show two numbers; the first is the line number, the second the column number.
Finally, the "connected" time of a session can be displayed here.

Changing the display of this middle part of the status line can be accomplished in 3 different ways:


7.6: Status line size indicator.

This shows the current session size in rows and columns.
When the window is too narrow, this field is omitted to make room for the other fields on the status line.
Currently, the field is display only.

When you interactively resize the screen, the indicator shows the resulting size. Note that the title bar does the same, but many people overlooked that.


7.7: Status line activity indicator

IVT supports two kinds of activity indicators. Such an activity indicator is intended to alert you to a status change of a background session (a session you are not currently looking at). The two forms are:

The default in newer versions of IVT is to use the tab for this, but if you liked the status line indicator it can be turned on using TABSBAR NO_ACTIVITY configuration option.

These are:


7.8: Status line comment

The session comment can be typed in the initial dialog when you create a session.
It can also be set from the host using the ^[ Ctext; escape sequence (ESC-SPACE-CanytextSEMICOLON, see example).
This allows the host to automatically identify the session.

It can be typed directly using F4-S <Edit>.
Also, you can click on the comment in the status line, which allows you to edit it (use ESC to abort the edit).
Alternatively, you can use a right-click on the tab of the session and choose 'Edit' from the menu that appears.

Use it to describe the purpose of the session. Especially when you have many sessions to the same host, this comment is ideal to tell them apart. The F4-S screen lists all comments, to give you an overview of all your sessions and the possibility to edit the comment, change the order of sessions etc.
Also, the WINDOW menu on the menu bar shows the session comments.

It can be set from a script using the STATUSTXT and STATUSTXTFIX commands.
Any comment longer than the maximum of 60 positions is silently truncated.

See also the TITLEBAR command, which will show this comment in the IVT applications title bar.
See also the  XTERM set window title command.


8: IVT menu bars and panel dialogs

8.1: Introduction

Menu bars and the create dialog are a late addition to IVT. For over 10 years, IVT was a program with many powerful features accessed with the keyboard only.
All those things were described in detail in these manual pages, but these days few people take the time to read all of this, even in spite of Tables of Contents, lists of important topics, FAQs, read-me-firsts and whatever else I tried :-(

After releasing version 11.3 of IVT to the Web in August 1999, I got many questions about IVT that were answered in the manual, the FAQ and read-me files, but were not noticed by the people asking the questions. Thus, many powerful features of IVT went unnoticed by many users - a great pity.
Therefore, I added the menu bars in January 2000. Every important part of IVT now has an optional menu bar on top of the screen (sessions, history pager and this help system).

Since November 2005, this menu bar can now be displayed as a normal Windows menu bar, instead of the original IVT text-mode one.

The next item was to make creation of sessions easier and more intuitive.
For this, the create session dialog was made which allows you to switch protocols, edit items, click buttons and so on. All the code for this is - like the rest of IVT - home rolled.
Once this was working properly, December 2001 was used to rewrite the setup system entirely, so from version 14.1e onwards the setup is mouse-driven and usable by novices, too.

For more details on using and customizing the menu bars, click here.
For more details on using and customizing the create session dialog, click here.
For setup, see here.


This is an important feature, others are prev/next


8.2: Menu bars

All important functions in IVT have been given an entry in one of the menus that can be pulled down from one of the menu bars.
Menu bars can be enabled and disabled by using the MENUBAR directive in the IVT.RC configuration file.

The menu bar can also be activated by pressing and releasing the ALT key.
The normal Windows way (F10 or ALT+shortcut key) does NOT work, as both these key combinations are reserved by IVT for terminal emulation purposes. The one exception was for the lone ALT key, which would normally do nothing in IVT.

Every menu item also has a context-sensitive help, accessed by typing F1 while that entry is highlighted, or by right-clicking it (even when greyed out).

There is even a set of customizable entries in the session menu bar.
Normally invisible, these can be configured from the IVT.RC file. This allows the user to launch IVT scripts and generate keystrokes using the standard menu bar interface of Windows.


8.2.1: Using the menu bars

The menu bar can be activated as follows:

When a menu is activated, an item can be chosen by clicking on it with the mouse. The keyboard can be used to navigate the menus as well:

Most items in the menus also display the associated keyboard shortcut. Use these to quickly access common features.


8.2.2: Setting menu bar colors

MENU_COLORS ...

No longer supported in this version of IVT, this used to set the colors of the text-mode menu bar.


8.2.3: Configuration of the CUSTOM menus

One of the nice features of the session menu bar is that it has configurable menus. Normally, these menus are empty and invisible. They can be activated from the IVT.RC file by using several MENU statements which have to be called from a SCRIPT. Normally, you would write a "startup" script to do this.
There can be up to 10 custom menus on the menu bar, number 0 to 9.
Number 0 is reserved by IVT, it is used for the 'Scripts' menu entry.
You select a menu by using "MENU SELECT x", where x is a single digit (0 - 9).

Note: These menus can support multiple languages, just like the rest of IVT.
See the ONLANGUAGE statement and NLS() function for details.

First of all, the menu must be given a name using the TEXT directive.
This string will appear on the menu bar itself.
It is your responsibility to have a properly formatted string here, a very long string, or one containing odd characters will produce a variety of unpleasant effects...
An "&" character can be used to indicate a shortcut character. If you do not assign a shortcut, IVT will assign a unique one for you (if possible).

Next, the menu must be filled with entries, of which there are different types (detailed below). Every item has a description (the text which will appear in the menu). An '&' in that text can be used to indicate the highlighted shortcut character for that entry (see below for an example).
Again, these shortcuts will be chosen automatically if you omit them.

The different types are:

Lastly, the menu must be enabled, which will make it visible. It can also be disabled. The "MENU ENABLE" and "MENU DISABLE" commands accomplish this.

The menu can also be cleared using the RESET command. That way, a script can redefine the menu later (for example when switching to a different national language).

The order in which the statements are executed determines the order in the resulting menu. Time for an example:


   Script Startup
      MENU SELECT 1             # Choose a private menu
      MENU RESET                # Clear any previous menu
      MENU TITLE "&Favourites"
      MENU CALL  "Start my favourite &editor"  Start vi
      MENU CALL  "Start &mail program"         Start elm
      MENU LINE
      MENU STRING "Show my &processes" "ps -fu johnb\r"
      MENU ENABLE
   END

The TITLE command will create an entry on the menu bar called "Favourites".
The F will be the shortcut key for that menu (GUI menu bar only).
The first two entries will call the "Start" script (which has to be defined elsewhere). It will be passed one parameter (vi or elm in the example).
The shortcut character will be 'e' and 'm' respectively.
Then, a separating line is drawn.
The next entry will send the "ps" command when chosen (shortcut is 'p').

The idea is that you can create entries for common tasks in your own personalized menu...


8.3: Start-up general help

Welcome to IVT, a powerful multi-session LAN terminal emulator.
Click on any of the following links for more information (right-click returns from a link):

There is also Help On Help...

For the (slightly) more advanced user, the following links may be worth reading:


8.4: The create session panel interface

IVT used to be a "text-mode only" program until the beginning of 2000.
Mouse mode cut/paste was an early feature, but for the rest you used the keyboard. Creating sessions, scroll-back history, file transfer and many other functions were accessed through ALT and CTRL key-combinations.
My home page even used to say that IVT was meant to be used by people who use a terminal emulator as a primary tool, and that anyone who only used Unix through TELNET once in a while was better off with other products.

After releasing IVT to the Internet in September 1999, I got many requests for features that already were a part of IVT, but were unnoticed because they were hidden behind some obscure key combination.
Menu bars were added as the first thing to give pull-down menus which make most of the significant features available to novice users.
Afterwards, it was rewritten to be a normal Window GUI application.
Right-clicking any part of the dialog will bring you to a context sensitive help screen of IVT.

While the create session dialog is active, you can also click on the menu bar and choose SETUP to change all kinds of settings.

By clicking on the MORE and LESS buttons you can extend (or limit) the choices IVT displays in the dialog. You can also use the CRDIALOG directive in an IVT.RC file (or from this setup screen) to set the default interface.


8.5: Repeat count

The "Repeat" field in the create-session panel allows you to create a number of identical sessions in one operation.
You will have to select the maximum panel (click on More until it appears).

All sessions are to the same host and will be logged in (when requested) with the same user-id.
When there is room in the comment field of the session, an automatic sequence number will be appended to be able to distinguish between them.

The Automatic Login system will use the $IVT_REPEATNR variable to do the same, too.

See also the R=Count option of the CREATE statement, which allows another way of specifying a number of repeated sessions. These two cannot be combined, a CREATEGROUP cannot be created multiple times automatically.
See also MERCY_MODE, to prevent excessive stress on hosts.


8.6: List with previous host & users

The address book icon at the end of the hostname prompt in the "Create Session" panel can be used to access a list of recently used and predefined hostnames, user names, profiles and so on.

The list consists of 2 parts. The first part are hostnames, usernames and other data typed into the login dialog by the user. IVT remembers the last 25 typed names (but see MAXTYPEDHOSTS to configure this).
The second part is configurable with the HOSTLIST command in an IVT.RC file, or using the address book editor available from the "extra" menu.

Double-clicking on an entry in the dialog that opens will select that entry.
You can also single-click followed by <OK>.
You can even select MULTIPLE entries in ONE operation and IVT will create multiple sessions at once!

Entries can be deleted from the list one-by-one or all together.
The resulting list is saved in the registry and thus survives starting and stopping IVT.
The option is enabled only when at least two different hosts and users have been typed by the user. The last entry typed by the user automatically appears in the login dialog.

A more powerful way to automatically start sessions for particular users and hosts is the session group mechanism of IVT.

See also the host list filter.


8.7: Host list filter expression

When you use the address book together with project files, the number of hosts to select from can grow uncomfortably large.
By typing a partial name into the "filter" box, the listing is adjusted to contain only matching hosts. Actually, the value you type here can be a regular expression (see the MATCH function).
The string that is matched is the combination of the hostname and description (comment field) of the address book entries (so you can search on arbitrary parts of the hostname, description, or combination). The search is case insensitive.

Before a selection is shown, IVT will first force an expansion of all groups in the address book (like clicking on "Expand all").

The value in the filter box is not cleared automatically by IVT. If you want to view the complete address book again, you will have to clear it manually, click on the "Clear" button.


9: F3: IVT Setup dialogs

9.1: Introduction to setup dialogs

For help on any individual item, use a right-click on that item (or select the item and press F1). Click on the question mark in the title bar of windows and drag the icon to any line to get help on that specific item.
Right-click anywhere in the blank area of the dialog to get help on the panel itself.

To navigate through the various items, just click on them, or use the following keys:

The old setup shortcuts of IVT also still work:


F3 - Apply changes, end setup;
R  - Reset terminal;
C  - Abort all scripts on this session;
D  - Dump incoming data;
F  - Flush printer;
L  - Start (or end) Learning a macro.

New ones are:


A - Apply changes and exit setup;
P - Printer setup
W - Windows setup
H - Help
? - Help

The <Save to registry> button is enabled only when the REGISTRY setting is in effect (when NO_REGISTRY is used, the button is disabled).
When clicked, the current setup is saved into the registry, see here for details.

The <Delete> button will delete any settings from the registry and will make IVT revert to the setup that result from the IVT.RC file settings.
It will ask for confirmation first.
See here for details.


9.2: Setup propagation

The setup dialogs allow you to change the look and feel of the current session, and to save the settings of the current session so all future sessions will have the new look and/or feel. See also SIZE4ALL.

The "Propagate" function uses the current session parameters and copies those to all currently existing sessions. So all sessions get the look and feel of the current session with regards to:

and so on and on (everything that you can change in setup). The "propagate" function is available from the main session menu bar (the "setup" menu there) and through the IVTFUNCTION and KEYMACRO functions, which allow you to propagate setup either under script or keyboard control.
There is also a button in Windows Setup.

There are a few reasons why a session will not change its look & feel:

This is for various technical and practical reasons.

Note that if you have not changed any setting, using the "Propagate" function has no visible effect, except that IVT will force a screen resize, font adjustment and so on for every session, which can cause network activity, screen redrawing and so on (even if it ends up looking exactly the same).
In other words, do not use it unnecessarily.

See also SIZE4ALL.


9.3: Protocol setup

This dialog allows you to choose the basic transport and session protocols that IVT is going to use for future sessions.
The transport protocol is the low-level way IVT sends data from A to B, this can be a serial line, TCP/IP or NetBios.
This also chooses the basic session protocol.
A session protocol runs "on top of" a transport protocol. It can be TELNET, SSH, RLOGIN, VTP or MULTIPLEX.


Transport protocol  : [WinSock     ]
Session   protocol  : [Telnet   ]
IP version          :[Both     ]
TCP no delay option  : [X]
TCP keep alive option: [X] [15] [10] [3]
Socket timeout       : [  20]
Trace name resolving : [ ]
Search domains       : [acme.com           ]
<Configure proxy >
<Configure delays>


9.4: Proxy setup

The Proxy panel allows you to configure IVT to use various types of proxy in order to make its network connections. The settings in this panel affect the primary network connection forming for your SSH, TELNET or RLOGIN session.
Below you'll find more information on each separate topic.
In case you are unfamiliar with proxy servers: it is a server that connects to a host on behalf of IVT because your PC cannot reach that host directly.
IVT connects to the proxy server and asks it to connect to the destination host. After the connection is established, the connection is transparent.


Proxy type               : [None      ]
Show proxy debug messages: [ ]
Proxy host:port          : ........................................
Timeout in seconds       : 15...
Exclude host/IPs         : ........................................
Proxy local connections  : [ ]
Proxy understands IPv6   : [ ]
DNS lookup at proxy end  : [Auto]
User name                : ruurdb..................................
Password                 : ****....................................
Telnet command           : connect $HOSTNAME_ONLY $PORT\n..........
IVT script name          : ........................................


9.5: Configure delays

The Delays panel allows you to configure various delays that IVT will perform on purpose to prevent overloading hosts and networks.
Click on any of the links below for more information.


Mercy mode after #sessions : [4    ]
Mercy mode delay           : [500  ]

TCP flood protect #sessions: [10   ]
TCP flood protect delay    : [1500 ]

Paste maximum lines        : [3    ]
Paste maximum bytes        : [10000]
Maximum wait for response  : [10   ]
Send CR separately         : [ ]


9.6: IVT Tunnel setup

The ivttunnel program can be used to traverse firewalls and so on. This dialog allows you to configure the tunnels and various supporting details.
This dialog can be reached from Setup->Protocol->Configure IVT tunnels, or from the dialog: Setup->SSH setup->Configure IVT tunnels.
This is because these tunnels can be over any sort of connection, even serial ones.


Current session only   : [ ]
Type of forwarding     : [Local   ]
Tunnel protocol        : [TCP]
Source [host]:port     : ............................
Destination host:port  : ............................
Accept all hosts       : [ ]

Tunnel program      : .........................
Debug file          : .........................
Config file         : .........................
Start minimized     : [X]

See ivt tunnels for details.


9.7: Telnet setup

The TELNET setup dialog allows you to modify the settings for future sessions and to inquire the status of the current TELNET session.
When no current session exists, or the current session is not of type TELNET, the "inquiry" functions are all greyed out.
Below you will find more information on each option.


Show option negotiation : [ ]
Offer extra options     : [X]
Use New Env (RFC 1592)  : [ ]
Send NUL after CR       : [X]
Terminal type           : ivt,vt220,vt100.....
Terminal speed          : 38400,38400.........
X Display value         : NL-ARN-L60278:0..............
Send IP-address in Xdisp: [ ]
Keep-alive delay (0=off): 0
<Send AreYouThere      >
<Send break            >
<Send Interrupt Process>
<Force Logoff          >
<Show remote status    >
<Toggle binary mode    > Local=Off Remote=Off
Suppress Go Ahead      : Local=On  Remote=On
Local flow control     : Enabled, Restart XON


9.7.1: Telnet setup: Send Are You There

When you are using a TELNET connection to a host, and the host does not seem to respond to your input anymore, you can click on this button.
This will send a special command called "Are You There" to the remote end of the TELNET connection. A host should respond with something along the lines of "[YES]", or "I AM HERE". Some hosts only ring the bell to avoid corrupting the screen. The idea is that a life sign is given. When no response is received, the problem lies (probably) in the network connection itself.
However, your BELL might also have been set to OFF...


9.7.2: Telnet setup: Send break

When a TELNET host is not responding, you might first want to try and send an "Are You There" to see if anything is still alive at the other end of the connection. If there is, and the program you are talking to seems to be dead (or cannot be stopped by normal means for whatever reason), you might try to send a TELNET BREAK. This is a friendly way to ask the program to stop.

Simply click on the appropriate button in the TELNET setup dialog.
A more unfriendly way is the interrupt process, described below.
Not all TELNET host implementations honor this request. Your last recourse is to hit ALT+F4 to kill the session (or use the TABSBAR close icon).


9.7.3: Telnet setup: Send Interrupt Process

The TELNET protocol supports an application independent way to terminate processes. Even when your host has disabled all normal ways to interrupt applications, TELNET clients can request an "Interrupt process".
This is the last resort if all else fails.
See also "Send TELNET break".


9.7.4: Telnet setup: Force Logoff

This is a request from IVT to the TELNET host to disconnect the session.
I have not found many hosts that honor this request, most ignore it.
Another way to disconnect forcibly would be to use ALT+F4 or use the TABSBAR close icon.
See also "Send TELNET break" and "Send Interrupt process".


9.7.5: Telnet setup: Show remote status

This is a request from IVT to the TELNET host to send its idea of the current status of all TELNET options. All options that are marked DO (the host thinks IVT should do this option) or WILL (the host will do that option) are sent back and displayed (on the normal session screen) by IVT.

Since all these options are negotiated when the session is established, both ends of the connection should have the same idea on the current status. When IVT receives the status from the host, it compares that to its own ideas on the status. When it matches, it is displayed as "Correct". When a mismatch is found a "MISMATCH" message is displayed.
Use this when in doubt on the correct implementation of the telnet host.


9.7.6: Telnet setup: Binary mode

This requests binary transmission on the session. It is used internally by the file transfer functions of IVT but not used much otherwise. Enabling this mode will prevent certain character translations and local flow control.
The setup will show the current status, clicking the button will toggle that setting from on to off and back again.


9.7.7: Telnet setup: Suppress Go Ahead

This is display only, you cannot change the setting.

A standard TELNET connection is actually half-duplex, when one side of the connection is done transmitting, it should send a message to the other side saying "I'm done, you go ahead now". In these modern days of full duplex connections and applications that can send unsolicited output there is not much use for such a message. Any side that does not want these messages can send a "DO Suppress Go Ahead" message to the other end. IVT will send such a message to a TELNET host during session initialization. The host might respond with "DONT Suppress Go Ahead" when it actually wants the protocol.
If the host does not want to see any "Go Ahead" messages, it will say "WILL Suppress Go Ahead" and (probably) send a message to IVT which says "DO Suppress Go Ahead" to which IVT will respond "WILL Suppress Go Ahead".

The result of these negotiations will be shown in the TELNET setup dialog.

When the Go Ahead is sent by the host, IVT will ignore it (it can't force you to type something) and when it is required by the host, IVT will send a "Go Ahead" after you finished typing.


9.7.8: Telnet setup: Local flow control

This is display only, you cannot change the setting.

Local flow control is a way to stop the display of characters received by the host, by typing a special character (usually XOFF, generated by typing a CTRL+s key). When local flow control is enabled, typing an XOFF will make IVT stop immediately (normally, the XOFF would be transmitted to the host which would respond eventually, but there might be lots of buffered data in the network which could make XOFF pretty useless).

There are two ways to restart the flow: RESTART_ANY and RESTART_XON.
When the first is enabled, any typed character will resume output.
When the second is enabled, you have to type an XON (Ctrl+Q).
When local flow control is enabled, Ctrl-S and Ctrl-Q are transmitted to the host, and also handled locally. IVT immediately stops displaying output (same as using F1).


9.8: Kerberos setup

This panel allows you to configure the Kerberos features of IVT.
Kerberos is a security protocol that allows TELNET connections to be secure in both authentication and data transport. SSH is more common, but Kerberos has a few powerful properties like a central point of administration and mutual authentication.


Enable negotiation                : [X]
Automatically forward credentials : [Forwardable]
Automatically negotiate encryption: [X] (to host)
Automatically negotiate decryption: [X] (from host)
Debug Kerberos encryption         : [ ]
Realm                             : ....................
Support for DES CFB64             : [Input/output]
Support for DES OFB64             : [Input/output]
Enable use of PC-DCE .DLL         : [X]
X-Windows port forwarding         : <View/configure>
Encrypt current session           : [X]
Decrypt current session           : [X]
<Show status for the current session>
<Kerberos licence management>


9.9: X-Windows port forwarding

This panel allows you to configure the X-Windows port forwarding protocol and view some statistics about the number of packets and bytes transmitted for the X-Windows protocol over a secure channel. This secure channel can be either SSH or Kerberos, or even both at the same time.

The value of the DISPLAY variable can be changed only BEFORE a session is established, since part of that value is transmitted to the host when the session is established initially. For the same reason the other settings that are used only during session establishment are disabled afterwards.

The statistics shown are global values (all sessions, all X-traffic).


X-display forwarding   : [Auto ]
DISPLAY variable       : :0.0...................
SSH authorization mode : [MIT Magic Cookie 1  ]
XAUTH delay (Ms)       : 750
Number of open channels: 0
Packets from hosts     : 0
Bytes   from hosts     : 0
Packets from X-server  : 0
Bytes   from X-server  : 0

<Refresh>   <Reset>

The Refresh button refreshes the statistics to current values.
The Reset button forces all statistics to zero.


9.10: SSH Setup

This panel allows you to configure the settings for the Secure Shell version 2 protocol. It looks as follows:


Debug SSH protocol negotiation: [ ]   Use timestamps: [ ]
Log SSH packet data to IVT.LOG: [ ]
X-Windows port forwarding     : <View/Configure>
IVT tunnels                   : <View/Configure>
Kerberos/GSSAPI               : <View/Configure>
Allow interactive passwords   : [X]
Don't allocate pseudo terminal: [ ]
Allow use of Pageant          : [X]
Enable authentic. forwarding  : [X]
Agent hijack protection       : [X]
Enable compression            : [X]
Show SSH debug messages       : [X]
Allow non-standard use of DES : [ ]
Accept host keys              : [Ask user  ]
Trivial authentication        : [Disconnect]
Keep-alive delay (0-off)      : 0
Terminal type for SSH         : vt220....................
Data to send to server        : .........................
Private key file for SSH      : .........................
Pathname of PAGEANT executable: .........................
Automatically start PAGEANT   : [X]
<SSH Port Forwarding          >
<Configure SSH Key Exchange   >
<Configure SSH ciphers        >
<Configure SSH bug detection  >
<Manage stored SSH keys       >
<Start KEYGEN (makes key pair)>
<Start PAGEANT now            >

Most of the core SSH code was borrowed from PuTTY. Thanks!


9.11: SSH Port Forwarding

This panel allows you to setup SSH port forwarding. It looks like:


Current session only : [X]
Type of forwarding   : [Local  ]
IP version           : [Auto   ]
Source [host:]port   : ..................................
Destination host:port: ..................................
Accept all hosts     : [ ]

   [ Add ]   [ Remove ]

The SSH protocol has the ability to forward arbitrary network connections over your encrypted SSH connection, to avoid the network traffic being sent in the clear. For example, you could use this to connect from your home computer to a POP-3 server on a remote machine without your POP-3 password being visible to network sniffers.

In order to use port forwarding to connect from your local machine to a port on a remote server, you need to:

BTW: The above dialog is equivalent to: SSH_FORWARD LOCAL 3030 popserver.example.com:110 in your IVT.RC file.

Now start your session and log in. Port forwarding will not be enabled until after you have logged in; otherwise it would be easy to perform completely anonymous network attacks, and gain access to anyone's virtual private network. To check that IVT has set up the port forwarding correctly, you can turn on 'Debug SSH protocol negotiation' before logging in.
IVT should say something like this:

SSH: Forwarding local port 3030 to popserver.example.com:110

Now, if you connect to port 3030 on your local PC, you should find that it answers you exactly as if it were the service running on the destination machine. So in this example, you could then configure an e-mail client to use localhost:3030 as a POP-3 server instead of popserver.example.com:110. Of course, the forwarding will stop happening when your IVT session closes down.

You can also forward ports in the other direction: arrange for a particular port number on the server machine to be forwarded back to your PC as a connection to a service on your PC or near it. To do this, just select the 'Remote' type instead of the 'Local' one. The 'Source port' box will now specify a port number on the server (note that most servers will not allow you to use port numbers under 1024 for this purpose, unless you are logged in as 'root' there).

An alternative way to forward local connections to remote hosts is to use dynamic SOCKS proxying. For this, you will need to select the 'Dynamic' type instead of 'Local', and then you cannot enter anything into the 'Destination' box (it will be greyed out). This will cause IVT to listen on the port you have specified, and provide a SOCKS proxy service to any program which connects to that port. The SOCKS protocol negotiates the actual destination with the client.

The source port for a forwarded connection usually does not accept connections from any machine except the SSH client or server machine itself (for local and remote forwarding respectively). This can be changed in several ways:

(Note that if you're using Windows XP Service Pack 2, you may need to obtain a fix from Microsoft in order to use addresses like 127.0.0.5).

See also SSH_FORWARD.
IVT will show an interchange icon in the status bar when IVT is actively forwarding data. The icon does not appear when channels are set up but not in active use.


9.12: SSH Key-exchange configuration

This panel allows you to configure how IVT handles SSH-2 key exchange.
See also the IVT.RC command SSH_KEX.

Key exchange occurs at the start of an SSH connection (and occasionally thereafter); it establishes a shared secret that is used as the basis for all of SSH's security features. It is therefore very important for the security of the connection that the key exchange is secure.

Key exchange is a cryptographically intensive process; if either the client or the server is a relatively slow machine, the slower methods may take several tens(!) of seconds to complete.

If connection start-up is too slow, or the connection hangs periodically, you may want to try changing these settings. If you don't understand what any of this means, it's safe to leave these settings alone.

IVT supports a variety of SSH-2 key exchange methods, and allows you to choose which one you prefer to use.

IVT currently supports the following varieties of Diffie-Hellman key exchange:

If the first algorithm IVT finds is below the 'warn below here' line, you will see a warning message when you make the connection, similar to that for cipher selection.

Repeat key exchange.
If the session key negotiated at connection start-up is used too much or for too long, it may become feasible to mount attacks against the SSH connection.
Therefore, the SSH-2 protocol specifies that a new key exchange should take place every so often; this can be initiated by either the client or the server.

While this renegotiation is taking place, no data can pass through the SSH connection, so it may appear to freeze. Usually the same algorithm is used as at the start of the connection, with a similar overhead.

You can control how often IVT will initiate a repeat key exchange (rekey).
You can also force a key exchange at any by using the Rekey now button.

Max minutes before rekey.
This specifies the amount of time that is allowed to elapse before a rekey is initiated. If this is set to zero, IVT will not rekey due to elapsed time. The SSH-2 protocol specification recommends a timeout of at most 60 minutes.

You might have a need to disable time-based rekeys completely for the same reasons that keep-alives aren't always helpful. If you anticipate suffering a network dropout of several hours in the middle of an SSH connection, but were not actually planning to send data down that connection during those hours, then an attempted rekey in the middle of the dropout will probably cause the connection to be abandoned, whereas if rekeys are disabled then the connection should in principle survive (in the absence of interfering firewalls).
For these purposes, rekeys have much the same properties as keep-alives (except that rekeys have cryptographic value in themselves, so you should bear that in mind when deciding whether to turn them off).
Note, however, the SSH server can still initiate rekeys.

Max data before rekey.
This specifies the amount of data (in megabytes) that is permitted to flow in either direction before a rekey is initiated. If this is set to zero, IVT will not rekey due to transferred data. The SSH-2 protocol specification recommends a limit of at most 1 gigabyte.

Disabling data-based rekeys entirely is a bad idea. The integrity, and to a lesser extent, confidentiality of the SSH-2 protocol depend in part on rekeys occurring before a 32-bit packet sequence number wraps around.
Unlike time-based rekeys, data-based rekeys won't occur when the SSH connection is idle, so they shouldn't cause the same problems.

See also the IVT.RC command SSH_KEX.


9.13: SSH bug detection

This panel allows you to configure how IVT should detect and avoid bugs in various SSH-2 implementations.


Miscomputes SSH2 HMAC keys             : [Auto detect]
Miscomputes SSH2 encryption keys       : [Auto detect]
Requires padding on SSH2 RSA signatures: [Auto detect]
Misuses the session-ID in PK auth      : [Auto detect]
Handles SSH-2 key re-exchange badly    : [Auto detect]
Only supports pre-RFC4419 GEX          : [Auto detect]
Ignores SSH-2 maximum packet size      : [Auto detect]
Replies to requests on closed channels : [Auto detect]

Normally, IVT will attempt to detect the bug automatically, based on the name and version number of the remote SSH server. When a bug is present in a server IVT does not know about and the bug causes problems, you can set it to "Force on". When IVT thinks there is a bug when there in fact is none, you can set this to "Force off".


9.14: Stored SSH host keys

This dialog shows you all received SSH host keys. It is reached from the main setup screen, <SSH settings>, <Manage stored SSH keys>.
Such SSH keys are sent by a host when a connection is made through the SSH protocol. IVT will store the key and its fingerprint.
The next time a connection is made to the same host, the transmitted key is compared to the stored copy. If it does not match, a warning is issued (because this may be a host that pretends to be somebody else).

If you have many hosts that come and go, these keys can clutter up your registry. Also, you may want to check the fingerprint of a particular host key. This panel allows you to inspect and delete individual keys. By clicking on <Delete all>, IVT will remove all stored keys from the registry. Mind, no confirmation is asked. Losing your keys is no disaster though, since the next time you connect to a host it will be stored again.
See also the AUTO setting of SSH_ACCEPT.

You can also export the keys to a file with <Export to file>.
Such files can be used through the SSH_HOSTKEYS directive in an IVT.RC file, to limit IVT's connections to known hosts only.

Note: PuTTY does not have this functionality :-)


9.14.1: GSSAPI Authentication over SSH connections

This setup screen configures Kerberos authentication over SSH, using the GSSAPI protocol. This feature was introduced in IVT 24.0 in 2014.


Attempt GSSAPI authentication: [X]
Prefer GSSAPI over others    : [X]
Allow credential delegation  : [ ]
Use OS user as default login : [X]
Reverse lookup of host names : [X]

Preference order for GSSAPI libraries:
   MIT Kerberos GSSAPI          <  Up  >
   User specified GSSAPI.DLL    < Down >
   Microsoft SSPI SECUR32.DLL

User-supplied GSSAPI DLL     : [               ] <Browse>


9.15: Serial setup

This panel allows you to configure the settings for serial ports.
Depending on whether the current session is a serial one, you can modify the current port or (when the current session is not connected yet or is not of a serial type), change the global defaults that will affect future serial sessions.


Baud rate              : [19200]
Parity                 : [None ]
Data bits              : [ 8 ]
Stop bits              : [ 1 ]
CTS output control     : [X]
DSR output control     : [ ]
DSR input sensitivity  : [ ]
DTR control            : [ Enable    ]
RTS control            : [ Handshake ]
XON/XOFF output control: [X]
XON/XOFF input control : [X]
XON limit              : [128  ]
XOFF limit             : [0    ]
BELL on phone RING     : [X]
Show Carrier Detect    : [X]
Write timeout          : [0    ]
<Short BREAK (250ms)>
<Long BREAK (1.5 sec)>

Total char overruns   0
Current overruns      0

There are a number of buttons in the "Preset" section which will select logical combinations for flow-control. By clicking them, the relevant options will automatically be updated.
When you use an IVTFUNCTION to access this (using "Serial preset" as a parameter), you must specify a 3rd parameter that specifies which button must be simulated:

RTSCTS: Select Request-to-send/Clear-to-send flow control DTRDSR: Select Data-terminal-ready/Data-set-Ready flow control.
XONXOF: Selects XON/XOFF flow control in both directions.
NONE:   Turns off all forms of flow control.


9.16: RLOGIN setup

RLOGIN is not as popular a protocol as TELNET, but IVT supports it.
This dialog allows you to configure the values that will be used for future sessions of this type.
Be warned: RLOGIN transmits passwords in clear text over the network.


Local user name : ....................
Remote user name: ....................
Terminal type   : vt220...............


9.17: VT220 (basic) setup

This basic setup dialog manages the main characteristics of the VT220 emulator. Click on any of the links for more information.


Screen size         : [60x145 (Dflt)]
Allow resize        : [X]
Allow ALT-screen    : [X] Separate scrollback[ ] <Swap Now>
One size for all    : [X]
History             : [X]
Screens             : [10  ]
Timeout             : [0   ]
7 or 8-bit mode     : [7]
Auto reconnect LAN  : [ ]
Retain sessions     : [ ]
Line wrap           : [X]
LF implies CR       : [ ]
Screen save after   : 10 minutes
Lock keyboard after : 0 minutes
Smooth scroll delay : 0  Ms   Pixels: 1
Keyboard lock passwd: ********
Answerback string   : \06...........................
Terminal speed      : [Turbo ] (see also ALT-S)
Highlight strings   : <View/Configure>


9.17.1: VT220 basics: Linefeed implies CR

When this option is turned on, IVT will automatically add a Carriage Return character after every received Linefeed character. This means the next displayed character will be at the start of the next line, rather than at the same column position on the next line. The host can control this with an escape sequence.

NOTE:
Older versions of IVT refused to save this setting, since it causes an incompatibility with a true VT220 when you do. Starting with version 23.1, it is the users' responsibility to make sure of the setting: IVT saves it when you save setup, along with the all other settings. when the host alters the setting using an escape sequence, it is marked as VOLATILE and will not be saved accidentally, which was the original reason to skip saving this option.

See also CSI 20 h.

A number of users have reported trouble with this setting. Sometimes there are hosts which force this setting to ON and then produce screen corruptions because of that, sometimes they expect it to be turned on but do nothing to actually set it. In that case, just set it to ON and save it.
In the former case, a little IVT script can be used to force the setting, like so:


   ONCONNECT * SetLfImpCrOff
   Script SetLfImpCrOff
      SECRET
      FOREVER
         WAIT "\1B[20h" # Wait for a command to turn it on
         IGNORE_ESCAPE  # Ignore it.
      NEXT
   END

This script launches a background script for every session, which just sits around monitoring everything received from the host. When a command is seen that turns this setting ON, it ignores it.
The SECRET means there won't be an annoying red S in the status line to show that a script is active.
Note that this is a hack: the host is just plain wrong in sending the command and then still assuming it is off. instead of working around the problem in IVT, it is better to fix the host.


9.18: VT220 (more) setup

This dialog combines a mishmash of other VT220 terminal characteristics, besides the ones in the VT220 basic setup dialog.


Alert mode          : [ ]
Bell action         : [Sound tune     ]  Bell abuse settings
.WAV file             : ........................... Browse
Flash action        : [Flash screen   ]
.WAV file             : ........................... Browse
Backspace key       : [Backspace  ]
F1-F4 keys          : [Normal     ]
Cursor key mode     : [Normal     ]
Keypad mode         : [Normal     ]
Create sess dialog  : [Medium ]
SCO-ANSI compatible : [ ]   Keyboard [ ]
Cursor height       : 16 Blinks: [X] <Color>
Local echo          : [ ]
Screen debug mode   : [Off   ]
Packet bounds trace : [ ]

Explicit exit       : [X]
Function keys locked: [ ]
Session switch wraps: [X]


9.18.1: Setup: Bell abuse settings

This dialog allows you to set the BELL_ABUSE parameters.
This is a way to prevent excessive noise when the host sends many BELL characters or a binary file to the screen.


Disable bell when overused  : [X]
This many bells             : [5   ]
In this many seconds        : [2   ]
Seconds of silence required : [5   ]


9.18.2: Setup: Local echo mode

A late addition to IVT, this will simply echo everything you type to the screen. If the host is also echoing, you will see everything twice.

If the host is not echoing, you can use this to make the things you type visible. It can be turned on and off from this dialog.

This is also handy if you want to try the effect of some function keys and such within IVT. This feature can also be turned on and off by the host by using the CSI 12 l/h command. When you want to turn on local echo for a session automatically, use a small script such as:


   ONCONNECT * LocalEchoOn
   Script LocalEchoOn
      HIDE
      VTECHO "\1B[12l"  # Send CSI 12 l, turns local echo on.
   END


9.19: Mouse setup

This dialog allows you to configure the actions taken by IVT in response to various mouse actions in the sessions screen and history pager.


Mouse mode                   : [Cut/Paste]
Cut mode                     : [Block]
Hide while typing            : [X]
Copy scroll speed            : 4..
Wheel scroll factor          : 1
Wheel scroll page size       : 24
Leave selection visible      : [X]
Word/phrase selection        : [IVT (double button) ]
Putty-separators             : [ ]  <View/Configure>
Extend to full line          : [X]
Copy to clipboard in RTF, too: [X]
Use strict CUT mode          : [X]
Paste trailing newline       : [X]
Trim trailing spaces         : [X]
Unicode smart paste          : [X]
Show usage in status         : [X]
XTERM2 same as XTERM         : [ ]
Bracketed paste support      : [X]

IVT uses the mouse very extensively, please have a look at the special mouse chapter, especially the advanced possibilities.


9.20: Color setup

Colors can be specified multiple ways. Some forms go all the way back to the first MS/DOS version of IVT. The preferred syntax is the 2nd column.


0       Black
1       Blue
2       Green
3       Cyan
4       Red
5       Magenta
6       Brown
7       White
8       Grey
9       Brightblue
10      Brightgreen
11      Brightcyan
12      Brightred
13      Brightmagenta
14      YellowZe
--      Default

Actually, any combination of "bright" with a color is valid, so you can also specify "brightblack" (grey) and "brightbrown" (yellow).

The special 'Default' is used when you use the COLORATTRIBUTE function to code a color to be used in a DIALOG. The default will select either the default dialog foreground or background color, whatever that is.

All color statements in IVT.RC can take either the name or the number as a specification of the desired color. See also COLORS.

Note that IVT will swap the selected background color with the VT220 default (black), so that when a program explicitly selects black, IVT will use whatever background you select, and when the application selects your background color, IVT will use black. This will keep color displays readable (and I know of one application that selects black foreground color to hide passwords by making them black-on-black so they would show when the background color of IVT was white...
See also SOFTBLINK.


Session foreground RGB  :   0   0   0     <Modify>
Session background RGB  : 255 255 255     <Modify>
Cursor foreground RGB   :   0   0   0     <Modify>
Cursor background RGB   :   0   255 0     <Modify>
Reverse CUT             : [ ]
Cut foreground RGB      : 255 255 255
Cut background RGB      :   0   0 255     <Modify>
Search foreground RGB   :   0   0   0     <Modify>
Search background RGB   : 255 255   0     <Modify>
Tooltip foreground RGB  :   0   0   0     <Modify>
Tooltip background RGB  : 255 255   0     <Modify>
Marker foreground RGB   :   0   0   0     <Modify>
Marker background RGB   : 255 255   0     <Modify>
Automatic color contrast: [ ]
Xterm 256 color mode    : [X]
Monochrome screen       : [ ]

Help screens            : [White  ] [Blue   ]  Example
Selected hyperlink      : [White  ] [Green  ]  Example
Unselected hyperlink    : [White  ] [Red    ]  Example
Ready indicator         : [Black  ] [Green  ]  Example

Blink Color Foreground  : [ ]   Background  [ ] Default only
Underl. Color Foreground: [ ]   Background  [ ]
Inverse Color Foreground: [ ]   Background  [ ]
Bold Color Foreground   : [ ]   Background  [ ]

<Redefine ANSI colors>
<Redefine attribute colors>

When you want to use colors instead of true underlining, use the checkbox on the "Underline" items (just before the "Modify" button) to enable this feature. Similarly for colors instead of true blinking.


9.21: Font and Keyboard

This panel controls the main look & feel options of IVT, the font, code page and the way the keyboard behaves.
Also, bi-directional text is configured using the button here.
Also, the language of IVT itself can be configured here.


Current font               : Face=Lucida Console,Points=9
Font quality               : Default
Poorman's linedraw         : [ ]
Display zero               : [Normal   ]
Bold style                 : [Auto     ]
Autom font resize          : [ ]
8-bit char display         : [Codepage]   [DEC     ]
8-bit command mode         : [Executed]
Received data character set: [ISO-8859-1:1998 (Latin 1, West Europe) ]
Treat ambiguous CJK as wide: [ ]
Bi-directional text        : <View/Configure>
National replacement       : [US ASCII       ]
IVT language               : [English   ]
Input language             : [Use system default    ]

CAPS lock mode             : [Allowed   ]
Keyboard map               : [VT220]  [Exceptions]
[ ] EMACS ALT is META
[X] CAPS+SHIFT is lower case
[X] PF1-PF4 on top row numpad
[X] ALT by itself activates menu
[X] Recognize ALT-0/9 on foreign keyboards
[ ] Key click
[ ] Keyboard debug


9.22: Keyboard map exceptions

This panel allows you to configure how certain IVT reserved key strokes are handled when the keyboard is in XTERM mode (which conflicts with those IVT reserved keys).
You can reach this setup panel from: Font/Keyboard, Keyboard map exceptions.

[ ] Alt-Cursor switches sessions
[X] Alt-Cursor enters pager
[X] Alt-T toggles sessions
[X] Alt-Digit switches sessions
[X] Ctrl-PgUp/Down creates sessions


9.23: BIDI Settings

This panel allows you to configure the bi-directional text features of IVT.
By default, IVT will handle scripts like Arabic and Hebrew that go from left- to-right on the screen (LTR) instead of right-to-left (RTL).
Various options can be turned on or off, including automatic switching of the Windows keyboard input language when the host sends an explicit RTL command.


Bi-directional text        : [X]
Arabic text shaping        : [X]
Enable ESC%0 and ESC%1     : [X]
Input language for RTL     : [Use system default]
Input language for LTR     : [Use system default]


9.24: Log settings

This dialog controls the creation of log files of session data.
The top of the dialog shows the current logging settings.
Auto logging is a powerful feature of IVT that allows you to configure an automatic log file for all your sessions to a unique name, optionally organized in directories per day, or per host, or any other scheme you can think of. An icon in the status bar allows control over logging.


Autolog name     : .............................................
Autolog mode     : [Off ]  Suspend   Resume
Timestamp lines  : [X]
Write file header: [X]
Show in status   : [X]
Start mode       : [Ask user   ]

Automatic logging can also be combined with a script, see this example.


9.25: Windows setup

This panel allows you to configure many of the look and feel options of IVT, all sorts of screen furniture like status bar, tabs bar, scroll bar and so on can be turned on or off, sized and configured.


Advanced user interface : [X]
Menu bars               : [X]
Vertical scroll bar     : [X]
Status line             : [X]  Borders   : [X]  Middle:  [Clock]
TABs bar                : [View/Configure]
Full screen scrollbar   : [X]   Menu bar [X]  Statusline [X]
Extra vertical border   : 2     Horizontal: 0
Delay before tooltips   : 300   Keep for  : 3000
Address book size       : 25
Auto complete hosts     : [Any   ] Name list: [All hosts] Sort: [X]
Import PuTTY hosts      : [X]
Show start-up tips      : [ ]
Window position         : [Last known]
Window coordinates   X  : 10    Y: 20   <Copy current>
Always on top           : [ ]
Confirm URL click       : [ ]
Alt+Enter is full screen: [X]
Window transparency     : 0  (0 disables)
IVT title bar displays  : [Session comment]
Fixed title bar text    : Test comment.......................
Software blink speed    : 400

<Propagate settings>     <Show IVT splash screen>


9.26: Printer setup

This dialog allows you to add, delete and modify printers. You can also assign a specific printer to the current session, change the default printer and modify the way the manual pages are printed.
If you make changes to Windows printers, these changes can be saved to the registry. When IVT starts up, it will re-apply the changes to those printers.
When printers are removed, the IVT extra settings will be discarded the next time you save the setup.

Not all items below are visible for all printers. There are two different types of printers:

The first type is detected automatically, the second is added using the button below (Add a printer-to-file-).


Printer         : [hp deskjet 930c series (Dflt)  ]
Font            : Facename=Lucida Console,Points=9
Open for        : [Append   ]
Timeout         : [10 ]    <Properties>
Print mode      : [Off     ]
Auto landscape  : [X]
Auto Form Feed  : [X]
Font scaling    : [X]
Black/white only: [ ]
Prompt if exists: [X]
Controller mode : [Raw  ]
print mode      : [Off       ]
<Make this printer the default>
<Add a printer-to-file>
<Delete this printer  >

Print screen with statusline: [X]
Confirm print screens       : [X]
Confirm print selections    : [X]
Print screen with timestamp : [X]
Manual prints lines/page    : [61  ]
Manual prints indents       : [10  ].

With this, you can control the logical printer for the current session, or add new (logical) printers for the current (and future) sessions.
IVT will show all your Windows printers here, with their normal names. You cannot delete such printers, and you cannot set a page length for them (this depends on the paper size and it automatically determined at print time).
You can click on the FONT line to change the font used for all text output to printers. Click on the <Properties> button to change the default properties for the printer.
All other printers are files, and treated as such.

If you just want to print a Unix file, check out the privt support program! This prints Unix files on your Windows printer!

IVT can manage multiple printers (each 'printer' can be any writable file).
A session can be connected to one of these printers. A printer may be shared by several sessions (output will be intermixed from all sessions). Of course, different sessions may have different printers, which can all be simultaneously active.

A printer is selected in this setup screen. Logical printers can be added by clicking on this button. A newly created printer becomes the default for the current session only.
By clicking on the <Make this printer the default> button, the selected printer will become the default printer for all new sessions.
The PRINTER keyword can be used in an IVT.RC file to define the default printer.

Every printer has an overwrite/append flag that determines how the printer will be opened. When 'overwrite' is selected, any existing file is overwritten.
When 'append' is selected, output is appended to that file. For a true device the setting is (usually) irrelevant.
There is also a timeout associated with each printer. When the specified number of seconds has elapsed without activity for the printer, it will be closed automatically.

A printer is 'opened' by the first session that sends something to that printer. This can be done by:

When a printer is active for the session, a icon will show in the status line. The printer is not closed until a "FLUSH PRINTER" button is used from the main setup screen, or the specified PRTIMEOUT value elapses without activity. A click on the icon also closes the printer.

Closing will cause actual printing to start on spooled (network) printers (this prevents every PrintScreen from becoming a separate spooled print job, thus saving paper, banner-pages and aggravation).

Using the black & white feature will suppress color printing.

Also, you can record an entire session to a printer without generating many individual print jobs every time nothing happens for a few seconds (but see also AUTOLOG for better ways of logging sessions).

See also PRINTER, PRTIMEOUT , AUTOLANDSCAPE, PRINTER_FONT_SCALE and PRBLACKWHITE.


9.27: Keyboard macros

Keyboard macros allow you to program keys manually (learn mode). You choose a key you want to program, and start the recorder. IVT will switch you to the session screen and will start recording every keystroke. You end learn mode (which is indicated in the status line by an icon) by returning to setup and choosing the <Keyboard macro> button again (which will read "END MACRO" in that case). Alternatively, type Shift+Ctrl+End or use the menu bar.
See LEARN for details, or click on any of the links below for detailed help on that particular option.
Macros are saved into the registry when you save your setup settings.


<Choose key to program>

This session only      : [ ]
VT220 key only         : [ ]
Match LEFT/RIGHT Shift : [ ]
Match LEFT/RIGHT Ctrl  : [ ]
Match LEFT/RIGHT Alt   : [ ]
Match CAPSLOCK key     : [ ]     <Read/Write macro files>
Match NUMLOCK  key     : [ ]
Match SCROLL LOCK key  : [ ]     <Delete all macros>
Match Scan Code        : [ ]
Recursive expansion    : [X]

Type of programming    : [Keyboard recorder         ]
Bracketed paste        : [Auto]
Fixed string value     : ..............................
Script to invoke       : ..............................
Function to perform    : ALT-0 (any key)...............

<Start recorder> <Delete key>          <Cancel>  <OK>

For a detailed explanation on key macros and their many options, see the special chapter on learn mode.


9.28: Encrypting files


Filename            : .............................................
<Browse for file>
Use default password: [ ]
Password            : ........
Password (retype)   : ........
<Encrypt>    <Decrypt>

This panel allows you to encrypt or decrypt files with either a default key or a password you supply. When a default key is chosen, the file can never be decrypted (!), but can be read by IVT during start-up without prompting for the password. However, see also CRYPTPWD, which allows you to store keys in a file which is encrypted with the default key (so IVT can decrypt that file, learn your passwords, and decrypt other files without prompting for the password).
See Encrypting .RC file for more details.


9.29: ZMODEM setup

IVT supports file transfer. The easiest way to send a file to the host is to install "rz" on Unix and drop a file on the IVT window: transfer will be automatic. Typing "sz file" on Unix will send the file to your download directory which you can configure here.


Download directory        : C:/tmp/transfer....................
Upload directory          : ...................................
Host has buggy binary     : [ ]
Autodetect ZMODEM transfer: [X]
Maximum &packet size      : [1024]


9.30: Setup: Reset terminal

When you type an F3-R sequence (or click on the "Reset Terminal" button in the main F3 setup panel), the virtual terminal will be reset to default settings. Use this when the session has gotten stuck or in an inoperable state due to (for example) sending a binary file to the terminal (cat-ting an executable is an oft made Unix error that can bring a terminal in such a state). F3-R will do everything that a host initiated reset command does, and will also:

The last feature is useful if you want to do a simple sort of file transfer. You can first clear the history pager buffers, then start a command sending a lot of output to the terminal, then use ALT+s in pager mode to save the entire buffer contents to a file.

By the way, also look into F3-D for a quick way of getting rid of unwanted output sent by a host.

Note: F3-R resets the current terminal to the terminal defaults. If you have made configuration changes that affect all sessions (like the title bar setting or the status line settings), they are NOT restored.
For that you'll have to change them back or exit IVT and restart.

See also CANCEL, to protect scripts against being aborted.


9.31: Setup: Cancel scripts

The F3-R command resets an entire terminal. One of the results of this is that any running script is cancelled.

The F3-C command (either typed or by clicking on the "Cancel Scripts" button in the main F3 setup panel) is less destructive - it ONLY terminates all scripts and threads that are active for the current session. Use this if a complex chat-script runs into difficulties due to unexpected responses from the host.
Aborting a script also undoes any DISPLAY OFF command, and restores any temporary status text set by a STATUSTXT command.
All existing WINDOWs are killed.

See also the CANCEL statement, by which a script can protect itself from termination by either F3-R or F3-C. Such a script can only be stopped by

See also the IVTFUNCTION with argument "Restore config". That will reset all private session configuration data to the startup defaults, but will leave the history and current screen untouched, will not alter VOLATILE settings and so on. This can be used, for example, to reset all theme settings.

a KILL, termination of the session or its own free will.


9.32: Setup: Dump data

Sometimes, a host is given a wrong command and starts sending tons of binary garbage to the terminal. In Unix, cat-ting an executable file is a well-known example of this. Normally, you would interrupt this with ^C, but sometimes the network has accumulated tons of data in buffers that IVT has to wade through because the buffers are not always cleared when you use ^C.
Normally, this is not a problem because IVT is so fast, but binary data can contain a lot of garbage that causes a lot of processing in IVT - the most obvious example is a BELL character which will cause IVT to ring the bell for a substantial fraction of a second. For some unknown reason, there are a lot of BELL characters in the average executable :-)

Whenever a host starts doing this, you can use the F3-D command - IVT will start throwing away everything that arrives on the session without actually looking at the data - it only counts the number of characters discarded this way and displays this counter on the screen. It will keep doing this until:

In both cases, IVT will then switch back to the session. Afterwards, the F3-R command may be needed to get rid of side effects of the garbage that got processed before you managed to type an F3-D.


9.33: Setup: Flush printer

Printers are usually not attached physically to a Windows PC anymore.
Instead, you will have a network connection to a printer. When the printer is opened, all output is accumulated in a file which gets printed when the printer is closed. This is different from a real VT220, where a physical, noisy printer could be attached to the back of the VT220 terminal, and every line (or character) would get printed immediately.

When IVT opens a printer, a printer icon shows in the status line. The printer stays active until:

Only then will your job actually start printing (or the file is closed in case of a (manually added) printer that is actually a file).

See also AUTOLOG.


9.34: Setup: Highlight strings on the session

This screen is reached from either the 'Extra' menu or from the VT220 settings panel in setup.

This setup screen allows you maintain a list of regular expressions that will be highlighted on the session screen when data appears that matches those expressions. There is an overview screen that shows the most important characteristics of the current setup, with an ADD, REMOVE and VIEW buttons and a 'disable all' option.
The ADD and VIEW buttons will bring you to the maintenance panel for a single HIGHLIGHT item that will show all the details of a single entry:


Enabled               : [X]
Current session only  : [ ]
Regular expression    : [IVT is great            ]
Exclude expression    : [                        ]
Description           : [A simple truth          ]
Case insensitive      : [X]
Trim spaces on right  : [ ]
Blink                 : [ ]
Underline             : [ ]
On default colors only: [ ]
Tooltip text          : [Get it now!             ]
Script on button 1    : [                        ]
Script on button 2    : [                        ]
Script on button 3    : [                        ]
Automatic script call : [                        ]
Predefined action     : [None                    ]
Foreground RGB        : [255] [255] [255]  Default: [ ]
Background RGB        : [  0] [  0] [255]  Default: [ ]


9.35: Setup: TABS bar properties

This setup screen is reached from Setup->Windows setup->View/Configure tabs bar. It can be used to configure the appearance of the TABSBAR.


TABs bar enabled              [X]
Tabs in full screen           [X]
Show '+' tab                  [X]
Enable multiple TAB lines     [X]
Close icon per tab            [X]
Confirm close                 [X]
Sequence number               [X]
Tab contains                  [User@Host  ]
Font                          [Facename=System,Points=9]
Extra pixels under tabs       [2   ]
Extensions (color, animation) [X]
Activity indicator            [X]
Tab base color                [240] [240] [240]
Selected tab foreground       [0  ] [0  ] [0  ]
Selected tab background       [255] [255] [255]
Deselected tab foreground     [0  ] [0  ] [0  ]
Deselected tab background     [181] [181] [181]
Error tab foreground          [255] [255] [255]
Error tab background          [255] [0  ] [0  ]


This is an important feature, others are prev/next


10: F4 - Help & Various functions

10.1: F4-S: Session ordering

Using F4-S(essions) will take you to a panel that shows all existing sessions and their primary attributes. These attributes are:

While in this panel, you can perform the following actions:

Click on the "Edit/details" button to view or change the session details. This will bring up a new dialog with the following fields:

You can also quick-select the F4-S screen by clicking the mouse on the position of the hostname or comment-parts of the status line.
Yet another way is to select the WINDOW menu on the menu bar.


This is an important feature, others are prev/next


10.2: F4-G: Create a named group of sessions

The CREATEGROUP statement can be used in an IVT.RC file to describe a logical group of sessions. The group has a name and a description.
Your setup may have multiple CREATEGROUP statements, each group presumably describes a group of sessions you want to create in a single operation.

Such a group of sessions can be created by typing the name of the group at the Ctrl+PgDown prompt, but this screen offers an even easier way.

The F4-G screen shows all such named CREATEGROUP groups (name and description).
The standard cursor keys can be used to select an entry, the ENTER key can be used to select the current entry.
Even easier is to simply click on one of the lines.
There is an entry on the menu bar in the SESSIONS menu too.

IVT will immediately create the bunch of sessions that belong to the group.
When you use the password learning and autologin system, all these sessions can log in and perform some task after logging in too! This means you can create a whole bunch of sessions with only a few mouse-clicks that will start your mail, news etc. programs for you on demand.
Using the -A or -agrp command line options allows you to do this from a shortcut on your desktop or your start-up folder.


10.3: F4-X: Managing scripts

Scripts can be written and stored in IVT.RC files. IVT will read these files at start-up. You can also explicitly read files using F4-X-R, which is convenient when you are developing scripts.
A script is parsed and loaded into memory, from where it can be executed by using F4-X, selecting the proper script, and typing ENTER.
Alternatively, you can simply click on the appropriate line.
A script can be removed from memory from the F4-X screen by typing DEL there.

Scripts come in two types: Visible and HIDDEN ones. Visible means that the F4-x screen will show them and the user can invoke them. HIDDEN scripts can only be called by other scripts.
When a script is not hidden, a DESCRIBE statement can be used to describe the purpose of the script. This will be shown in the F4-X screen, too.

When complex series of scripts are developed (such as the modem dialer example) it can be convenient to have them in separate files, which can be INCLUDEd from your main IVT.RC file.

Any of these files can be encrypted, IVT will prompt for the password when none of the passwords it has remembered work.

Scripts can take parameters. The F4-X screen does not offer any interface to pass parameters, however. When required, you will have to write a wrapper script that interactively asks for these parameters (e.g. using KbdLine or PROMPT) and then calls the function actually desired.


10.4: F4-K: Managing macro's

All keys in IVT are programmable in various ways:


This is an important feature, others are prev/next


11: Protocols supported by IVT

11.1: Overview of supported protocols

One of the major features of IVT is that it can run several sessions simultaneously, even over different transport (low-level) protocols and several built-in session (higher-level) protocols. See the PROTOCOL IVT.RC statement for a description of how to select these protocols.

IVT supports the transport protocols listed below. However, IVT can be compiled with or without support for any of them. See the PROTOCOL documentation for a list of protocols actually supported by THIS version of IVT:

When you use a network protocol, the hostnames you use must match the convention of that protocol. This means that hostnames typed in on the command line, CREATE statements or the CTRL+PgDown prompt depend on the protocol that will be chosen by IVT for the new session. This can be set using either the setup screen or the PROTOCOL statement.
Each section below describes the possible hostnames you may use for that particular protocol.

IVT also supports several session protocols to run on top of the transport protocols. For example, on top of TCP/IP you would have to use either RLOGIN or TELNET to get a login session with a Unix machine. The session protocol determines how to interpret the data sent by the host. Currently, IVT supports:

TELNET The classic TCP/IP network terminal emulation protocol.
Kerberos An authentication and encryption layer on top of TELNET.
RLOGIN A simple system based on (unwarranted) trust.
SSH Secure shell which encrypts network traffic.
MULTI This is a special IVT  multiplex protocol that can run on top of anything and can be used to have multiple sessions on a single connection (usually, a serial connection).

See the appropriate sections for further details.


11.2: Transport protocols

11.2.1: The NetBios transport protocol

When the NETBIOS protocol is chosen, IVT will check to see if NetBios protocol stacks are available on your computer. The NetBios interface is actually only an API (application program interface) that will usually use NetBeui or TopNetBios or some such protocol as the actual transport. But it is also possible to use another transport (such as TCP/IP) "underneath" a NetBios API.
As a good example, Win'95 provides this by default. As far as IVT is concerned, the Win'95 machine offers several logical NetBios adapters, which (in olden days) were used to connect PC's to several LAN's using several physical network adapters.
On Win'95 (or NT) one of these "adapters" is actually NetBios-over-TCP/IP, allowing IVT to make (limited) use of the TCP/IP protocol, which is now in much wider use than Netbeui.

IVT will check for the presence of logical adapters and broadcast a unique name on each network it finds (a necessary ritual on NetBios networks).
When a connection needs to be established, it will attempt each network in turn. When a successful connection is established, IVT will remember what network it found this host on, and the next session will be attempted at that network first (since a failed attempt can take many seconds and you will usually talk to hosts on one network only).

NetBios hostnames are typically names (just one word), such as "SERV01".
Sometimes, these names end in ".LOGIN", so a typical name might be SERV01.LOGIN. OliNet LAN was the birthplace of IVT, so IVT still appends this .LOGIN as a default to every NetBios hostname unless you tell it not to by using the -L command line option or the OPTIONS statement in an IVT.RC file.

This protocol has fallen out of use ever since 1995 or thereabouts.
WinSock is now the protocol of choice.


11.2.2: The TCP transport protocol

Sorry - this MS/DOS protocol is not in this version of IVT.

The second protocol to be supported by IVT was FTP Inc's TCP/IP implementation for MS/DOS based computers. This commercial package offers a TCP/IP stack together with a package to develop applications on top of this stack.

IVT uses the 'telnet' library offered by this package to enable it to make direct login connections using the telnet protocol.
Actually, this introduces a design problem, since IVT ought to support its own TELNET session-protocol on top of any transport protocol (such as the socket interface also offered by this development package). But time was short and the functionality was important, so the IVT transport "TCP" is actually a transport + session protocol rolled into one.
Later, this was rectified with the introduction of the WINSOCK transport protocol and RLOGIN and TELNET session protocols.

You need to purchase Ftp Inc's DOS stack to be able to use IVT with the TCP protocol. IVT will automatically detect this protocol and use it when no other LAN interfaces (such as NetBios) are detected.

When you specify a hostname to connect to, you must either specify a name that can be resolved by your TCP/IP setup (using the hosts files and/or DNS name services) OR a dotted-address style internet address (like 145.72.248.60).

Optionally, this address can be followed by a : and a port number. The default port number is 23 (telnet), but you can connect to other ports this way (the SMTP port 25 being the most popular one).
This notation can be used in CREATE statements, too.

The current telnet protocol also allows a few special TELNET functions, accessible via this setup screen.


11.2.3: The WINSOCK transport protocol

Adding the WINSOCK interface to IVT was no small feat. IVT was a DOS program, and WINSOCK is a Windows Socket interface (Sockets being a way to interface to TCP/IP networks).

After a brief and disappointing experiment with Winsock for DOS and the DJGPP C-compiler I discovered I could compile large hunks of IVT with the visual C++ environment for Windows. The result was a text-mode Win32 application, which has full access to all the Windows calls without the GUI overhead.
This enabled me to write an IVT WinSock layer, on top of which I wrote a TELNET engine (from scratch).
The other protocols (NetBios and Serial) were also rewritten for Windows.

I had to make many modifications to the video and mouse system, just about rewrote the keyboard handler and many more small modifications to make IVT run happily under Windows 95 and Windows NT.
New commands were added to take advantage of the Windows possibilities.
The color handling is now much nicer, variable window sizes are used, sound files can be played, etc.

We are talking several months of work here!

IVT is now a fast, flexible, native Win32 application.

In the summer of 2002 I decided to make IVT a GUI application. Trouble with the mouse, keyboard, the latest versions of Windows and the clumsy resize of IVT windows, no font support, no scroll bar and so on finally bothered me enough to do something about it. Version 16.1 is a true GUI program, has true underlining, a scroll bar, font support, true double-wide and double-high characters, and so on. Internally, that meant making IVT a multi-threaded application, yet another rewrite of keyboard and mouse handling, and several thousand extra lines of code to deal with the extra possibilities.

Anyway, WinSock is the underlying transport protocol for (in this build):

In the fall of 2010, IPv6 support was added. The code for resolving addresses needed a rewrite for this, and many changes to the code for connecting sessions (when a host has multiple addresses with a mix of IPv6 and IPv4 then IVT will try them in sequence. Port forwarding, proxy support and so on all had to be made IPv6 aware.


11.2.4: The SERIAL transport protocol

Support for serial communications was introduced in version 7.3 of IVT and was the third way to connect to hosts (next to NetBios and TCP/IP).
Serial lines are really very different from LAN-connections. They are much slower, you can have only one connection on them, and the host you connect to depends on where the physical wire goes. A direct connection is used to connect your PC running IVT to a serial port on another computer, or you can use a modem to dial into other computers via the telephone network.
See the dialer example for further info.

When you are a LAN-user of IVT, the slowness and single-naturedness of these connections is something you have to get used to. To overcome the limitations of these serial connections, IVT comes with two extensions:

When the initial connection to a serial "host" is made, IVT only opens the serial port of the local computer. Therefore, the hostname specified on the command line must take the form of:


   COMn[,baud[,parity[,databits[,stopbits]]]]

Where all these fields have the following meaning:

n The port number (1 - n). This version of IVT supports port numbers larger than 4. Internally, the necessary work is done to support port numbers over 10.
baud Baud rate (110, 300, 1200, 4800, 9600, 14400, 19200, 38400, 56000 or 112000)
parity None, Even, Odd, Space, Mark
databits 7 or 8
stopbits 1 or 2

Example: COM2,19200,n,7

Only the port number is compulsory, the rest is optional and defaults to:

        9600,n,8,1

The IVT.RC commands you can use to change the settings of a serial port are:

BAUD Change the speed (baud rate) of the connection.
PARITY Specify the parity-bit to be used.
CARRIERSTATUS What to do with the CARRIER signal of the serial line.
DBITS Number of data bits.
SBITS Number of stop bits.
CTSRTS Hardware flow control on/off.
SR_XONOFF_IN Set remote flow control to on or off.
SR_XONOFF_OUT Sets local flow control to on or off.
RING Use PC-speaker as phone bell.

The status line will reflect the current port selections. The leftmost position is used as modem indicator.
The serial setup screen also allows you to verify and change all serial port settings.

Starting from version 14.1a, you can also send a BREAK signal on a serial line. From this setup screen, you can initiate either a short (250 Ms) or a long (1.5 seconds) break. This puts the connection in a special state that is sometimes used to wake up a remote host or reset the connection.
When you click or enter on the appropriate line, you will be switched back to the session automatically.


11.2.5: The multiplex transport protocol

Sorry - not in this version of IVT.

IVT allows multiplexing multiple sessions over a single connection. Very handy when you are using a non-LAN connection (e.g. serial line), though this session protocol is also supported on all other transport protocols.

This mode is entered by running the Unix multiplexer ivtmux on the remote end.
The 'normal' session disappears, to be replaced by a new login on a pseudo terminal on the Unix host. This login is necessary to make sure that you get a 'real' new login session that is registered as such in Unix (in the utmp file, for example). The original session is made non-writable because a special protocol is now spoken on it. A message from the sysop (using e.g.
wall) would interfere with this protocol.

New sessions can be created/closed in a normal fashion, the only difference being that you do not start a session to a computer, but must specify a remote command that will be started on a new pseudo-terminal.
The default command is telnet %s, where %s is substituted by whatever you specify as hostname. This default command can be changed using the MLDEFCMD IVT.RC setting (e.g. rlogin %s).

The upshot of all this is that, once ivtmux is started on Unix, you can pretend you are on the local LAN of that computer and create sessions to all other machines on that LAN. Everything works the same except for the telnet escape character of the Telnet running on Unix (usually CTRL+] or CTRL+A).
This will give you a telnet prompt which you might not expect.

Logging out from a session will terminate the particular telnet (or rlogin), which will cause ivtmux to send a special message to IVT so it can close the session. Depending on the setting of RECONNECT, this will either display a message that the session ended (when RECONNECT is in effect) or will make it quietly disappear (when NO_RECONNECT is in effect).

When the last session started from IVTMUX terminates, it itself exits. This should cause your underlying session to reappear, and things are back to the way they were before you started IVTMUX (a single session).

There is another problem that arises when you use a modem dialup to a host on which you want to run ivtmux. The binary protocol used by ivtmux can confuse hardware between IVT and the Unix host (modems, port selectors, multiplexers and what have you). XON/XOFF characters are notorious, so are NULL characters that sometimes get eaten somewhere along the line.

If you already used TELNET or RLOGIN before reaching the host you run ivtmux on, the escape sequences of those programs become special, too.

To avoid these special characters, use the MLFILTER command. Here you can specify a simple list of decimal ASCII codes, which will be escaped on the link (taking 3 bytes rather than 1, so don't overdo it).

Remember that all the sessions used from ivtmux have to share a single modem connection with limited speed. Doing a file transfer in one session will have a noticeable effect on performance in the other sessions. Also, consider what has to happen when you use F1 (Hold Screen) on one of these sessions. IVT cannot simply stop reading (like when it is a LAN session) because data intended for that session would block data intended for other sessions.
Therefore, IVT will send a message to ivtmux when F1 is pressed, which will cause it to stop sending data for that session.
Another F1 will resume output.
This makes F1 less immediate than usual, but that is a small price to pay.

The last catch has to do with systems that fail, causing the link between IVT and IVTMUX to be broken (modem that loses a connection, crashing Unix system (rare, but happens :-) or a failure in either IVT or IVTMUX.
The 'solution' for this is that you can forcibly disconnect sessions by using ALT+F4 in the normal fashion. The FIRST time you do this on a session managed by IVTMUX, IVT will send a termination message to IVTMUX. Normally, this will result in a close of the session, which is acknowledged by IVTMUX, which will result in a normal shutdown of that session.

If IVTMUX is not responding (for whatever reason), a SECOND ALT+F4 will result in an immediate local abort of that session in IVT. This way, you can clear all sessions that are left behind when the original connection is lost.

On the IVTMUX side, all sessions will be killed automatically when the connection to IVT disappears prematurely, and IVTMUX itself will exit.
Normally, this should free up everything, making the session available again.

Multiplexed sessions can be mixed with 'normal' sessions, so you can have a LAN session between your PC and Unix box at home, while simultaneously dialing out through a modem to a Unix box that runs ivtmux.


11.3: The IVTMUX program

This version of IVT does not support the multiplexing protocol.

The multiplexing protocol allows you to run several independent simultaneous sessions over a single connection (such as a serial line). It will also work over other types of connections (such as TELNET or RLOGIN sessions).

The details about using ivtmux are explained here. This section explains how to get the ivtmiux program running on your Unix hosts (which is currently the only environment supported by IVTMUX).

In your IVT distribution kit you'll find the file 'ivtmux.c'.
This file can be compiled on:

Ports to other flavors of Unix are possible.

Simply typing:

        make ivtmux

to any Unix prompt should result in a 'cc -O ivtmux.c -o ivtmux', which implies a default compile of the source into an optimized 'ivtm' executable.
Simply starting this executable (no parameters) should be everything you ever need to know about it. When things do NOT work as advertised, you might try:

        ivtmux -d

which will create a file called ivtmux.debug with (very) detailed debugging.
Ask for support (at support@ivtssh.nl) if you have trouble.


11.3.1: The DUMMY transport protocol

The DUMMY protocol is a late addition to IVT (appeared in version 20.1).
It is a very simple protocol:

The reason for this protocol is that sometimes you just want to use IVT as a batch system that connects dynamically to all sorts of hosts, or even just reads and writes local files.
IVT insists that you have a session context to run scripts in, so you need a connection to "something" before you can call scripts, have variables, and are able to create THREADs or FORK sessions.

Without the DUMMY protocol, you would have to resort to a connection to some localhost port, or a serial connection, or even a real connection to some host you happened to have just to satisfy the session requirement.

All these have serious problems, since a serial port may not be available, or the localhost connection can fail or cause problems (by sending some data you did not expect or want), the remote host can be down or unreachable, etc.

Because a connection to a host using the dummy protocol is a full blown session, you can use the full array of commands and variables IVT has to offer. You can use the actual HOSTNAME variable as a sort of label (it appears in the status bar). You can have as many simultaneous sessions to DUMMY as you require.

You can choose the DUMMY protocol from the command line using the -D option.


11.4: Session protocols

11.4.1: The TELNET session protocol

The WINSOCK transport protocol enables IVT to use the TCP/IP layer of Windows workstations. However, this in itself is useless without a transport protocol such as TELNET or RLOGIN.

TELNET is an old and very widespread protocol. It can be used between very different types of computers because it implements a device called an NVT (Network Virtual Terminal) on both sides of the connection. The NVT must implement a number of basic features and handling the peculiarities of the local operating system and/or hardware is the task of the telnet terminal or telnet host.

Besides the basic features, many options were added to the TELNET protocol.
The basic NVT implements a negotiation protocol for these options.
Every TELNET implementation can request a certain option to take effect and it can reject every option that it does not know about. This allows advanced implementations to work with older and/or less advanced peers.
Every option is described in a separate RFC (Request For Comment). The texts of these RFC's are freely downloadable from the Internet. I've downloaded all of them and implemented a lot of them, which makes IVT one of the most complete TELNET implementations around. I have seen many "modern" hosts reject requests from IVT to enable a TELNET feature that IVT knows about.

When you enable TELNET_TRACE, IVT will show the negotiation process on screen.
For every request the host makes, IVT will show "Received DO <option>". The option is described and the RFC that defines it is named as well.
When IVT can handle the option, it will say 'WILL <option>'. When IVT cannot or will not do the option, it will say 'WONT <option>'.
Usually, the host will start by sending a bunch of options that it wants enabled. When these are all answered, IVT will inspect unrequested ones that it would like to see enabled and give it a try by sending out its own 'DO' commands. Usually, it is rewarded by a bunch of 'WONT' answers because these are the ones the host does not know about.

For some options, when a host receives a 'WILL' from IVT, it means that the host is now allowed more complex commands, such as the 'Terminal Type' option.
When the host wants to know what kind of terminal is being emulated, it will first ask 'DO TERMINAL-TYPE'. When IVT replies 'WILL TERMINAL-TYPE' the host will say 'SUB-OPTION TERMINAL-TYPE SEND' which means: "Please be so kind to send me the type of terminal, which you can, because you said 'WILL'".
You can use the TELNET_TTYPE command in an IVT.RC file to specify the value that IVT will transmit to the host (defaults to vt220).

At the end of all the negotiations, the host will usually display the login prompt.

Below you find the full list of options for the TELNET protocol. The ones that appear bold are the ones implemented by IVT. The other ones are either not applicable for a TELNET client such as IVT, or I have not found the time yet to implement them. Stay tuned!

BINARY RFC 856 : Binary transmission
ECHO RFC 857 : Echo mode
RCP RFC 426 : Prep. reconnect (RFC671)
SGA RFC 858 : Suppress Go Ahead
STATUS RFC 859 : Status option
TM RFC 860 : Timing mark
RCTE RFC 560 : Remote controlled echo
XASCII RFC 698 : Extended ASCII
LOGOUT RFC 727 : Force logout
BM RFC 735 : Byte macro
DET RFC 1043,732: Data entry terminal
SUPDUP RFC 734,736 : Supdup protocol
SNDLOC RFC 779 : Send location
TTYPE RFC 1091: Terminal type
EOR RFC 885 : End of record
TUID RFC 927 : TACACS User identification
OUTMRK RFC 933 : Output marking
TTYLOC RFC 946 : Terminal location
3270REG RFC 1041: 3270 regime option
X3PAD RFC 1053: X.3 PAD option
NAWS RFC 1073: Window size
TSPEED RFC 1079: Terminal speed
Q method RFC 1143: The Q method of implementing TELNET negotiation
LFLOW RFC 1372: Remote flow control
LINEMODE RFC 1184: Line mode option
XDISPLOC RFC 1096: X display location
ENVIRON RFC 1408: Environment
AUTH RFC 1416: Authentication
NEW_ENV RFC 1572: New environment
CHARSET RFC 2066: Character set
EXOPL RFC 861 : Extended options list

11.4.2: The RLOGIN session protocol

RLOGIN is a session-protocol that was added in version 8.v of IVT in May 1997.
It is designed to run on top of the WINSOCK protocol (but will run on top of any other protocol, too). RLOGIN is a Unix protocol that allows remote users to login without necessarily supplying a password.

An alternative is TELNET, a more well-known protocol to do the same.
RLOGIN is based on a rather simple 'trust' system, where the host can allow users from particular systems to login using the same user name. When the system is configured to trust the remote system (or user), that particular user on that particular system does not have to supply a password when logging in. Other Unix commands, such as RCP and RSH also work without passwords in this case.
If the remote user is NOT authorized to log in, these utilities will prompt for a password.
Another tidbit of information that can be transmitted to the host is the type of terminal you are using (the Unix TERM environment variable).

IVT can use the RLOGIN protocol with a configurable local user name, remote user name and terminal type. The terminal type defaults to 'vt220', the usernames default to none (empty strings). These defaults can be altered either from this setup screen or with the IVT.RC commands:


RLOGIN_LOCALUSER        : To set the local username
RLOGIN_REMOTEUSER       : To set the username to use on the host
RLOGIN_TERM             : To set the terminal type.

The information is simply passed to the remote host just after the session has been established. If the host does not trust the IP-address that you are calling from, or does not trust the particular user-id that you claim, it may either disconnect or prompt for a password.

Note that the Unix machine tests the originating TCP/IP port (must be a privileged port). On Unix, you have to be 'root' (super user) to get such a port for your outgoing session. The remote host will disconnect any session from an 'untrusted' port immediately. On Unix, the RLOGIN program is privileged. It will also send the actual username of the invoking user to the remote end.

However, on a PC anybody can do anything, so IVT can get a 'privileged' port without any trouble, and it sends a user name to the who as whatever you set it to. If the host chooses to believe all that, that is up to the host.

Nowadays, SSH or Kerberized Telnet are much better alternatives.


11.4.3: Secure Shell (SSH-2)

As of version 17.0 (august 2003), IVT supports Secure Shell version 2, also known as SSH2. The code for this was largely borrowed from PuTTY, and I would once again like to thank the authors of the excellent program for making the source available.

Secure shell is a widely used protocol to encrypt the session between IVT and the target host. The prevents the sniffing of passwords from the LAN (a simple technique that makes TELNET really insecure).
The Kerberos protocol in IVT allows similar protection. SSH and Kerberos solve the same problem in different ways. The major differences are:

The SSH layer of IVT currently supports SSH-2 only. The SSH-1 protocol is deprecated and therefore not supported.
The SSH X-window port forwarding code in IVT is shared between the Kerberos style and SSH style modes.

See the following links for more details:


SSH_CIPHERS             - Specify order of ciphers
SSH_ACCEPT              - Automatically accept/reject host keys
SSH_BUGS                - Detect SSH server bugs
SSH_COMPRESSION         - Data compression in SSH
SSH_DATA                - Sending commands
SSH_DEBUG               - Getting debug information
SSH_INTERACT_PWD        - Enabling keyboard interactive login
SSH_KEEPALIVE           - Send No-Operation packets regularly.
SSH_KEYFILE             - Specifying a private key file
SSH_LOGDATA             - Packet-level debugging
SSH_PSEUDO_TERM         - Allocating a PTY
SSH_TERM                - Specifying terminal type
SSH_XAUTH               - Method of X-windows authentication
FORWARD_X               - X11-port forwarding
XAUTH_DELAY             - XAUTH problem handling.
SSH_FORWARD             - Generic port forwarding
SSH_KEX                 - Key exchange options.
SSH_HOSTKEY_ALGS                - Host key algorithms

SSH_BUGS                - Detection and handling of bugs


12: Syntax of IVT.RC setup files

12.1: Introduction to IVT.RC files and Table Of Contents

When IVT is started, it looks in several places for a file called IVT.RC.
When such a file is found it is read and processed. To be specific, it tries the following names:

All .RC files can be ENCRYPTED (see encrypting files). The file contains IVT commands and/or comments (a line is treated as a comment when the first non-blank is a #-character). Any line can contain a trailing comment, as well.  Scripts are also coded in IVT.RC files.
By using INCLUDE or INCLUDE_OPT statements, your IVT.RC file can include other files.

Note: Settings come in 2 flavors:

IVT maintains a set of defaults for all per-session settings. These defaults are stored in an IVT.RC configuration file, or the registry. If you have a STARTUP script that changes a per-session setting, it will change those defaults (since there is no session yet at startup time). Any session created in the future will start out with those defaults.
When you use a script (or interactive setup) later, only the current session is affected by the change. When you save a PROFILE after altering a per-session setting, that profile can later be used to create sessions with the same settings.
See also the GLOBAL keyword that can be used to explicitly change the global default of a per-session setting in a script.
See also VOLATILE for special handling of changes to settings.

Every chapter in this manual that describes a configuration option will state the type: Global setting or per-session.

Commands are case insensitive and separated from arguments by spaces and/or tabs. Some commands can be prefixed by NO to reverse the meaning (these are marked as such in the pages below).
For readability, this can also be NO_.
Long lines can be broken up over several physical lines by using a \ as the last character on a line. So, for example:


   WINDOW_SIZE # Set default screen size        \
       80%                                      \
       100%                                     \
       DEFAULT

is equivalent to writing "WINDOW_SIZE 80% 100% DEFAULT".
Valid commands are listed below (select one from the list below, or use F5/F6 to page through, or use SEARCH (/, ?) to find a particular topic).


8BITCHARS                IDENTIFY                 SCREENSAVE
ADDRESSBOOK_ONLY         INCLUDE_OPT              SCRIPT_REDEFINE
ADVANCED_MODE            INCLUDE                  SCRIPT
ALT_ENTER                INPUT_LANGUAGE           SCRMODE
ALT_IS_MENU              IPVERSION                SEARCH_CASE_SENSE
ALT_SCREEN               IVT_DIALOGSTATE          SESSION_OVERVIEW
AMBIGUOUS_CJK_WIDE       IVT_LANGUAGE             SESWRAP
ANSWERBACK               KEYBOARD_MAP             SHOWLICENCE
ARABIC_SHAPING           KEYBOARDMOD              SHOWNEWS
AUTOCOMPLETE             KEYMACRO                 SIZE4ALL
AUTOCONTRAST             KEYPADMODE               SIZEFONT
AUTOLANDSCAPE            KRB5_AUTODECRYPT         SMART_PASTE
AUTOLOG_HEADER           KRB5_AUTOENCRYPT         SMOOTH
AUTOLOG                  KRB5_COMERR_DLL          SOFTBLINK
BACKSPACE                KRB5_CRYPTDEBUG          SPEED
BAUD                     KRB5_DLL                 SPLASHTIME
BELL_ABUSE               KRB5_ENDLOGIN            SR_DSR_INPUT
BELL                     KRB5_FORWARD             SR_DSR
BIDI_ESC_RTL             KRB5_LOGINPROG           SR_DTR_CTRL
BIDI_LTR_LANGUAGE        KRB5_REALM               SR_RTS_CTRL
BIDI_RTL_LANGUAGE        KRB5                     SR_WRITETIMEOUT
BIDI_TYPE                LANGUAGE_FILES           SR_XOFF_LIMIT
BIDI                     LAST_POSITION            SR_XON_LIMIT
BIND_ASYNC               LAST_PROTOCOL            SR_XONOFF_IN
BIND_SYNC                LEAVE_COPY_SELECTION     SR_XONOFF_OUT
BIND                     LF_IMP_CR                SSH_ACCEPT
BIT8COMMANDS             LICENCE                  SSH_AGENT
BITMODE                  LICENSE                  SSH_BUG_DERIVEKEY2
BOLD_STYLE               LINKSELCOL               SSH_BUG_HMAC2
BRACKETED_PASTE          LINKUNSELCOL             SSH_BUG_LATE_REPLY
BUGGYBINARY              LOAD                     SSH_BUG_MAXPKT
CAPSBUG                  LOCKTIMER                SSH_BUG_OLDGEX
CAPSLOCK                 MAXTYPEDHOSTS            SSH_BUG_PKSESSID2
CARRIERSTATUS            MENUBAR                  SSH_BUG_REKEY2
CHARSET                  MERCY_MODE               SSH_BUG_RSAPAD
CLICK                    MOUSE_EXTEND_TO_LINE     SSH_CIPHERS
CLOCK                    MOUSE_KEY                SSH_COMPRESSION
CODEPAGE                 MOUSE_KEYLOC             SSH_DATA
CODEPAGEMOD              MOUSE_NOXTERM2           SSH_DEBUG
COLOR_ATTRIBUTE          MOUSE_PUTTY_SELECT       SSH_DES_CBC
COLOR_BLINK              MOUSE_PUTTY_WORDS        SSH_FORWARD
COLOR_CURSOR             MOUSE_SCROLL_FACTOR      SSH_GSSAPI_AUTHENTICATE
COLOR_CUT                MOUSE_SCROLL_PAGESIZE    SSH_GSSAPI_DELEGATE
COLOR_FOR                MOUSE_SELECTION          SSH_GSSAPI_ORDER
COLOR_HELP               MOUSE_USAGE              SSH_GSSAPI_PREFERRED
COLOR_MARKER             MOUSE                    SSH_GSSAPI_REVERSELOOKUP
COLOR_READY              NATIONALITY              SSH_GSSAPI_SYSTEMUSER
COLOR_SEARCH             NUMERICF1F4              SSH_GSSAPI_USERDLL
COLOR_TAB_BASE           NUMLOCK_CORRECTION       SSH_HOSTKEY_ALGS
COLOR_TAB_DESELECT       OBJECT_ID                SSH_HOSTKEYS
COLOR_TAB_ERROR          ONCONNECT                SSH_INTERACT_PWD
COLOR_TAB_SELECT         ONDISCONNECT             SSH_KEEPALIVE
COLOR_TIPS               ONDROPFILES              SSH_KEX_MBYTES
COLOR_UNDERLINE          ONERROR                  SSH_KEX_MINUTES
COLOR_VOLATILE           ONLANGUAGE               SSH_KEX
COLORS                   ONMINIMIZE               SSH_KEYFILE
COLORSCR                 ONRESIZE                 SSH_LOGDATA
COLUMNS                  ONRESTORE                SSH_PAGEANT_ALLOW
CONFIRM_PRINT_SELECT     ONSWITCHFROM             SSH_PAGEANT_AUTO
CONFIRM_PRSCREEN         ONSWITCHTO               SSH_PAGEANT_PATH
CONFIRM_URL_CLICK        ONTABICON                SSH_PSEUDO_TERM
COPY_RICH_TEXT           OPTIONS                  SSH_SENDENV
COPY_STRICT              PACKAGE                  SSH_SHOW_AGENT
COPY_TRIM                PARITY                   SSH_SHOW_DEBUG
COPYSPEED                PASSWORD                 SSH_TERM
CRDIALOG                 PASTE_LAST_NL            SSH_TRIVIAL_AUTH
CREATE                   PASTESPEED               SSH_XAUTH
CREATEGROUP              PR_CONTROLLER            STATBORDERS
CREATEGRP                PR_INDENT                STATMIDDLE
CREATEPROT               PR_LINES                 STATUS
CRYPTPWD                 PRBLACKWHITE             STATUSCLICKS
CTSRTS                   PRECONNECT               STORE_CMD_PARAMS
CURSOR_BLINK             PRINTER_AUTO_FF          STRICT_CHECK
CURSOR_HEIGHT            PRINTER_FONT_SCALE       SUBSTITUTE_FONT
CURSORMODE               PRINTER_FONT             TABSBAR
CUTMODE                  PRINTER_PROMPT           TCP_FLOOD
DBITS                    PRINTER                  TCP_KEEPALIVE
DCE32                    PRIVATE_RC_FILES         TCP_NODELAY
DEBUG_TIMESTAMP          PROFILE                  TELNET_KEEPALIVE
DEBUG                    PROTOCOL                 TELNET_LOCATION
DEFINE_PROFILE           PROXY_DEBUG              TELNET_NEGOTIATE
DODEBUG                  PROXY_DNS                TELNET_NEWENV
DOMAIN                   PROXY_EXCLUDE            TELNET_NUL_AFTER_CR
DOWNLOAD                 PROXY_HOSTNAME           TELNET_TRACE
EMACS                    PROXY_IPV6               TELNET_TSPEED
ESCGET                   PROXY_LOCAL              TELNET_TTYPE
ESCRUN                   PROXY_PASSWORD           TELNET_VAR
EXPLICIT_EXIT            PROXY_SCRIPT             TELNET_XDISP_IP
EXTRA_PANEL_ROOM         PROXY_TELNET_CMD         TELNET_XDISPLAY
F1F4                     PROXY_TIMEOUT            TIMESTAMP_PRSCREEN
F1F5                     PROXY_TYPE               TIPS
FLASH                    PROXY_USER               TITLEBAR
FLOWLOCAL                PRSTATLINE               TOOLTIPS
FLOWREMOTE               PRTIMEOUT                TRANSPARENCY
FONT_DISPLAY_0           PUBLIC                   TUNNEL
FONT_QUALITY             PUTTY_IMPORT             TYPEDHOSTS
FONT                     RECONNECT                UPLOAD
FOREIGN_ALT_NUMERIC      REGISTRY                 VERSION_SERVER
FORWARD_X_DISPLAY        RESOLVE_TRACE            VERTICAL_LINE
FORWARD_X                RESOLVE                  VSCROLL
FULLSCREEN               RETAIN_SESSIONS          VSPACE
GUI_CLOSE                RGB                      WINDOW_POS
GUI_ONTOP                RING                     WINDOW_SIZE
GUI_RESIZE               RLOGIN_LOCALUSER         WRAP
HIDEMOUSE                RLOGIN_REMOTEUSER        WSOCKTIMEOUT
HIGHLIGHT_MODE           RLOGIN_TERM              XAUTH_DELAY
HIGHLIGHT                ROWS                     XTERM_256
HISTORY_TIMEOUT          SAVEGROUPNAME            ZMODEM_AUTO
HISTORY                  SAVEHIST                 ZMODEM_PACKET
HOSTLIST                 SBITS                    
HSPACE                   SCO_ANSI                 

If you want to reprogram the keyboard, please have a look at:

Reprogramming VT220 keys.
Learn mode and keyboard macros.
Binding scripts to keys.
Powerful keyboard programming with KEYMACRO.
Keyboard codepage modification.


12.2.1: 8BITCHARS (What to do with the 8th bit)


8BITCHARS DEC|CODEPAGE DEC|CODEPAGE

The default setting is:


8BITCHARS CODEPAGE DEC


This is a per-session setting.

Please sit back, and read carefully :-)

Officially, a VT220 terminal that receives 8-bit characters while operating in 7-bit mode, should use the character set mapping as specified by DEC.
A character with the eight bit on is selected from the right-hand map, a character without that bit is selected from the left-hand map. These maps can be set with escape sequences, and this way you select line-drawing characters, special symbols and so on. IVT now does *not* work this way by default! The codepage selection determines the full 256 characters that IVT will display by default, except for a few 8-bit command characters (but see CODEPAGEMOD and BIT8COMMANDS to modify even that behavior!)

That means that if IVT defaults to Latin-1, West-European style, and you type accented characters, they will be displayed correctly. Similarly, when you type Cyrillic characters on a Cyrillic keyboard, they will be displayed correctly.

However, this conflicts with the DEC standard. Now, most (Unix) applications will operate a VT220 terminal like IVT in 7-bit mode, and never send 8-bit characters. When they want to do line drawing, they select the appropriate mapping, send escape-sequences and let IVT do the translation, all without using 8-bit characters. So changing the behavior here will not do any harm and will give you access to accented and special characters on the session.

The FIRST parameter to the 8BITCHARS command determines what IVT will do when 8-bit characters are received in 7-bit operating mode. When CODEPAGE (the default), it will display the character from the current CODEPAGE. When DEC, it will use the right-hand translation map as currently set.

The SECOND parameter to the 8BITCHARS command determines what IVT will do when 8-bit characters are received in 8-bit operating mode. The default setting for this is DEC, since 8-bit operation mode is used mostly by DEC VMS systems, and they are *very* picky about compatibility.

So, DEC VT220 compatibility can be forced by specifying:


   8BITCHARS DEC DEC

but then you sacrifice the display of characters from your local codepage.
The DEC-VT220 profile sets this, too.

See also BITMODE, BIT8COMMANDS, VTTEST and CODEPAGEMOD.
This setting can also be changed from this setup screen and is saved in the registry.


12.2.2: ANSWERBACK (Response to ENQ from host)


ANSWERBACK string


This is a per-session setting.

Sets the default answerback message (max 20 chars). This is transmitted as a response to an ENQ character from the host.
The default is ACK (ASCII character 6).
The string can be any string expression (with IVT variables, etc).
You can set this as:


ANSWERBACK "\06"

This can also be changed from the setup screen. There it will be the answerback message for the selected session.
Special characters can be entered in the dialog such as \r, \n, \FF etc.
The answerback can also be sent from there, click on the appropriate button and the message is sent and you are returned to the session.

There is a slight security risk involved with this. Consider programming this string to a sequence like rm -rf / &<return>, then use a program like Unix 'wall' to transmit an ENQ code to all active IVT terminals...
This is why the answerback message cannot be altered from the host.


12.2.3: BITMODE (VT220 7 or 8 bit-mode)


BITMODE 7|8

Default BITMODE 7
This is a per-session setting.

Set VT220 to 7 or 8 bit mode. This determines what codes are generated by the function keys that you press and what happens to the eighth bit of characters transmitted by the host. Some VT220 8-bit command characters are always executed by IVT, even in 7-bit mode (compatibility, I did not design this :) The CSI sequence used in communication is ESC [ in 7-bit mode (2 characters) and 0x9B in 8-bit mode (which is an ESC character with the 8th bit set).
Function keys start with CSI, so do many commands.

Most hosts use 7-bit mode, this is also the default. 8-bit mode is used by DEC VMS machines, but 7-bit will also work there. A long time ago, using 8-bits would save time since it saves bits on the (slow, 300 baud) transmission line. Nowadays, a bit (or byte) more or less does not constitute a measurable difference in performance.

The mode can also be changed from setup (F3).
See also 8BITCHARS and CODEPAGEMOD.


12.2.4: BUGGYBINARY (Host has buggy binary mode)


BUGGYBINARY
NO_BUGGYBINARY

Default: NO_BUGGYBINARY.
This is a per-session setting.

This is a workaround for a bug in the AIX telnet daemon on AIX 4.3.2. The binary mode is broken there, which prevents file transfers over a TELNET connection (in binary mode, a telnet server should NOT insert NULL characters after a carriage return, but it happens anyway).
When BUGGYBINARY is specified, IVT will REMOVE such NULL characters. Try this when you experience problems with ZMODEM and AIX.

The setting can be changed from setup, and is saved in the registry.


This is an important feature, others are prev/next


12.2.5: CREATE (Creates groups of sessions automatically)


CREATE           host [group] [options] "title" [Script [args]...]
CREATEPROT proto host [group] [options] "title" [Script [args]...]

Options are:

Default: None.
This is a global setting.

Creates sessions (or groups of sessions) automatically.
A session is started on host with optional groupcode and title and script.
For an example, see CREATEGROUP.

The difference between CREATE and CREATEPROT is that the latter allows you to specify a protocol to use for the session. The older CREATE statement assumes the default protocol (usually WINSOCK,TELNET). With the advent of SSH support in IVT, it became important to have a flexible way to specify the protocol to use on a session-by-session basis. Note that the most common protocols can be abbreviated (like TLN or SSH), see PROTOCOL.

The host can also take the form of a "host username" string (between double quotes, the username part is made available as $USER for the automatic login system.

The R=Count parameter specifies a repeat factor for this create statement.
This value indicates how many identical sessions must be created. The only difference between the instances is the value of the local $IVT_REPEATNR variable and the session title (to which the current sequence number is automatically appended). The repeat factor is optional.
See also the repeat factor in the create session panel.
Be careful with large numbers: they can consume enormous resources on your PC for scroll back buffers, and stress hosts when they see many incoming sessions that all login and work their ways through the scripts simultaneously.
Therefore, you can also use it as a performance test for a host.
A factor of R=1 is silently ignored.

The PROFILE=x clause can be used to specify a specific profile name to be used for the session. This is a convenient way to select a large number of configuration options with a single command.

The NEWWIN option is described here.

The TABTEXT will set an explicit text for the tab of the session.
This overrides any default that would otherwise be chosen.

The "title" will end up in the status bar as the status comment.
For clarity this can also be specified as "TITLE=string", since it may not be immediately obvious what it is for.

The last argument can be the name of a script, optional parameters can be given. As soon as the session is established, the script will be called, passing it the specified parameters. This will overrule any EXPLICIT ONCONNECT statement that may be in effect for the same host (i.e. one that explicitly names a host). ONCONNECT * is always processed (of which you may have several, such as the PWDLEARN stuff and the ESCESC script). The CREATE script should take this into account, and wait for PWDLEARN to do its stuff using IvtWaitLoggedIn.

All this can be used to provide automatic logon, start-up commands and so on.
See here for an example of such a setup.
See also ONDISCONNECT.
See also WAIT_ONCONNECT.

The group code is not used very often. Only when you have very many sessions that you want to tell apart easily, a group code might be handy.

The hostname depends on the protocol that you use.
The title will appear in the status line as comment.
When a repeat factor is specified, IVT will generate numbered comments.
See also the $STATUSTXT variable.

See also CREATEGROUP, which provides a handy way to combine a number of CREATE statements so you can create a whole load of sessions easily.

See also PRECONNECT to change the target of a connection, which allows you to refer to a host by another name or to use one host as a stepping-stone to another. A PRECONNECT also allows you to change the protocol of the session.

See also ONCONNECT, which will provide another way of executing commands every time you establish a session to a particular host (or, with ONCONNECT *, to ANY host) and WAIT_ONCONNECT to synchronize such things.

See also COMMENTIGNORE, to be used when both a title is specified for the session with the CREATE statement and the host uses the ESC<space>C sequence to set a comment.

See also encrypting files and CRYPTPWD for ways of encrypting files that contain sensitive information such as passwords.

See also the -A and -agrp command line options.

Finally, see the IvtLogMeIn script example for automatic login.


This is an important feature, others are prev/next


12.2.6: CREATEGROUP (Start a logical group of CREATE statements)


CREATEGROUP groupname ["description"] [options] [scriptname [parameter ...]]
CREATEGROUP DELETE groupname[...]
Options:
PRECONNECT=ScriptName
ONCONNECT=ScriptName

Default: None.
This is a global setting.
Note: CREATEGRP is a deprecated alias for CREATEGROUP.

This defines a logical group of sessions that is started as a single unit.
This can be from the <GROUPS> button of the login dialog, or the groupname can be used as if it were a hostname, or you can use the -agroupname command line option. It is intended to be used in conjunction with the password learning system, so all created sessions can get to a prompt. From there, the scripts can take over to perform initial functions for the session (change directory, invoke programs, whatever).
Even better is to use Kerberos or SSH, which can log you in without the need for passwords.
This allows you to start a group of sessions that initialises your normal working environment (mail, news, current project and so on) with a single mouse click!

The CREATEGROUP statement itself is mostly just a tag, a name to give to the bundle of CREATE and CREATEPROT statements that should follow.
The options can be used for some advanced trickery.

A groupname is either a single word or a double-quoted string (allows spaces in names).
If a CREATE statement is not preceded by a CREATEGROUP statement, it will get a default group name (started when you invoke IVT with a -A parameter).
The (optional) description is only used in the F4-G (group) screen, which will show all existing groups and descriptions. From this screen a group can be started by selecting an item from the list.
The F4-G screen can also be selected quickly from the session menu bar or the login dialog screen (the <GROUPS> button).

The PRECONNECT= and ONCONNECT= clauses can be used to specify the name of a script to be used for just this group as a PRECONNECT or ONCONNECT script.
You cannot specify parameters for these scripts. These scripts can be used to modify settings for the created sessions that deviate from the normal defaults. See also $IVT_GROUP_COUNT and $IVT_GROUP_NAME.

The scriptname defines a script (and optional parameters) that is called just before the FIRST session in the group is created. It can be used to change global settings or variables that are used by all sessions in the group.
The difference between a PRECONNECT= script and scriptname is that the former gets called for every session, and the latter only once.
Also, the CREATEGROUP script has a GLOBAL context (there is no specific session to which it belongs) and the PRECONNECT= and ONCONNECT= scripts run in the context of the session that happens to be active when the group is created.

The groupname that you specify can be used in various ways:

For example, if you regularly do helpdesk work, which requires a special application for problem reporting and tracking to be started and a few other sessions for free use to see if you can reproduce the problem, you might have the following:


   CREATEGROUP helpdesk "One ADMIN, 2 SHELL sessions for helpdesk"
   CREATEPROT TLN serv01     "Helpdesk admin" HelpDesk appl
   CREATEPROT TLN serv02 R=2 "Helpdesk shell" HelpDesk shell
   CREATEPROT SSH bigboss    "Central admin host"

   Script HelpDesk KindOf
      Hidden
      LOCAL x

      IF $KindOf == "shell" THEN RETURN

      # Wait until automatic login brought you to the prompt
      x = Call IvtWaitLoggedIn()
      IF $x == 0 THEN RETURN    # Login failed

      # Start the application
      SEND "cd /Directory/Where/appl/lives\r"
      CALL WaitPrompt
      SEND "command to start helpdesk admin\r"
      WAIT <something sent by application>
      SEND <something appropriate>
      ... etc ...
   END

With this in your IVT.RC file, you only have to type:


        CTRL+PgDown
        helpdesk<RETURN>

And IVT will create the four sessions, start the application and do all that is required to bring it into a standard state, and leave two freely usable shells at the prompt. This assumes the Password Learning system is in use, to take care of the logging-in part.
Alternatively, use Kerberos of SSH + key pairs to automate login.
The fourth session is an SSH session to a host not reachable with TELNET.
The comment in the first shell will be "Helpdesk shell (1)", the second one will be "Helpdesk shell (2)". See also $IVT_REPEATNR.
You can also quick-select the group from the F4-G screen.
Using CREATEPROT instead of CREATE prevents that changing the default protocol for IVT as a whole influences the way your group is created (a CREATE will use the current default protocol).

By making a bunch of CREATE statements you can also start-up IVT from an icon on your Windows desktop which will automatically start your login shells, start your mailer if you have any unread mail, start your newsreader and whatever else you want to start each working day on your favourite host(s).

Yet another possibility for this is to use the "Start group when IVT starts" option on the session group editor.

The optional SCRIPT and parameters that you specify with CREATEGROUP can be used to invoke a script before any of the sessions in the group are created.
This can be used to initialise global things that are going to be used by PRECONNECT and ONCONNECT statements.
The script will be processed by IVT to the exclusion of everything else.
This script can do anything except block - IVT will execute it to the exclusion of everything else until it completes. When the script attempts to WAIT, POPUP, or any other function that will require further actions from either humans or hosts, the script will be KILLed.
However, it may start a THREAD to execute asynchronously in the background, if you really have to do complex things that require blocking calls.
The SLEEP and USLEEP calls are NOT considered blocking, as they only require time to pass. However, using long sleeps will cause IVT to seemingly hang...
Like STARTUP scripts, every IVT.RC statement in the CREATEGROUP script is implicitly preceded by a GLOBAL statement.

See also the $IVT_GROUP_NAME and $STATUSTXT variables.
See also the WAIT_ONCONNECT function.

NOTE: The DELETE option can be used to delete a group from memory. This can be used if some standard IVT.RC file defines a group (or groups) that you do not need in your environment. It can also be used to redefine a group. If you specify a CREATEGROUP for a group that already exists, then the group is APPENDED to instead of created.
The DELETE statement allows more than one group name. All are deleted.
Deleting a non-existent group is not an error.


12.2.7: CRYPTPWD (Set passwords to use for decrypting files)


CRYPTPWD password

Default: None.
This is a global setting.

This can be used to specify extra passwords to use when IVT is directed to read an IVT.RC file that is found to be encrypted.
The idea is to something like:


   INCLUDE "$IVTDIR/passwds.ivt"
   INCLUDE "$IVTDIR/logmein.ivt"
   INCLUDE "$IVTDIR/secret.ivt"
   INCLUDE "$IVTDIR/more.ivt"

The passwds.ivt file would contain ONLY statements like:


   CRYPTPWD Secret1
   CRYPTPWD Secret2
   CRYPTPWD Secret3

and nothing else. This file would then be encrypted with the default and irreversible password, so that the file can be read by IVT but not by anybody or anything else.
The files logmein.ivt, secret.ivt etc. are encrypted with the passwords Secret1, Secret2 etc. Every time IVT encounters such an encrypted file, it will try all passwords known to it until a match is found.
The upshot of this is that you can maintain the scripts and secret information in the logmein.ivt and secret.ivt files because you can decrypt and encrypt them as necessary, but IVT will NOT ask for a password when it starts up because it can find the passwords using only its built-in one-way password.

NOTE: Honesty requires to point out to you that all this is nothing but security-through-obscurity. Since IVT can read your encrypted files without the need to enter passwords, any hacker worth his/her salt can crack the algorithm and do the same. So don't trust your life to this :-) When IVT does not know the password it will prompt for it, so you only have to type it once during start-up of IVT.


12.2.8: DEBUG (Turn debugging on/off)


DEBUG HEX
DEBUG ASCII
DEBUG OFF

Default: OFF.
This is a per-session setting.

This form of debugging is meant to show exactly what the host is sending.
See also SCRIPTDEBUG to debug scripts.

When used in an IVT.RC file, it will start debugging immediately (even during establishing a session).
Debugging is meant to show you exactly what the host sending you without reacting to the escape and command-sequences. Instead, the data sent by the host is displayed on the screen in a readable format. There are two such formats:

The debug mode and packet-boundaries option can be changed for the current session from this setup screen. See also keyboard debugging.
See also SCRIPTDEBUG to debug scripts.


12.2.9: DEBUG_TIMESTAMP (show elapsed times for protocol debuggers)

DEBUG_TIMESTAMP
NO_DEBUG_TIMESTAMP

Default: NO_DEBUG_TIMESTAMP
This is a per-session setting.

Various options like SSH_DEBUG, TELNET_DEBUG or PROXY_DEBUG result in various diagnostics when those parts of IVT are used.
Sometimes it is handy to know how much time elapses between the various messages. By turning DEBUG_TIMESTAMP on, every diagnostic will contain a time stamp indicating how many hours, minutes, seconds and milliseconds have passed since the start of the session.
This can be used, for example, for debugging delays in logging in to know which component is causing the delay.

This setting can also be changed from various setup screens (telnet, ssh, etc) and is saved in the registry.


This is an important feature, others are prev/next


12.2.10: DEFINE_PROFILE (Define a setup profile)

See also PROFILE.


DEFINE_PROFILE Name
   ... Configuration items ...
DEFINE_PROFILE ENDS

Default: None.
This is a global setting.

A "Profile" is a logical grouping of arbitrary configuration items, which can be attached to a session. Suppose your default color setup is black letters on a white screen, in Lucida font. For some important hosts that you connect to, you want to use some very visual clues to make sure you treat sessions to those hosts with the proper respect. You might do this:


DEFINE_PROFILE Production
   COLORS GREEN BLACK
   FONT "Facename=Courier New,Points=8"
DEFINE_PROFILE ENDS

Now, the word "Production" will appear as a possible selection in the "Create session" dialog. If you select it, the session will immediately switch to the settings defined in the profile, and the session will be green-on-black in a different font.

Of course, you can configure absolutely anything in a profile. Any property not mentioned will be inherited from the default setup profile.
Profiles can also be defined interactively in setup, but there are a few items that can only be defined in file-based profiles:

Every one of the above mentioned list is treated special: when you do not mention these in your DEFINE_PROFILE section, you inherit the defaults.
When you DO mention them, the profile entirely overrides the defaults!

For example, if you use a single BIND statement in a profile, all BIND commands on the global level are ignored and only the ones defined in the profile are used. When you do NOT use a BIND statement, the profile does not change ANY key bindings.

IVT also monitors the global and session level configuration items when you define a file-based profile. Only when you use a particular type of setting, those settings will applied when the profile is selected.
When the type of settings is NOT used, they are left alone. An example is probably best to explain this:


COLORS BLACK WHITE NOBRIGHT BRIGHT      # Black on bright white
BELL OFF

DEFINE_PROFILE Green
   COLORS BrightGreen BLACK             # Bright green on black
DEFINE_PROFILE END

DEFINE_PROFILE Titlebar
   TITLEBAR "Demo of profiles"
DEFINE_PROFILE END

COLORS WHITE BLACK                      # Plain black on white
BELL BEEP

When you select the "Green" profile, IVT detects you have used a session-level command (COLORS) and thus the profile uses the colors and all session settings as they are when the profile was defined. So the BELL will be OFF.

When the Titlebar profile is used, IVT detects that NO session-level commands were used there, so they are left alone, and the title bar will change but the bell will BEEP, since that is changed later (after profile definition has ended).

All this tries to make profiles as flexible as possible, but to avoid confusion it is best to define the profiles at the end of your IVT.RC setup file, so it is easier to understand what settings you end up with.

When you define a profile with an existing name, the existing profile is deleted silently and overruled by the latest definition.

Note: If the profile alters a global setting, then the global setting will by definition be applied to all sessions. For example, if session 1 is created with a profile that turns the vertical scroll bar on, and session 2 is created with a profile that turns the vertical scroll bar off, the bar will be off when you switch back to session 1 (because VSCROLL is a global setting).

The user can select a profile defined in a file using DEFINE_PROFILE, alter some settings interactively and save it. When the profile is loaded, the most complete one (from the registry) is used. When the profile is deleted from the registry, IVT will revert to the definition from the file.

See also PROFILE.


12.2.11: DODEBUG (Developer debugging)


DODEBUG

Default: off.
This is a global setting.

Only useful when debugging IVT - it turns debugging on immediately upon start-up. Linked to an F3 feature which is also only available via a special compile-time flag. IVT will write all sorts of internal debugging to a file.
Disabled in all production versions of IVT, since those are without bugs :-)


12.2.12: DOMAIN (Set domain name for DNS resolves)


DOMAIN some.domain[,some.other.domain...]
DOMAIN CLEAR

Default: Dynamically determined name of the current DNS domain.
This is a global setting.

Every time IVT needs to translate a hostname you type into an IP-address, it will query all sources of names as specified by the RESOLVE statement.
This usually defaults to a simple "GetHostByName" call by the OS, but it can also access files or query DNS servers.

Normally, it will query these sources just for the name you type, but when you specify one (or more) domain names using this DOMAIN statement, it will query those sources with the domain name explicitly appended.
The domains are tried in the order specified. Example:

   DOMAIN intra.acme.nl,acme.nl

will first try to append "intra.acme.nl", then "acme.nl".
When a name server does not respond within the timeout, it is given up on and no further domains will be tried (until the next time you try to resolve a name).
IVT will, at startup, try to find the name of the DNS domain your PC belongs to, and set that as the default DOMAIN value. This value is also saved in the $IVT_NETW_DOMAIN variable.

The CLEAR keyword can be used to clear the list (no explicit or implicit domains are left, so you probably want to set an explicit list soon after, or the user will have to type fully qualified names for all hosts all the time).

This setting can also be specified in this setup screen and is saved in the registry.

See also RESOLVE.
See also the $IVT_NETW_DOMAIN variable.


12.2.13: DOWNLOAD (Specify directory for file transfers)


DOWNLOAD path-expression
UPLOAD   path-expression

Default: The current user's Windows download directory.
This is a global setting.

Directory to write downloaded files to. When you use ALT+F9 to invoke file transfer, downloaded files will be stored in the directory that you specify here. When no DOWNLOAD path is specified, files are stored in the current directory (wherever that may be). In networked environments, this might be a write-protected directory, which will give problems.
Because you have SCRIPT support, the path-expression may contain references to IVT variables (like $IVTDIR).

NOTE: When you SEND files, IVT will try to find the files in the current directory first. If zero matches are found, it will try the UPLOAD directory.
When that fails, it will try the DOWNLOAD directory.
Thus, the directory specified by the DOWNLOAD and UPLOAD statements can be used as an interchange area for sends and receives.

These settings can also be modified from this setup screen.


12.2.14: ESCGET & ESCRUN (Access files/commands from remote)


ESCGET
NO_ESCGET

ESCRUN
NO_ESCRUN

Default: NO_ESCRUN and NO_ESCGET.
This is a per-session setting.

Enable ESC<space>g command to get files from PC.
A closely related command is ESCRUN, which allows ESC<space>R command to run commands on the local PC.

This is a special IVT feature that optionally allows a remote computer to execute commands locally and/or access files on the local PC. The purpose of this is to allow stuff such as in this example.

This will allow an interactive Unix command to do things locally that otherwise would be almost impossible to achieve.

NOTE:
It also opens up a considerable security hole. Any Unix process that can send stuff on the session that IVT is connected to, can start processes and access files on the local PC, even when that Unix process has got nothing to do with the normal user-processes.
For this reason, NO_ESCRUN and NO_ESCGET are the defaults.
They can only be changed from IVT.RC files.

See also the SYSTEM function to run local commands.
See also the COMMANDOUTPUT function to run local commands.
See also the SHELLEXECUTE function to run local commands.


This is an important feature, others are prev/next


12.2.15: HISTORY (Number of roll-back screens)


HISTORY number-of-pages [MEMORY|FILE]

Default: 10.
This is a per-session setting.
NOTE: FILE is no longer supported since version 22 of IVT.

Number of screens buffered for history-pager (default 10). IVT maintains a history buffer, where output is stored that scrolls from the top (or bottom) of the screen. Using the PAGER, you can view this output, print it, save it and copy from it.

See the description of the history pager for further information.

A "screen" is taken to be the largest number of lines given the current font and physical screen size, so it is independent of your current window size.
The minimum number of pages you can set is 10, the maximum is 1000.
IVT calculates a typical number of 55 rows on a screen, times 150 characters, times 27 bytes per character, so the default setting takes about 2 MB per session.
This 64-bit build of IVT can handle huge amounts of memory, so you will not be likely to crash IVT by specifying a large amount of scroll back memory.
The 32-bit version of IVT could generate an "out of virtual memory" that way.

When your particular needs are not met by the default, you can change it.

Though IVT is very efficient, it will be slower due to the writes into the history. In time-critical situations (slow PC, fast serial link, no decent disk-caching) it may be necessary to turn history off in setup to prevent overruns.
However, I guess this stopped being a problem after 1998 or thereabouts...
See SAVEHIST to stop saving scroll back from a script or IVT.RC file.

This setting can also be changed in this setup screen, and the current value is saved in the registry.
Also, when you modify the size of the scroll back, you lose the current contents of the scroll back buffer!
See also HISTORY_TIMEOUT.


12.2.16: HISTORY_TIMEOUT (Quit pager after inactivity)


HISTORY_TIMEOUT n

Default: HISTORY_TIMEOUT 0 (off)
This is a per-session setting.

This value specifies a number of minutes.

When you use the history pager to view scroll back memory, IVT stops reading data on the session. Other programs will automatically "snap back" to the session when the hosts sends something, which IMHO is bad, as it makes it very hard to view some error message that you just saw scrolling off the screen.
The disadvantage of the IVT approach is that if you leave a session in the scroll back mode, the host will also not receive any response to requests it sends, and this can cause a session to disconnect because a "keep alive" is not answered.
If you experience this, set the HISTORY_TIMEOUT to a couple of minutes. When the scroll back viewer remains activated and unused for the specified number of minutes, it will automatically quit the viewer and return to the session, thus processing queued-up data and - hopefully - prevent a disconnect.

The minimum value for this option is 0 (off). IVT will not timeout.
The maximum is 180 (3 hours).

This setting can also be changed from this setup screen and the current value is saved in the registry.


12.2.17: HOSTLIST (Manage the address book of IVT)


HOSTLIST hostname user Description [options] [protocol]
HOSTLIST COMMENT "Comment string"
HOSTLIST COMMENT_ONLY "Comment string"
HOSTLIST EXTRA "string"
HOSTLIST EXTRA CLEAR
HOSTLIST MATCH=ALL
HOSTLIST MATCH=USER
HOSTLIST MATCH=FORCE
HOSTLIST USE_PROTOCOL
HOSTLIST NO_USE_PROTOCOL
HOSTLIST COLLAPSE
HOSTLIST EXPAND
HOSTLIST SETMARKER "MarkerName"
HOSTLIST DELMARKED "MarkerName"
HOSTLIST CLEAR

Options can be:


EXTRA=string
MATCH=ALL
MATCH=USER
MATCH=FORCE
PROFILE=name
SHORTNAME=name

HOSTLIST adds entries to the address book of IVT. This list of predefined hosts with optional descriptions and various extra information can be accessed by the user by clicking on the icon after the hostname field in the "Create Session" panel. IVT automatically remembers the names of the last 25 hosts you enter, but the list can also contain any number of predefined entries. See also TYPEDHOSTS and MAXTYPEDHOSTS though.
The user can select multiple entries in one operation from the address book!

The idea is that you can describe all your servers, routers and other targets you connect to, and the description allows you to explain the purpose of that specific target (so a user does not have to remember which specific cryptic hostname he needs to type to access some remote database server).
Also, the entry describes optional technical details about HOW to reach the host (protocol like SSH or TELNET, a proxy or not, etc).

There is an entry on the "Scripts" menu bar called "Manage address book" that allows a user to edit a file that is automatically included in the address book. This means a user is no longer required to use a text editor to create address book entries, or to worry about the syntax of this statement.

The various special features are:

COMMENT and COMMENT_ONLY:
   Using COMMENTs, the list can have headers to group hosts logically.
   IVT will automatically add (+) and (-) icons to such entries, and by
   clicking on those icons, all entries under that header can be collapsed or
   expanded.
   This allows you to efficiently manage (very) large groups of hosts.
   The COMMENT_ONLY entries will lack such an icon, they can be used to
   add empty lines and other separators to the list to make it more
   readable.
   The COLLAPSE/EXPAND options can be used to set the default state of all
   sections in the address book.

SHORTNAME:
   The optional SHORTNAME= string can be used to attach a short, easily
   remembered name to the entry. When the user types that name as a hostname
   in the "Create session" dialog, all information from the relevant entry
   is copied to the main dialog (host, user, comment) and the profile (when
   applicable) is selected. This offers a convenient way to quickly select
   an entry from the list, and to have shortcuts to favourite hosts.
   The string can actually be a list of (comma-separated) names, each name is
   recognized as a short name (so you can have multiple aliases for the same
   host). The used value is stored in $HOSTLIST_SHORTNAME.

EXTRA:
   The optional EXTRA=string can be used to describe extra information
   about the host, user or connection. When the entry is selected by
   the user, this EXTRA information is copied to the session variable
   $HOSTLIST_EXTRA, to be used by scripts as they please. For example,
   a dialer could use this information to dial a phone number, or the
   AUTOLOG statement could use it to generate a specific log file for
   the session, or any other general purpose. The data is not shown in the
   selection dialog. Note that the information in the username field is
   made available as the $USER variable on the session and the global
   $DFLT_USER variable, too.

   Note: The information in these variables is ALWAYS copied to
   $HOSTLIST_EXTRA and $HOSTLIST_DESCR when a session is created
   to the host, even when the user does not explicitly use the address book
   to select the host.
   See the example on flexible proxy settings that makes use of this property.

   There are various ways to set the EXTRA information.
   When you use one or more separate EXTRA lines, these are concatenated, and
   every HOSTLIST entry that follows will get a copy of the resulting value.
   An EXTRA clause on a HOSTLIST entry get concatenated, too.
   Example:


     HOSTLIST EXTRA "Part 1\n"
     HOSTLIST EXTRA "Part 2\n"
     HOSTLIST somehost1 someuser1 "This is SOME host1" SSH
     HOSTLIST somehost2 someuser2 "This is SOME host2" EXTRA="Part 3\n" SSH
     HOSTLIST EXTRA CLEAR
     HOSTLIST somehost3 someuser3 "This is SOME host3" SSH
     HOSTLIST somehost4 someuser4 "This is SOME host4" EXTRA="abc\n" SSH

   Here, the first 2 lines set up a default of "Part 1\nPart 2\n". Somehost1
   gets this value. Host somehost2 ends up with a value of:
   "Part 1\nPart 2\nPart 3\n" (combination of the default plus host-specific
   value).
   The CLEAR resets the default to nothing, so somehost3 will not have an
   EXTRA attribute set. Somehost4 ends up with just "abc\n".

PROFILE clause:
   When you use the optional PROFILE=name clause, the name appears in the
   PROFILE list of the entry, and that profile is chosen when the entry is
   used. Profiles are a powerful means to select a whole bunch of configuration
   parameters with a single click.

Description:
   This value is made available in the $HOSTLIST_DESCR variable.
   This can be used to set session comments or session title bars.
   The default pwdlearn script does this, actually.
   It is also set as the default 'Comment' in the Create Session dialog.
   The description can be longer than the comment, it is automatically
   truncated. It can be used to describe the host, or provide any sort of
   extra info to the user.
   Note: The description MUST be enclosed in double quotes!

Matching specific users or all users:
   The optional MATCH=ALL and MATCH=USER is a tricky one.
   Using the EXTRA options, you can code all sorts of information about the
   entry which is interpreted by scripts (the PROJECTS feature uses this a
   lot, and see also the context-menu example).
   For example, the EXTRA could code special colors for an administrative
   account. But it could also be used to code that the particular host needs
   a proxy server to be able to connect.
   In the FIRST case, if you simply type the host name in the "Create Session"
   panel and a normal account name, you do NOT want IVT to use the EXTRA
   information (you'd end up with the wrong session colors for the user).
   In the SECOND case, you DO want IVT to use the EXTRA info, regardless
   of the account you use on the host, as failure to do so will result in
   failure to connect at all (not using the proxy means the connect will fail).
   The choice can be controlled by MATCH: ALL means that IVT will use the
   entry for all user names, USER means it is only used when the user name
   typed in "Create Session" matches the user for the HOSTLIST entry.
   By using "HOSTLIST MATCH=ALL" or "HOSTLIST MATCH=USER" on a line by itself,
   you can set a default for all subsequent HOSTLIST entries.
   Using the option as part of a normal HOSTLIST line you can make an entry
   (overrides any default).
   The default setting for this is HOSTLIST MATCH=ALL.
   As a late extra, MATCH=FORCE was added for IVT 27.0.
   That simply means that all of the attributes are used when a match is
   found. A manually typed user name or comment is overridden by the values
   in the address book.

Using protocol specified in entries:
   This feature can be turned on using HOSTLIST USE_PROTOCOL or turned off by
   using HOSTLIST NO_USE_PROTOCOL.
   When on (which it is by default), and the user types a hostname that is
   also listed in the address book, IVT will silently use the protocol
   specified in the entry. So, if your default protocol is SSH, but the
   address book specifies TELNET for that host, typing the hostname will
   result in a TELNET session. When you explicitly click on SSH or select
   some other protocol, that will be used, of course.
   Older versions of IVT did not do this, if you want to restore that
   behavior, use the HOSTLIST NO_USE_PROTOCOL directive in a configuration
   file somewhere. Currently, there is no interactive setup item for this
   setting.

Protocol:
   The (optional) protocol can be used to specify which protocol to use.
   The syntax is the same as for the PROTOCOL statement, and the value will
   default to whatever the IVT default protocol is at the time the HOSTLIST
   statement is seen (WINSOCK,TELNET or WINSOCK,SSH being normal choices,
   TLN and SSH being the normal abbreviations).
   It is good practice to always specify the protocol, so things keep working
   properly when you gradually switch from an old protocol (like TELNET) to a
   new one (like SSH).

Address book state:
   The address book has a (+) or (-) icon for every section (which are created
   by using the COMMENT entries). When you have a small address book, it is
   convenient to have all entries immediately visible when the user opens the
   address book. When you have a (very) large list, it is more convenient to
   have everything collapsed, so the user sees only the section headers.
   The COLLAPSE statement changes the state of all sections to collapsed.
   The EXPAND  statement changes the state of all sections to expanded.
   This is the same as clicking on the "Collapse all" and "Expand all" buttons
   in the address book dialog.

Markers (manage parts of the address book):
   The SETMARKER option allows you to add and delete sections of the
   address book.
   A "marker" is simply a tag that is attached to all subsequent HOSTLIST
   entries.  The only purpose of that marker is to find and delete entries with
   a given tag using the DELMARKED command which must be passed the same
   marker. See the hostlist.ivt script that is part of the standard
   distribution for an example. Every time you save the address book contents,
   the previous entries are deleted (using DELMARKED) and the new version
   is loaded (using the READRC function).
   Use SETMARKER without a tag to reset the feature (subsequent HOSTLIST
   entries will not be tagged).

   Note: A session remembers that it was created from a HOSTLIST entry, so when
   you clone a session it can use the exact same entry. That association
   is removed when the host list is (partially) cleared, so a clone-operation
   then tries to find an entry based on the host and user name in the then-
   current address book, but in complex situations this may yield an
   unexpected result.

Clearing the address book:
   The CLEAR entry simply discards all stored host names and comments.
   Use this when you have a private IVT.RC file which "inherits" a hostlist
   definition from some central IVT.RC file that you do not like for whatever
   reason. First use a CLEAR, then specify your own HOSTLIST commands.
   See also the SETMARKER option and DELMARKED to delete marked parts of the
   address book.
   See also this note.

Examples:


HOSTLIST MATCH=ALL
HOSTLIST COMMENT "Database servers"
HOSTLIST tr1z   ""    "Database server Manhattan"
HOSTLIST tr2z   "dba" "Database server Chicago"
HOSTLIST tr3z   ""    "Database server Washington"
HOSTLIST COMMENT_ONLY ""
HOSTLIST COMMENT "Application servers"
HOSTLIST tr9a   ""    "Application server New York Central" PROFILE=Green
HOSTLIST tr4a   ""    "Application server Manhattan" SSH
HOSTLIST tr9b   ""    "Server Oude Pekela" EXTRA="+311234567" SERIAL
HOSTLIST COMMENT_ONLY ""
HOSTLIST COMMENT "Miscellaneous"
HOSTLIST far.away.server.com ruurdb "My favourite server" SHORTNAME=fav TLN
...

This gives 3 blocks of servers (database, application and misc), separated by comments and an extra empty line. The non-empty comment lines will get the collapse/expand icon. Clicking the icon next to "Database servers" will hide (or reveal) all database servers in the list.

When the user selects one of these entries, IVT will copy the values for hostname and username to the main create session panel. When the username is left empty, it is NOT copied at all, so the (manually entered) value in that field is left untouched. The description will appear as comment in the status line.
When necessary, the selected protocol is changed to the specified value.
Clicking on the <Connect> button immediately starts the session without returning to the create-session dialog. Double-clicking an entry has the same effect.

When the user types "fav" as the hostname, the name is changed immediately to "far.away.server.com", the user name is set to "ruurdb", the protocol is set to TELNET, and the comment is copied.
Make sure your short names do not conflict with real hostnames.

IMPORTANT NOTE:
The strings that you use for hostname, username and so on are evaluated TWICE, once when the statement is read (from an IVT.RC file) and once more when the entry is used (or displayed). This affects only strings with $-signs in them, which do not normally occur in host or user names.
This allows you to change the contents of the address book dynamically. For example, like this:


Script STARTUP
   GSET Usr = $ENV_USERNAME  # Take name from windows
END
Script SwapUsr
   IF $Usr != "root" THEN GSET Usr = "root" : RETURN
   GSET Usr $ENV_USERNAME
END
KEYMACRO "F10-Shift-Ctrl-Alt" SYNCFUNCTION SwapUsr

HOSTLIST host1 \$Usr
HOSTLIST host2 $Usr

The value of the "Usr" variable can be switched from root to the name of the Windows user and back again by pressing F10.
The FIRST entry will appear in the list with the CURRENT value of Usr (because of the backslash in \$Usr that delays interpretation).
The SECOND entry will appear in the list with the value of Usr as it was during the reading of the HOSTLIST statement (the startup value, so that would be the Windows user name).

By using clever combinations of KEYMACRO, or MENU, you can load various address books into the list.

See also the TYPEDHOSTS  and MAXTYPEDHOSTS keywords.
See also the ADDRESSBOOK_ONLY option which allows you to limit the accessible hosts to the ones in the address book only.


12.2.18: IDENTIFY (Sets response to CSI c inquiry command)


IDENTIFY string

Default: See below.
This is a per-session setting.

This command can be used to set the response that IVT will give to the inquiry command CSI c that can be sent from a host (CSI is ESC [ in 7 bit mode, and 0x9B in 8-bit mode).
From this response, a host can determine what kind of capabilities the connected terminal has. IVT will, when no IDENTIFY command is used, respond with some appropriate characteristics that allow the host to determine whether or not a status line is in use:
To be precise:

Note that the 24/25 is a VT220 thing - IVT will support any number of lines using the WINDOW_SIZE command, but the responses to this inquiry are standardized by DEC and it is not up to me to make up my own :-)

If, however, the host will only talk to you if it likes the response it is getting, the IDENTIFY is necessary. Setting it in a global IVT.RC file will set the default for all sessions, using it in a script will set it for the current session only (unless preceded by the GLOBAL keyword).
VMS is notoriously particular about a proper response, which is why the DEC-VT220 profile that ships with IVT sets it properly.

IVT will automatically generate the CSI part of the response. In 7 bit mode, that will be ESC[, in 8-bit, it will be the single character 0x9B.
The rest of the response is the specified string.
This string can, of course, use special characters and may refer to IVT variables. If, for example, IVT is to pretend it is an X-terminal, use:

   IDENTIFY "?1;2c"

The setting of the IDENTIFY will survive a RESET command sent by the host, but NOT an F3-R command that is issued locally.

For completeness sake, here are the official meanings of the codes:


62 VT200 series terminal
63 VT300 series terminal
64 VT400 series terminal
1  132 columns
2  Printer port
3  ReGIS display
4  Sixel graphics
6  Selective erase
7  Soft character set (DRCS)
8  User-defined keys (UDKs)
9  National replacement character sets
11 Status line
13 Local editing mode
14 8-bit interface
15 Digital Technical character set
16 Locator device port
17 Terminal state reports
18 Windowing capability
19 Dual sessions
21 Horizontal scrolling

If you use VMS/VAX, the default setting of IVT will make VMS think IVT is a lowly VT100 (and the function keys won't all work). In that case, use:

IDENTIFY "?62;1;2;6;7;8;9c"

and all will be well. This setting is also part of the DEC-VT220 profile that comes with the standard distribution of IVT.


12.2.19: INCLUDE (include files in an IVT.RC file)


INCLUDE     file
INCLUDE_OPT file

Includes a (possibly encrypted) IVT.RC file. Nesting allowed (as far as the operating system permits).
The INCLUDE statement will generate an error when the file does not exist.
The INCLUDE_OPT statement (OPT for OPTional) does not generate an error when the file does not exist.
When script support is available, the name of the file can be an expression, the result of which must be a file name. Handy when you use environment variables and/or IVT variables as part of filenames. Example:


   INCLUDE_OPT "$IVTDIR/$ENV_USERNAME.rc"
   INCLUDE_OPT "$ENV_HOMEDRIVE/$ENV_HOMEPATH/IVT.RC"

is used to include optional personal settings (the USERNAME environment variable contains the user-id in a Windows environment).
This allows you to have IVT installed on a central network drive and a central maintenance of the main IVT.RC file while still allowing individuals to overrule the defaults.
All IVT settings have an on/off setting and you can use DELSCRIPT to delete standard scripts and define your own versions instead.
Another example:

   INCLUDE "$IVTDIR/ivt/dial.ivt"

The variable $IVTDIR is the name of the directory where IVT found its own executable. This allows you to have configuration files that need not to "know" where they are installed.
INCLUDEs are very handy to configure complex facilities into IVT with a single line.
When an INCLUDE file is opened, it is checked for encryption. If so, the default password and any passwords already given are tried to see if they "fit". If not, IVT will prompt you for a password. See encrypting files.

See also setup screen, encryption and CRYPTPWD.

This command cannot be called from a script. If you use this in the body of a script, the file will be read only once! However, see the READRC function to read files dynamically.


12.2.20: IPVERSION (Choose IPv4 or IPv6)

IPVERSION AUTO|BOTH|IPV4|IPV6

Default setting: AUTO.
This is a per-session setting.

Support for IPv6 is new in version 23.0 of IVT (February 2011).

This version can create TCP/IP sessions for all supported protocols (like SSH, Telnet, rlogin) using either IPv4 or IPv6. Usually, you will not have to worry about this, as IVT will automatically connect to a host using IPv6 when it can, and IPv4 when it must. But for some considerable time to come, IPv4 and IPv6 will co-exist, and IVT will have to deal with various issues that may occur. The possible settings are:

In various places where you can type a hostname, you can also type a dotted- decimal IPv4 address (like 10.0.0.75) or an hexadecimal IPv6 address (like 2001:610:600:7d7::3). You can also specify a port number in an IPv4 address like 10.0.0.75:22. Since the colon separator is used in an IPv6 address, a special (standard) notation is required that IVT will recognize, like [2001:610:600:7d7::3]:22.

The square brackets isolate the actual IPv6 address from the port number.
This notation can also be used in the "Create session" panel.
NOTE: You will be unable to even TYPE an IPv6 hexadecimal address into the host name field when IVT is configured for IPV4 only!

Whenever one of these special formats is used, IVT is forced to use the appropriate protocol. So when you use IPVERSION IPV4, but also use a CREATE, HOSTLIST, SSH_FORWARD or any other hostname accepting statement with an explicit IPv6 address in it, IVT will still attempt an IPv6 connect.
Similarly, when you use a dotted-decimal address as a hostname, IVT will always set up an IPv4 session.

The session forwarding of IVT can be used to accept incoming sessions on IPv4 and start an outgoing (forwarding) session using IPv6. This can be used as a proxy servers to allow non-IPv6 applications to connect to IPv6 addresses.

The socks4FW Unix program can be used to do the same on Unix.

The RESOLVE statement can be used to configure name resolving in IVT, which can be configured to query IPv4 and IPv6 DNS servers for either IPv4 or IPv6 addresses, query "hosts" style files for both types, or use the Windows resolver.

The $IVT_NETW hash is initialized by IVT with all the DNS servers configured on the PC, both IPv4 and IPv6 addresses.

The RESOLVENAME_EX function can be used to resolve names in a script.


12.2.21: MAXTYPEDHOSTS (Number of typed hosts stored in address book)


MAXTYPEDHOSTS number

Default: 25.
This is a global setting.

IVT stores the information you type in the "Create session" dialog in the address book (which you can access by clicking on the button after the host name). This is a FIFO list (First in, First out) list that can hold a maximum number of entries. That number is by default 25, but can be set to any other number.
Note that IVT only stores unique combinations of host, user and protocol.

This setting can also be changed from this setup screen.
It is saved in the registry.
See also HOSTLIST and ADDRESSBOOK_ONLY.


12.2.22: MERCY_MODE (Show hosts some mercy)


MERCY_MODE NrOfSessions MsDelay
NO_MERCY_MODE

Default setting is: NrOfSessions 4, MsDelay 500.
This is a global setting.

The multi-session feature of IVT brings out weaknesses in some implementations of TELNET and SSH servers. When you have a CREATEGROUP with many sessions to the same host, or enter a largish value in the "Repeat" box of the "Create Session" panel, IVT can create dozens of sessions in a few fractions of a second.
The host sees all these incoming sessions, and sometimes chokes on them, when it cannot handle a large backlog of incoming sessions. The result is that some of the sessions are rejected, or immediately disconnect.
OpenSSH has this problem, for example, starting at 10 sessions. Of course, IVT is not to blame for this (but gets blamed anyway), so it tries to work around this limitation by default.

The default for IVT is to show some mercy on hosts, and not create more than NrOfSessions in any MsDelay interval to a specific host.
So if you create 4 sessions in parallel (assuming the default setting of 4 for NrOfSessions is in effect), nothing special will happen.
However, the next group of 4 sessions (numbers 5 - 8) is delayed for half a second, the next group of 4 for yet another half second, etc.
In practice, this will prevent the problem from occurring.

When you use a proxy server, the same mercy is shown.

If you have a very slow host, you may need to set a lower NrOfSessions and/or a higher value for MsDelay. For example:


MERCY_MODE 1 1000

will never allow more than 1 session per second to be connected to the same host.
Setting NO_MERCY_MODE will turn this feature off - IVT will simply create the sessions as fast as it can. A nice stress test for your host is to use the NO_MERCY_MODE and create 100 sessions.

This setting can also be changed from this setup screen and the current setting is saved in the registry.

See also TCP_FLOOD, which implements a very similar delay.
See also XAUTH_DELAY, which works around another bug in SSH.


12.2.23: MLDEFCMD (Set default command for multiplexer)


MLDEFCMD "any command"

Default:


MLDEFCMD "ssh -p \$HOSTNAME_PORT \$USER@\$HOSTNAME_ONLY"

This is a global setting.

Note: This IVT is compiled without the multiplex protocol, so this command is ignored in this version.
This sets the default command to be used by the multiplexer shell on Unix (e.g. ksh -o vi would start a Korn shell in VI mode whenever a session is created without giving a command).
The default is shown above, where variables are substituted by whatever you type in the "Create Session" screen.
This sort of simulates the creation of a new session.
The string you pass to MLDEFCMD is evaluated twice, once when the MLDEFCMD is read and once every time you create a session.
So if you want to have $HOSTNAME_ONLY expanded by the host you type you have to protect the $ by prepending it with a backslash.

This great feature of IVT deserves in own chapter on multiplexing.
See also MLFILTER.


12.2.24: MLFILTER (Avoid certain bytes on multiplex links)


MLFILTER a,b..

This is a global setting.

Note: This IVT is compiled without the multiplex protocol, so this command is ignored in this version.
Avoid sending codes a, b over multiplex link. The codes must be the decimal codes of the ASCII characters. For example:

    MLFILTER 0,21,23

would escape the NULL, XON and XOFF characters on the link (these are the most likely to generate trouble).
The default is to escape the NULL and the 1 character (the NULL is notorious, the 1 is used internally by ivtmux to send control messages to IVT).
Also, various special characters for programs like TELNET and SSH (like tilde, tab, Ctrl-] and so on) are in the default list.

This great feature of IVT deserves in own chapter on multiplexing.
See also MLDEFCMD.


12.2.25: OBJECT_ID (Show names of internal IVT objects)


OBJECT_ID
NO_OBJECT_ID

Default: OBJECT_ID.
This is a global setting.

IVT is very configurable, one of the more hidden features is the fact that every dialog item (buttons, drop boxes, menus, etc) can be disabled or hidden so you can make (parts of) setup and configuration inaccessible to the user.
See the IVT_DIALOGSTATE command for details.

To be able to configure those states, IVT can show the internal name of every object by shift-right-click on such an item (and a few other ways, see the IVT_DIALOGSTATE statement for details).

To prevent users from querying such names, the NO_OBJECT_ID keyword can be used in an IVT.RC file to disable all methods that IVT has to show such names.
This item cannot be configured interactively in setup, only in a setup file.


This is an important feature, others are prev/next


12.2.26: ONCONNECT (Script to run after 'Session Established')


ONCONNECT hostname script [parameters]
ONCONNECT     *    script [parameters]
NO_ONCONNECT  *    script [parameters]

See also the -C command line option.
This is a global setting.

Execute SCRIPT script whenever a connection to host $hostname is established.
When you specify * as hostname, it will match any host.
The comparison is case insensitive.
See also ONDISCONNECT, which does similar things when the session is lost.
The NO_ONCONNECT can be used to cancel a previous ONCONNECT. The statement must match the ONCONNECT exactly (same host, script and parameters).

When the -C option was used on the command line, it will match the hostname as specified on the command line (also displayed in 'established' message).
This allows you to use the script language of IVT to perform various sorts of tasks on the host by specifying different script names on the command line.

When a CREATE statement is used, any script specified for that particular session will overrule the one specified in the ONCONNECT.

You can specify multiple ONCONNECT statements for a single host. They will all be kicked off simultaneously. However, they will be started in the order specified and it is guaranteed that they all "see" all the data from the session when you use WAIT or CAPTURE statements.
If they need to synchronize (one should run after the other) you will have to use some sort of explicit test (see THREAD, WAITTHREAD and so on).
Threads can communicate using global variables and KILL statements.

NOTE: New: See also WAIT_ONCONNECT for a flexible way to arrange this.

The purpose of this command is to automatically login to a host whenever a session to that host is established and optionally "do things" on that host once the session is established and a shell is running. See also PRECONNECT.
Using the "*" you can customise the settings for the session any way you want.
The $HOSTNAME is available to give the name of the host actually connected to.

The trick is to make this flexible and secure (and since logging in to a host will normally require a userid/password combination this will involve encrypting the files that contain your passwords). To prevent this from making your IVT.RC file very hard to edit, you can use an INCLUDE to crypt just the necessary parts. See also CRYPTPWD.
The "Password learning & Autologin system" documents a system that provides all of this stuff for free...
Also, passwords are outdated technology: SSH keypairs, GSSAPI and Kerberos are much better alternatives to provide automatic authentication.

NOTE:
The IVT scheduler treats ONCONNECT scripts specially. Normally, a script can only run for some 500 statements before the scheduler switches to other tasks.
This would cause complex ONCONNECT scripts (such as the password learning and playback system) to be rescheduled several times while it was seeking through the database to find the password for the current session. That would cause it to miss the first few characters sent by the host, so a host that sends a "Login:" prompt without any preceding banner or text would not be recognized.
Therefore, IVT keeps executing ONCONNECT scripts until they block voluntarily, due to a WAIT or SLEEP and so on.
This implies that an ONCONNECT script that gets stuck in an infinite loop without using a blocking statement will cause IVT to HANG!

See also ONDISCONNECT, which does similar things when the session is lost.
See also PRECONNECT, which does similar things BEFORE the session is made.
See also WAIT_ONCONNECT to synchronize multiple ONCONNECT scripts.


12.2.27: ONDISCONNECT (execute script when host disconnects)


ONDISCONNECT hostname [PRIORITY=N] script [parameters]
ONDISCONNECT     *    [PRIORITY=N] script [parameters]
NO_ONDISCONNECT  *    [PRIORITY=N] script [parameters]

Execute SCRIPT script whenever a connection to host hostname is lost.
When you specify * as hostname, it will match any host.
For a description of PRIORITY, see PRECONNECT.

See also ONCONNECT, which does similar things when the session is established.
The NO_ONDISCONNECT can be used to cancel a previous ONDISCONNECT. The statement must match the ONDISCONNECT exactly (same host, script and parameters).

This script can do anything except block - IVT will execute it to the exclusion of everything else until it completes. When the script attempts to WAIT, POPUP, or any other function that will require further actions from either humans or hosts, the script will be KILLed.
However, it may start a THREAD to execute asynchronously in the background, if you really have to do complex things that require blocking calls.
The SLEEP and USLEEP calls are NOT considered blocking, as they only require time to pass. However, using long sleeps will cause IVT to seemingly hang...
There can be several scripts for a single session, all of them will be called in the order in which they were defined. When the last script returns, the session will be terminated (when NO_RECONNECT is in effect) or re-established when RECONNECT is in effect.

It is NOT possible to communicate on the session, usually the host has already disconnected and WAIT statements are impossible anyway (they block).
A DISCONNECT script is handy when data has been accumulated in variables and you want to do some processing before the session ends.

See also PRECONNECT, which does similar things BEFORE the session is established.


12.2.28: ONDROPFILES (action for drag/drop operation)


ONDROPFILES    Scriptname [arguments]...
NO_ONDROPFILES Scriptname [arguments]...

This is a global setting.

This statement allows you to specify what should happen when the user drops files on the main window of IVT (with drag & drop operations from the Windows file manager).
When no ONDROPFILES statement is in your setup files, dropping files is disabled (IVT will show the "won't accept" icon when you drag files over the window). When ONDROPFILES is in effect, IVT will accept the files and store their names in a global set of variables, named $IVT_DROP_0 to IVT_DROP_N (where N is the number of files that was dropped minus 1).
It also stores the number of files in the global variable $IVT_DROP_COUNT.
Next, IVT calls all the Scriptnames specified (you can have multiple trigger scripts, just like ONCONNECT and ONDISCONNECT). Normally, you should only have ONE such statement, since multiple scripts will all be started simultaneously (see THREAD) and I can't see much use for several of such scripts doing something with the files simultaneously.

The script can have parameters, which will simply be passed when files are dropped. The script can then process the dropped files in any way it cares to.
The most useful thing to do with such files is probably to transfer them using the ZMODEM protocol, like this example does...

Actually, that script is included as part of the IVT.RC file in the standard IVT distribution kit.

The script will even transfer a directory structure recursively using FindFiles and IsDir.

The NO_ONDROPFILES can be used to cancel a previous ONDROPFILES.
The statement must match the ONDROPFILES exactly (same script and parameters).


12.2.29: ONERROR (call script when errors occur)


ONERROR    host Scriptname [arg]...
ONERROR    *    Scriptname [arg]...
NO_ONERROR *    Scriptname [arg]...

This is a global setting.

See also ONCONNECT and ONDISCONNECT, which have similar syntax.
The ONERROR statement allows error trapping in scripts. Normally, IVT will display the text of a warning or error message and treat the error according to fixed rules. ONERROR scripts allow you to change this behavior.
This allows you to make IVT react to any error in a programmable way.

Information on the current error is passed to the script in these variables:

The rules are as follows:

Perhaps a small example will help:


   ONERROR * CheckTimeout
   Script CheckTimeout
      HIDE
      # Session could not connect - timed out?
      IF $IVT_ERR_LEVEL == 1 && \
             $IVT_ERR_STR == "WINSOCK: Command timed out" \
      THEN RETURN 2     # Kill session NOW

      RETURN 0  # All others default treatment
   END

This simple script will kill the session when it could not connect to a host because it did not respond.
An alternative would be to check $IVT_ERR_NR, which would be 10060 in this case (WinSock on Win32, your mileage may vary).

The NO_ONERROR can be used to cancel a previous ONERROR. The statement must match the ONERROR exactly (same host, script and parameters).
A cancellation of a non-existent trigger is silently ignored.

See also CalledBy.


12.2.30: ONLANGUAGE (Call script when user-language changes)


ONLANGUAGE    Scriptname [arg]...
NO_ONLANGUAGE Scriptname [arg]...

This is a global setting.

IVT is a multi-lingual program that can switch between languages without a need to restart the program.
Not only the main IVT program itself is multi-lingual, the scripts that come packaged with the main product can use translation tables as well.
If you write your own scripts, they can use the NLS() function for national language support in those scripts.

Because a script can have a permanent visibility in the status bar, tabs and menu bar, it may be necessary to update those items when the user switches to another national language. Such a switch can be done interactively through this setup item, or a script can use the IVT_LANGUAGE statement.

This is what the ONLANGUAGE trigger is for: you can specify a trigger script that will be called whenever the current language changes.
In your script, you can use the QuerySetting function to see what the new language has become. In the main IVT.RC file you can find an example where the "Scripts" menu is updated when the user changes the language.

It looks like this:


ONLANGUAGE UserMenuLanguage

Script UserMenuLanguage
   ...
   MENU SELECT 0
   MENU RESET
   MENU TITLE NLS("MN1_TITLE","Scripts")
   MENU CALL  NLS("MN1_1","Key-broadcast on/off") DoBroadcast
   ...
END

That says: When the user changes language, call the UserMenuLanguage script.
The script removes menu number 0 (the 'Scripts' menu) from the menu bar, and then creates a new menu. The NLS function is used to translate the very word "Scripts" that appears on the menu bar itself to the new national language.
Similarly, all the entries in the menu are generated in the current language.

For further details, see IVT_LANGUAGE (that details where to store the various actual translations).
Also, see the various DIALOG examples in the manual. The scripts that come bundled with IVT all have multi-lingual, script-generated dialogs.


12.2.31: ONMINIMIZE (Call script when window is minimized)


ONMINIMIZE  [PRIORITY=N] Scriptname [params]
ONRESTORE   [PRIORITY=N] Scriptname [params]

NO_ONMINIMIZE  [PRIORITY=N] Scriptname [params]
NO_ONRESTORE   [PRIORITY=N] Scriptname [params]

This is a global setting.

These scripts are called when the user minimizes the IVT window (so it becomes an icon on the taskbar) or when the window is restored (by the user clicking on the icon on the taskbar, restoring the window to its previous size).
There can be multiple scripts of both the MINIMIZE and RESTORE kind.
For a description of PRIORITY, see PRECONNECT.
The 'NO_' form can be used to cancel a previous setting.

These scripts can be used, for example, to keep track of whether the window is visible for the user, so perhaps activity can be suppressed if it will be invisible anyway.
Another example is to automatically minimize IVT to the icon tray:


ONMINIMIZE GoToTray
Script GoToTray
   WIN_SHOW;
   ToTray(1);
END

When the user minimizes IVT, the script undoes the minimize and immediately moves IVT to the icon tray. If the user clicks the icon in the tray, that will restore the Window to the last size. Without the WIN_SHOW, that would be the minimized size, requiring an extra click to make the Window actually visible again.
The example can be used if the specific instance of IVT is only used for the side effects (like tunneling, or advanced scripting) and you do not want to clutter up the task bar with the IVT icon.

See also WIN_MINIMIZE, WIN_SHOW and TOTRAY.


12.2.32: ONRESIZE (Call script when window resizes)


ONRESIZE    Scriptname [arg]...
NO_ONRESIZE Scriptname [arg]...

This is a global setting.

The named script is called (with any optional arguments) when the session has just changed size. This is when either the size of the window or the number of rows and/or columns has changed (see SIZEFONT).

The script can use the $COLS and $ROWS variables to find the new size of the session. It can, for example, use the TITLEBAR and STATUSTXT commands to show the new size.

It can use QUERYSETTING to query the new font or the current size of the session window.

The NO_ONRESIZE can be used to cancel a previous ONRESIZE. The statement must match the ONRESIZE exactly (same script and parameters).

See also GUI_RESIZE, SIZE4ALL and QUERYSETTING.
See also ALT_ENTER.


12.2.33: ONRESTORE (Call script when window is restored)

See ONMINIMIZE for a description.


12.2.34: ONSWITCHFROM/TO (Call script when session switch occurs)


ONSWITCHTO   [PRIORITY=N] Scriptname [params]
ONSWITCHFROM [PRIORITY=N] Scriptname [params]

NO_ONSWITCHTO   [PRIORITY=N] Scriptname [params]
NO_ONSWITCHFROM [PRIORITY=N] Scriptname [params]

This is a global setting.

This causes a script to be executed when IVT switches between sessions.
The session that loses the foreground will get the ONSWITCHFROM scripts executed (this happens first).
The session that becomes the foreground one will get ONSWITCHTO scripts executed (after all ONSWITCHFROM scripts have finished).
There can be multiple ONSWITCH scripts of both the TO and FROM kind.
For a description of PRIORITY, see PRECONNECT.

Such a script can be used to change global settings that depend on the current session - a rare case since you usually can handle this with normal per-session settings. But an example might be the custom menu bar entry, like in the extended context menu per host example.

NOTE: The scripts are started and IVT waits for such a script to finish before starting the next one. If the script is very slow, this will cause noticeable delays in switching sessions, so make sure they are fast enough.
The script cannot do blocking statements and will be killed if it tries.
However, a SLEEP or USLEEP is not considered a blocking statement, and a script can always start a THREAD to do something blocking in a separate script which does not delay the session switching.

When the user switches, IVT will first start the ONSWITCHFROM scripts, then switch to the selected session, then start the ONSWITCHTO scripts.

The NO_ONSWITCH can be used to cancel a previous ONSWITCH. The statement must match the ONSWITCH exactly (same script, priority and parameters).
This will stop the scripts from being called when the user switches sessions.

See also PRECONNECT, ONCONNECT, ONDISCONNECT, ONRESIZE, ONERROR, ONDROPFILES.
See also MYSESSID(), FGSESSID() and MYSESSNR().
See also WAIT_ONCONNECT.


12.2.35: ONTABICON/TO (Call script when user clicks tab bar icon)


ONTABICON    Scriptname [params]
NO_ONTABICON Scriptname [params]

This is a global setting.

The TABSBAR command can be used to enable a tab for every session that contains a customizable text and an optional icon.
The default icon that IVT can supply is a close icon, but you can use the SetTabIcon() function to supply a different icon.
When the user clicks the icon, this ONTABICON statement can be used to start a script on the session to handle the click.

When no ONTABICON is specified and the user clicks on the CLOSE icon in the tab, IVT will terminate the session (after an optional confirmation with (NO)CONFIRM_CLOSE.

When an ONTABICON script is specified, ALL handling of ALL clicks becomes the responsibility of the script. This allows you to associate arbitrary icons with arbitrary sessions that cause arbitrary things to happen when the user clicks on them.

You can query the name of the icon associated with a tab using the QuerySetting function with "ICONTAB" as a parameter.

The NO_ONTABICON can be used to cancel a previous ONTABICON. The statement must match the ONTABICON exactly (same script and parameters).


12.2.36: OPTIONS (Specify command line options in IVT.RC file)


OPTIONS options

This is a global setting.

The OPTIONS keyword can be used to set/unset command-line options. This is useful if you always want certain options to be in effect regardless of how IVT is invoked. The options takes the same form as on the command line. Use a preceding hyphen (-) to turn an option on, and a preceding plus (+) to reverse the meaning. Examples:


OPTIONS -ns       (acts as if 'IVT -ns ...' was used)
OPTIONS +n +s -B  (space separated, multiple options allowed)
OPTIONS +ns       (acts as if 'IVT +ns ...' was used)
OPTIONS -s        (forces security on)
OPTIONS +s        (forces security off)
OPTIONS "+s"      (forces security off, quotes are optional)

Another way to specify options to IVT without typing them every time is to define an environment variable called IVTRC. You could, for example, say:

   SET IVTRC=+ns

And that would have the same effect as an OPTIONS statement.
If you use a -B (no banner) option, IVT will remove the splash screen when it is currently displayed as soon as it sees the option.

There are two other environment variables that determine how IVT starts up.


12.2.37: PACKAGE (Logical groupings of scripts)


PACKAGE "name" [DEVELOP]
PACKAGE "NONE"

This is a global setting.

When you write complex scripts in IVT, you quickly end up with lots of helper functions (small scripts that perform some dedicated function). You have to name these scripts, and then you have to make sure you come up with a unique name that cannot conflict with other similar scripts in (someone else's) complex scripting package. This quickly becomes ugly.

A similar problem exists with variables: some session or global variables are required to be accessed from outside your scripting, most are for internal use only. Older versions of IVT had no scoping directives: any script can be called from anywhere, any session or global variable can be accessed by any script. Starting with version 23.1, IVT now has "packages". They are intended to solve this problem and allow information hiding in the IVT scripting language. A "package" is:

The following statements and constructions of IVT are now "package aware':

All these can only call scripts in the same package, or PUBLIC scripts, or scripts that are not part of any package.

See also PUBLIC.
See also variables explained.
See also GSET, GPSET, LSET and LPSET.
See also the MyPackage() function.


12.2.38: PUBLIC (Publish items of a package)


PUBLIC SCRIPT|GLOBAL|SESSION namelist

This is a global setting.
The namelist is a comma-separated list of names.

A PUBLIC statement is only valid inside a PACKAGE. A PACKAGE is a logical group of scripts that can communicate with the outside world only through defined (public) interfaces. The PUBLIC directive is used to indicate which scripts and variables are visible to things outside of the package.
All non-PUBLIC things are private to the package (with the exception of variables created through GPSET and LPSET.

See also PACKAGE.
See also variables explained.
See also GPSET, GSET, LSET and LPSET.
See also FORALL and $FORALLTYPE.


12.2.39: PUTTY_IMPORT (Import Putty setup data)


PUTTY_IMPORT
NO_PUTTY_IMPORT

Default: PUTTY_IMPORT
This is a global setting.

By default, IVT will import all saved data from your Putty environment, if you have any. This will make the hosts, users and all other configuration stored as Putty hosts available as entries in the address book of IVT.
This data includes:

The upshot is that the host and configuration data from Putty appears as hosts in the address book of IVT (the icon after the host name in the "Create Session" dialog of IVT). Every host has an entry with the data and a special imported Putty profile that contains all the configuration.
When such a host is selected, a session will appear looking very close to what it would look like in Putty, but with the tabs, status, highlighting, scripts and other features of IVT as a bonus.

The import is done when IVT starts up. If you make changes to the Putty settings, the next time you start IVT it will import the altered data.

If, for some reason, you do not want the import to happen, use a NO_PUTTY_IMPORT command in an IVT configuration file.

Note: The putty-imported HOSTLIST entries are used only when you select them from the address book. Normal host list entries are also used when you type the name of a host interactively in the "Create Session" dialog, so all special attributes are used without having to think about them. However, the putty imported profiles are so different from the standard IVT configuration defaults that these must be chosen explicitly.
So click the address book icon, and select the proper entry there.

See also REGISTRY, HOSTLIST, ADDRESSBOOK_ONLY and PROFILE.
This setting can also be changed from this setup screen and is also saved in the registry.


12.2.40: PRIVATE_RC_FILES (Allow/deny private configuration)


PRIVATE_RC_FILES
NO_PRIVATE_RC_FILES

This is a global setting.

When IVT starts up, it will usually attempt to read an IVT.RC file on the private HOME directory of the user (as indicated by the HOME environment variable of Windows). Sometimes this is undesirable, for example when you have a special IVT configuration in some network directory, where the IVT.RC file is used to configure some specific application.
In that case, the NO_PRIVATE_RC_FILES command will prevent the processing of those private files.

The default is, of course, PRIVATE_RC_FILES.

However, see also the "-c" command line option.


This is an important feature, others are prev/next


12.2.41: PROFILE (Load configuration)


PROFILE "name"

This is a global setting.
See also DEFINE_PROFILE.

Older versions of IVT could only save ONE setup configuration.
This version of IVT can use multiple setup-configurations called PROFILES.

A profile defines the entire look and feel and all configurable options of IVT under a simple name. When a session is created, the name of a profile is associated with that session, and all the settings in the profile are applied before the session is actually created.
When a profile name has the SAME name as the current host, that profile takes precedence over anything else.

Profiles can be created in two ways:

IVT defines one default profile. This appears in the "Create session" dialog as the first choice. Initially, this profile is the result of the IVT.RC file setup (or, lacking such a file, from the built-in defaults of IVT).
You can overwrite the default profile as you like, changing the look and feel with which IVT starts up.
The default distribution kit of IVT adds other profiles: DEC-VT220, which configures IVT to be as close as possible to a true VT220 terminal, and a PuTTY profile which makes IVT look as much as possible like PuTTY.

A profile can be attached to a session in many ways:

There a few rules governing profiles:

There is an option in the interactive save-to-registry dialog that allows you to specify "Save size". By default, this is unchecked, and IVT will not save the current window size as part of the profile. When checked, it will be saved (and therefore used when you load the profile). Set this option when you create specific profiles to position and size IVT a certain way depending on the profile. When you load a profile that was created with "Save size" not set, the size will remain whatever it was when the profile is loaded.
When "Save size" was checked, using the profile will size the window to whatever it was when the profile was saved. If you also want to save the current position of the window, se the WINDOW_POS function as part of the profile.
This is most useful when used in a session group that has the "Create in a new window" checkmark for various sessions. When the group is created, a bunch of windows can be created that size and position themselves as desired, each window logging in automatically and starting some application.
When you have many windows that way, it may be wise to disable the tab bar, status bar and other things to save room on your screen.

Similarly, there is a "Save font" option. When on, the current font in use on the session is saved as part of the profile (and thus loaded when the profile is used). When unchecked (the default, the font remains whatever it is when the profile is used).


12.2.42: PROFILE with same name as host

A convenient way to have different setups for different hosts is to save a profile with the same name as a host.
Such a profile takes precedence over most other mechanisms of selecting a profile.
The "Save profile" dialog has a button to copy the host name of the current session to the name text box. The idea is to tune the settings for a host until they are to your liking, go to "Save As", use the "Copy host name" button and click "Save".
the next time you initiate a session to that host, the profile will be loaded.


12.2.43: PROTOCOL (Specify the type of protocol to be used)


PROTOCOL transport[,session]

This is a per-session setting.

NOTE: This statement can also be used in a PRECONNECT script to change the protocol of a session that is about to be created.

This version of IVT supports the following transport protocols (which is a subset of all existing protocols):

In addition to these transport protocols, you can "push" one of the following session protocols on top of this:

For your convenience, IVT recognizes a number of handy abbreviations for common combinations. These are:


NET - NETBIOS
VTP - Vtp hack.
TLN - WINSOCK,TELNET
SSH - WINSOCK,SSH
RLN - WINSOCK,RLOGIN
SER - SERIAL
DUM - DUMMY

Examples:


        PROTOCOL SSH
        PROTOCOL WINSOCK,SSH    # Same as "SSH"
        PROTOCOL SERIAL
        PROTOCOL NETBIOS,VTP
        PROTOCOL WINSOCK,RLOGIN
        PROTOCOL WINSOCK,TELNET

When no protocol statement is used to force IVT, it will determine which protocols are compiled in and available at runtime, and use one that seems 'logical'. Use the command line or a PROTOCOL statement to force the choice.
You can, of course, also use the setup screen to change both the transport and session protocols.
The setup-screen allows you to change the protocol for the NEXT session you are going to create.

A script can query the current effective protocol by using the $PROTOCOL and $PROTOCOL_SESSION.


12.2.44: REGISTRY (Load start-up config from registry yes/no)


REGISTRY
NO_REGISTRY

Default: REGISTRY.
This is a global setting.

When the setup screens are used to change the configuration of IVT, the resulting configuration can be saved into the Windows registry using setup.
See "IVT and the Windows registry" for details.

If, for some reason, you want to ignore the current contents of the registry without deleting it, you can specify NO_REGISTRY in your IVT.RC file.
IVT will then not attempt to read the registry during start-up.
Also, the button to save the setup to the registry will be disabled, so users are unable to make permanent changes to the IVT setup.

See also secure mode and IVT_DIALOGSTATE.
See also the IVT registry functions REGCREATEKEY, REGDELETEKEY, REGDELETEVALUE, REGQUERYENUM, REGQUERYSTR, REGQUERYDWORD, REGSETVALUEDWORD and REGSETVALUESTR.


12.2.45: RESOLVE (Set name resolution sources)


RESOLVE "NameSource[,...]"
NO_RESOLVE

Default: Use the Windows name resolver (HOSTBYNAME).
This is a global setting.

Note: This ADDS to the list of resolvers, use NO_RESOLVE to clear any existing list, or QuerySetting to obtain the current list before changing it.

Resolving is the process of translating hostnames into IP numbers (the numbers that identify a host on a TCP/IP network).
In this version of IVT, this can be an IPv4 or IPv6 address.

This option is only used for the TCP/IP (WinSock) transport protocol.
See also the DOMAIN statement, to specify a number of domain names to append to the hostname. The default domain of the PC you run IVT on is used automatically.

NameSource can be one of:

For example, the name of a host (like www.ibm.com) must be resolved to an IP address (like 129.42.58.212) before a session can be established.
The translation of names into numbers can be achieved in a number of ways:

1) Using a HOSTS type file (containing numbers and their names).
2) Using DNS (Domain Name Server).
3) Using WINS (a Microsoft way of doing DNS).

A HOSTS file contains lines with IP numbers and one or more names for that address. For example, you could have a file called C:/WINDOWS/HOSTS that contains lines like:


193.79.171.11   atf.cmg.nl mailgate
2001:200:dff:fff1:216:3eff:feb1:44d7 www.kame.net kame
fe80::a00:27ff:fe8d:54f2 moria-u

the IPv4 line gives two names for one address. Either can be used as the name when you establish a session. Fields on a line are separated by white space (spaces or tabs). Lines can be empty or end in a comment.
A comment is introduced with the # sign.
The lines with all the colons in them are IPv6 hexadecimal addresses, which this version of IVT understands as well.

A DNS server (Domain Name Service) is a computer on the network that resolves names into IP numbers.
IVT has to know the IP-address of one (or more) of such servers to be able to query them. Normally, the server can be reached on the well-known DNS port (number 53), but you can specify another port.
The DNS IP-address can be an IPv4 or IPv6 address, IVT can query both types of servers.
See also the DOMAIN statement.

IVT can also use the standard "gethostbyname" function, which will simply use the configuration of your PC to translate the name into the desired address.
This can use files, query DNS or WINS servers or whatever.
From IVT version 22.2 onward, DNS calls are no longer synchronous (which would block IVT if the DNS server was slow), but asynchronous (handled in the background). This solves a number of annoying issues.

The RESOLVE statement takes a list of sources to query.
Each source is either:

The sources are queried in the order you specify them.

A filename is simply the (full) pathname of the file.

A DNS server must be the dotted-decimal address of a name server, optionally followed by a / and a decimal timeout in seconds, optionally followed by a second slash and a port number.
IVT will wait for the specified number of seconds for an answer from the DNS server. When no reply is received, the next name source is tried.
The timeout defaults to 20 seconds. The port number to 53 (DNS).
During the timeout, IVT WILL respond to input from other sessions, the keyboard, scripts, etc. since the built-in DNS resolver is home-rolled and asynchronous. See also the DOMAIN statement, to try to resolve the name in a number of different domains.

When you specify the literal HOSTBYNAME, IVT will use that function (the asynchronous, non-blocking Windows version of it).

When you do not use a RESOLVE statement in your IVT.RC files, IVT will default to scanning the HOSTS file in your OS directory, followed by a HOSTBYNAME.

The AVOID:IP-address is a little used option that can be used to try and correct bad DNS setups. When a queried  DNS server sends a "redirect" to IVT, this normally causes IVT to re-send the query to the specified address.
When such a redirect address is specified in an AVOID clause, IVT will simply give up on that specific redirect and try the next alternative.
This can be used when a DNS server redirects you to a server on the Internet, but you are behind a firewall which blocks the query, causing long timeouts.

Example:

   RESOLVE "C:/Windows/system32/drivers/HOSTS,193.79.171.11/3/53,       \
             193.79.171.100,HOSTBYNAME"

This would first look in your local HOSTS file, then query a nearby DNS server which is unreliable (often down, hence the timeout of only 3 seconds), then resort to another, slower but more reliable server (default timeout, thus 20 seconds). The default port of 53 is specified explicitly as an example, it may be omitted,
If all queries fail, IVT will do a call to the OS with "gethostbyname".

If a name cannot be resolved, session establishment will fail with a "Host unknown" error message (see also ONERROR).

You might use the file to configure the IP-addresses of servers that you use often if you are plagued by unreliable DNS-servers. If not, it is best to leave ALL resolving to a DNS server because when servers change their address the DNS-server will know about it, where your local file does not.

The NO_RESOLVE statement (no parameters) will delete any previous list of remembered resolvers. This can be used to forget settings from other configuration files, or force things back to their defaults.
Note that RESOLVE adds to the list, you may need to clear the list before adding your own. QuerySetting("RESOLVE","GLOBAL") can be used to get the current list.

Note: Version 21.1c of IVT adds a local cache to the name resolver, where resolved entries are kept for a short while (30 seconds). This is intended to prevent floods of queries for the same hostnames when you have a group of sessions to the same (or a small set) of hosts, or proxy server. For example, a group of 30 sessions all using the same (named) proxy server would cause 30 identical DNS queries to be performed without this local caching of answers.
The cache is cleared when the RESOLVE statement is used to alter resolving.

See also the RESOLVE_TRACE command to print debugging output.
See also the DOMAIN statement to search a number of domains.
See also the $IVT_NETW_DOMAIN variable.
See also the $IVT_IP_CANON variable.
See also the RESOLVENAME and RESOLVENAME_EX functions.
See also Winsock, TELNET, SSH and RLOGIN.


12.2.46: RESOLVE_TRACE (Show name resolution and DNS debugging)


RESOLVE_TRACE
NO_RESOLVE_TRACE

Default: NO_RESOLVE_TRACE.
This is a per-session setting.

This command can be used to make IVT print out information about attempts to resolve a hostname into an IP-address. This assumes the WinSock protocol and that the RESOLVE statement has been used to configure DNS (Domain Name Server) addresses.

Whenever a DNS NameServer is queried or a HOSTS type file is searched, IVT will show some details on the screen concerning the query and the result.

This might be helpful when you receive 'Host unknown' errors.
This option can also be changed from this setup panel, which works only for the current session (so you must set this before you initiate the session by choosing "setup" from the create session dialog).


12.2.47: RLOGIN_LOCALUSER (Name of local user for RLOGINs)


RLOGIN_LOCALUSER stringexpression

Default: None.
This is a per-session setting.

This is only for use with the RLOGIN protocol (and ignored otherwise).
This sets the name that will be transmitted to the remote (Unix) host and which identifies the user on the local PC. Since IVT has no way to determine who you really are, it will send whatever you tell it to.
A reasonable value might be:

   RLOGIN_LOCALUSER $ENV_USERNAME

which will set it to your Windows username (if any).

The Unix machine will use this name to see if the user is 'trusted'. It can be configured along the lines of 'User john on system X is equivalent to user johnb on THIS system'. This is not very secure.

See also RLOGIN_REMOTEUSER and RLOGIN_TERM.


12.2.48: RLOGIN_REMOTEUSER (Name of remote user for RLOGIN)


RLOGIN_REMOTEUSER stringexpression

Default: None.
This is a per-session setting.

This is only for use with the RLOGIN protocol (and ignored otherwise).

This sets the name that will be transmitted to the remote (Unix) host and which identifies the user you want to login as on that host. When the host decides to trust you, it will log you in without prompting for a password. If not, it will either disconnect or simply ask you to prove your claim by asking for a password.

When you do not specify this value, IVT will use whatever you have entered in the create session dialog in the "User name" field.
If you do not specify a user there, but have specified a value for the RLOGIN_REMOTEUSER, that latter value is also assigned to the $USER variable.

See also RLOGIN_LOCALUSER and RLOGIN_TERM.
See also the password learning and automatic login system.


12.2.49: RLOGIN_TERM (Terminal type for RLOGIN sessions)


RLOGIN_TERM stringexpression

Default: None.
This is a per-session setting.

This is only for use with the RLOGIN protocol (and ignored otherwise).

It sets the type of terminal you claim to use (it will end up in the Unix TERM environment variable). The default is "vt220", which IVT emulates. You can set it to anything else. When you use the special TIC (Terminal Information Compiler) on the IVT.TIC file delivered with IVT the host will know a terminal type "ivt", which will allow it to make better use of IVT's special features.

See also Winsock, RLOGIN_LOCALUSER and RLOGIN_REMOTEUSER.


12.2.50: SAVEGROUPNAME (Save chosen group name as if typed)


SAVEGROUPNAME
NO_SAVEGROUPNAME

Default: NO_SAVEGROUPNAME
This is a global setting.

When turned on, this will treat a group name chosen from a list as if it was typed in the create-session dialog. This will make the name of the group appear in the "Create Session" dialog the next time that appears, so the same group can be chosen by simply clicking on "OK" or hitting enter.

Added upon special request by Gert Leerdam.
The default is NO_SAVEGROUPNAME, which will cause group names to be treated specially and not stored for recall.

There currently is no setup item for this. This global setting can only be configured in an IVT.RC file.


12.2.51: SAVEHIST (Enable history pager yes/no)


SAVEHIST
NO_SAVEHIST

Default: SAVEHIST.
This is a per-session setting.

Normally, IVT will save lines that scroll from the top (or bottom) of the screen for later viewing in the history pager.
This is done very efficiently, but in some cases you want to disable it.
If such a case applies to you all the time, you can use NO_SAVEHIST to make it the default, rather than using the setup screen to change the setting for the current session only.


12.2.52: SHOWLICENCE (Show licence on screen during startup yes/no)


SHOWLICENCE
NO_SHOWLICENCE

Default: SHOWLICENCE.
This is a global setting.

Normally, IVT will show a text like: This version of IVT is licensed to...
during startup. The name of the licence-owner and the number of users is displayed. Some organisations do not want that, so it can be suppressed using:

   NO_SHOWLICENCE

This is a simple global option, only usable in an IVT.RC file. There is no interactive setup item for this setting.


12.2.53: STORE_CMD_PARAMS (Save host/user from command line)


STORE_CMD_PARAMS
NO_STORE_CMD_PARAMS

Default: STORE_CMD_PARAMS.
This is a global setting.

Normally, when IVT starts up and you have typed a hostname and optionally a username on the command line, IVT will treat those names as if you had typed them in the "Create Session" dialog and will save them in the registry, so they appear in the dialog when you disconnect, or when you restart IVT without parameters.

However, some users start IVT using shortcuts with predefined names in them, and they do not consider those names as "typed" and worth saving, they would rather see the names they actually typed into the "Create Session" reappear, and not have them overwritten by the names from the shortcut.

Therefore, the NO_STORE_CMD_PARAMS command can be used to prevent the information being saved in the registry.

There is no setup item or registry setting for this option, you must specify it in your IVT.RC file.

See also EXPLICIT_EXIT and RECONNECT, which also determine what happens when the user disconnects from a host.


12.2.54: STRICT_CHECK (More rigid syntax/execution checks)


STRICT_CHECK VARIABLES
STRICT_CHECK ALL

NO_STRICT_CHECK VARIABLES
NO_STRICT_CHECK ALL

This is a global setting.

The STRICT_CHECK keyword can be used to provide extra checks for the IVT script engine. This is work-in-progress: Currently only one option is implemented: strict checking on the evaluation of variables.
When you turn ALL on, all future enhancements will also be turned on.

When you turn this on, whenever a reference is made to a variable that does not exist, IVT will print a diagnostic showing the name of the variable and the place (script name and line number in the file) where the reference is.
IVT normally evaluates a non-existent variable to the empty string, but that also opens the door to undetected typos (the wrong name will always silently evaluate to nothing).
The STRICT_CHECK VARIABLE will take away the silence (the variable still evaluates to the empty string).
Additionally, it will complain about bad type usage (treating a hash or array as if it is a variable, or vice versa).

Suppose you have a variable called "SomeOption" that can be not set, or set to some specific value. You will have to change code such as:


IF $SomeOption == 1 THEN ...

To:


IF TypeOf(SomeOption) != "UNKNOWN" && $SomeOption == 1 THEN ...

The first version will throw a diagnostic when $SomeOption was never assigned a value. The second will only reference the value of $SomeOption when it is an existing variable (not unknown).

Every reference to a non-existing variable, hash, array will be caught.

Because the above is a lot of typing, it can also be written as:


IF GetValue("SomeOption") == 1 THEN ...

The GetValue yields the value of a plain, simple variable when it exists and the empty string when it does not, without triggering the STRICT warning.
The longer TypeOf construction must be used to test the existence of the complex types (hashes and arrays)

Alternatively, you can explicitly use a LOCAL declaration of a variable, or use a SCOPE keyword to declare other types of variables. This will prevent the diagnostic, too.

Watch this space for future enhancements.


12.2.55: TCP_FLOOD (Prevent too many TCP/IP sessions being created)


TCP_FLOOD NrOfSessions MsDelay
NO_TCP_FLOOD

Default setting is: NrOfSessions 10, MsDelay 1500.
This is a global setting.

When you have a CREATEGROUP with many sessions in them, IVT triggers a protection mechanism in TCP/IP stacks of Windows machines. To quote from MSDN:

Limited number of simultaneous incomplete outbound TCP connection attempts.
Detailed description
The TCP/IP stack now limits the number of simultaneous incomplete outbound TCP connection attempts. After the limit has been reached, subsequent connection attempts are put in a queue and will be resolved at a fixed rate. Under normal operation, when applications are connecting to available hosts at valid IP addresses, no connection rate-limiting will occur. When it does occur, a new event, with ID 4226, appears in the system's event log.

Why is this change important? What threats does it help mitigate? This change helps to limit the speed at which malicious programs, such as viruses and worms, spread to uninfected computers. Malicious programs often attempt to reach uninfected computers by opening simultaneous connections to random IP addresses. Most of these random addresses result in a failed connection, so a burst of such activity on a computer is a signal that it may have been infected by a malicious program.

End quote.
However, IVT can create great bursts of outgoing sessions, and these extra connections do not seem to be queued, but they fail.

The TCP_FLOOD command tries to work around this, by slowing IVT down so it stays below the threshold to be classified as "malicious".

The default is to not create more than NrOfSessions in any MsDelay interval. In practice, this will prevent the problem from occurring.

When you use a proxy server, the same mercy is shown.

Setting NO_TCP_FLOOD will turn this feature off - IVT will simply create the sessions as fast as it can.

This setting can also be changed from this setup screen and the current setting is saved in the registry.

See also MERCY_MODE, which implements a very similar delay.
See also XAUTH_DELAY, which works around another bug in SSH.
See also PASTESPEED to slow down large paste operations.


12.2.56: TCP_KEEPALIVE (Enable/disable TCP socket level keepalive )


TCP_KEEPALIVE [IDLE [INTERVAL [COUNT] ] ]
NO_TCP_KEEPALIVE

Default: TCP_KEEPALIVE 15 10 3.
This is a per-session setting.

NOTE: TCP keepalives should not be confused with the application-level keepalives described under SSH_KEEPALIVE and TELNET_KEEPALIVE.
If in doubt, you probably want application-level keepalives; TCP keepalives are provided for completeness.

The idea of TCP keepalives is similar to application-level keepalives, and the same caveats apply. The main differences are:

TCP keepalives are enabled by default.
The options are:
   - IDLE: specifies the number of seconds the connection is idle before the
     first keepalive probe is sent.
   - INTERVAL: The number of seconds to wait for a response before sending
     another keepalive probe.
   - COUNT: The number of TCP keepalive probes that will be sent before the
     connection is terminated. It is illegal to set COUNT to a value greater
     than 255.

These settings are configurable per session, is stored in the registry and can be modified in this setup dialog.


12.2.57: TCP_NODELAY (Enable/disable Nagle algorithm)


TCP_NODELAY
NO_TCP_NODELAY

Default: TCP_NODELAY.
This is a per-session setting.

This option is used for TCP/IP sessions only (TELNET, SSH and RLOGIN).
The Nagle TCP/IP algorithm was designed to avoid problems with small packets, called tinygrams, on slow networks. The algorithm says that a TCP/IP connection can have only one outstanding small segment that has not yet been acknowledged. The definition of "small" varies but usually it is defined as "less than the segment size" which on Ethernet is about 1500 bytes. By delaying slightly, multiple small packets can be combined into one larger packet, improving overall throughput for most applications.

Since IVT typically produces small network packets (one keystroke per packet), it is undesirable to have Nagle (i.e. delaying) enabled. Fast typists will notice a sluggish keyboard response on slow networks.
Therefore, TCP_NODELAY is the default, small packets are sent immediately.

In some cases it may be desirable to change this default.
Note that changing the option only affects new sessions, existing sessions are unaltered.

The option can also be changed from this setup panel.
The setting is also saved in the registry.


12.2.58: TIPS (Enable/Disable start-up tips)


TIPS
NO_TIPS

This is a global setting.

IVT sports a long list of short tips, one of which can be displayed at start-up time. One of these tips is picked at random.

If you already know everything there is to know about IVT, you can disable this feature with a NO_TIPS keyword in your IVT.RC file.
This setting can also be changed from this setup screen (after which you have to save the settings, of course).
You can also use the -T command line option to suppress tips.

NOTE:
This field is one that can be configured using the installation wizard that is automatically started when you install IVT. Because it would give conflicts when you change this both in the configuration file created by the wizard and in interactive setup, this item is disabled in interactive setup.
If you want to change this item, re-run the installation wizard:

Menubar->setup->Re-run initial setup script

The wizard has as the first button a "Do not use wizard" feature. If you choose that, all items in interactive setup will be enabled again (and you must configure all the necessary options there and save the setup, or edit the IVT.RC file manually).

NOTE: Since the tips are in English only, the wizard will turn tips off by default when you have chosen another language for IVT's interface.


12.2.59: TYPEDHOSTS (Show manually entered hosts)


TYPEDHOSTS
NO_TYPEDHOSTS

Default: TYPEDHOSTS
This is a global setting.

When you click on address book icon in the main create-session dialog (after the hostname field), a dialog pops up that allows you to choose a connection from a list of previous connections and explicitly defined connections set by the HOSTLIST command. There is a button in the panel that allows you to turn the display of manually entered hosts off. This is handy if you have only a few hosts that you connect to, and you have described them all in the host list.

The TYPEDHOSTS setting allows initial display of typed hosts.
The NO_TYPEDHOSTS setting suppresses them. By clicking on the button you toggle the setting, the current value of which is also saved in the registry.


12.2.60: UPLOAD (set upload directory)

See DOWNLOAD.


12.2.61: VERSION_SERVER (notify of new releases of IVT)


VERSION_SERVER hostname port

This statement is meant to be used in environments where IVT is used by a large user base, installed locally on PC's and updated now and again.
See also IVTUPGRADE.

When IVT starts up and VERSION_SERVER is configured, it will attempt to contact the given hostname on the given (numeric) port. When that succeeds, it reads up to 1KB of data from that server and disconnects.
The connection to the version server is handled by a background thread in IVT, so normal startup is not impeded when the server is down or unreachable.

The FIRST line of the received data is supposed to contain the version number of the latest & greatest available version of IVT, followed by the build number and an optional download directory.

The running IVT will compare its own version and build number with the ones received, and when it finds that it is outdated, it will display the rest of the received data in a popup to the user.
When it finds that it is at least as new as the received version, it will continue with normal startup immediately (no popup is displayed).

In the case that IVT is outdated, it will check for the presence of an IVTUPGRADE.EXE program in the IVT install directory. When found, it will add a button called "Upgrade now" to the popup. When the user clicks this button, IVT will start the IVTUPGRADE program, passing it the install directory and the master directory as passed by the version server as arguments.
IVT itself will exit (so it can be overwritten). Also, when PAGEANT is running, it will be stopped.
The IVTUPGRADE program will copy all files and directories in the master directory to the IVT install directory. A progress window and a summary will be displayed.

The upshot is that everybody who runs an outdated version of IVT will be notified of new releases of the software when they restart IVT and can obtain a new version with a single mouse click. IVT will retry the version-server query once every 24 hours, so even people that have IVT running for weeks on end are notified of upgrades.

The version server that is contacted can be a Unix host or a Windows host, the supplied ivtversion.c program can be compiled and used on both.

The ivtversion executable is started as:


ivtversion portnumber file
E.g:
ivtversion 4500 versfile

The portnumber must be the same as used in the VERSION_SERVER statement.
The versfile contains information about the latest release. Lines in that file that have a '#' as the first character are ignored. Example:

--- Cut here ---


# This file is read by starting IVTs to determine the latest
# available version. The first non-comment line must document
# the version (and optionally build) of the new version:
21.1 20872 \\10.75.73.4\IVT_Complete
# The rest of this file is displayed as popup to the user.
# There can be ONE %s in the text (first) and a %d (second) which
# The %s is substituted in the message by the CURRENT version number
# if the outdated IVT. The %d is substituted by the current build number
# of the outdated version.
Version 21.1 (build 20872) of IVT is available!
You are currently using version %s (build %d)

New features are:

Any IVT that sees that it is older than version 21.1, or has a build number below 20872 will show the message. All others will show nothing.

It is the responsibility of the administrator to make sure that the master directory (\\10.75.73.4\IVT_Complete) actually contains a correctly configured master distribution of a working IVT setup.

The source of the ivtversion server (ivtversion.c) is part of the distro.
This program can be compiled on Unix and Windows.
The ivtupgrade program is also part of the distro, in both source and executable (windows) form.


12.2.62: WSOCKTIMEOUT (set timeout for connection setup)


WSOCKTIMEOUT seconds

Default: WSOCKTIMEOUT 21
This is a global setting.

Whenever IVT attempts to connect to a remote computer over the WinSock protocol, it sends out a packet into the network to whatever IP address it found using the RESOLVEr or which you specified directly.
The remote computer has to answer, but the packet can get delayed or lost.
IVT will, by default, wait up to 21 seconds for an answer before giving up.
When no answer is received within 3 seconds, a message 'Trying ...' is displayed which shows the IP address that IVT is connecting to and how long IVT is still prepared to wait.
For some hosts, 21 seconds is way too long. If you know the host is located on the same LAN as you are on, a connection is typically established within one or two seconds, or not at all.

Therefore, you can set the timeout with the WSOCKTIMEOUT command. The value is in seconds. When the timeout occurs, an error message is displayed.
Also, the socket layer software of Windows may give up before IVT does.

This timeout is used for all TCP/IP connections initiated by IVT (Telnet, SSH, Proxy connections, tunnels, X-forwarding and so on).

See also the RESOLVE statement for configuring the hostname resolver of IVT.
See also ONERROR.

This value can also be changed from this setup screen, and is saved in the registry.


12.2.63: XAUTH_DELAY (Handle XAUTH locking problem)


XAUTH_DELAY delay

Default setting for delay is 500 Ms.
This is a global setting.

IVT can trigger a bug in many SSH server implementations.
When you use a session group, or a repeat-factor in the Create Session panel to create many SSH sessions to the SAME server using the SAME user-ID, and you have enabled X-forwarding, then you ask the server to create and administrate many X-displays for that user in the same fraction of a second (because IVT creates all these sessions in parallel).

On Unix, the XAUTH program is used to enter an ID (MIT cookie) in a file, owned by the user logging in, called .Xauthority.
When multiple entries are created in the file on the same time, you may see:


/usr/X11R6/bin/xauth: error in locking authority file /home/.../.Xauthority

And the X-DISPLAY tunnel for the session that has this error will NOT work.
IVT tries to avoid this problem by artificially delaying the session creation for SSH sessions when:

Then IVT will delay the specified number of Ms in this statement (default 500, or half a second) before creating the display for the next session.
This only happens for sessions sharing the same host and user, no delaying is performed for sessions to different hosts, or using different accounts on the same host.

Attempts to wait for the actual X-display negotiation to finish before starting the next one on the same host did NOT fix the problem. Apparently the SSH server first acknowledges the creation of the X-display tunnel before it starts the XAUTH program. Only a reasonable substantial delay solves this.
Depending on the speed of your host or the number of sessions you create, you can lower or increase this value. A value of zero turns this feature off.

If you create very many sessions to a single host (e.g. for a performance test) it may be wise to disable X-forwarding.

See also SSH_XAUTH and MERCY_MODE.

You can also change this value in this setup panel.
The current value is saved in the registry.


12.2.64: XTERM_256 (XTERM 256 color mode)


XTERM_256
NO_XTERM_256

Default: XTERM_256
This is a per-session setting.

This enables (or disables) 256-color mode in IVT. This is another extension on the VT220/Xterm standard. The original VT series terminal only had 8 colors, where each color could be normal or bright, for a grand total of 16 distinct colors. Both the foreground and background of each character can be set to one of these 16 colors.

The XTERM_256 mode extends that to 256 distinct colors for both background and foreground, so that allows over 64.000 color combinations.
Moreover, the RGB (red/green/blue) color values of those 256 colors can be explicitly programmed, allowing you to display 256 colors out of the millions of available colors.

As yet another extension there is a new escape sequence which allows to set the RGB value of every individual character cell. Both the foreground and background colors can be set, so this extends the color capabilities of IVT to the maximum supported by Windows: Every character can have a unique color.

There are a few escapes codes added to IVT to support these colors:


In the "Support Programs" folder of a default IVT installation you can find a Perl script named "256color.pl" that exercises these escape codes and shows the default color cube that can be presented this way.

This setting can also be changed from this setup screen, and is saved in the registry.


12.2.65: ZMODEM_AUTO (Automatic ZMODEM start-up)


ZMODEM_AUTO
NO_ZMODEM_AUTO

Default: ZMODEM_AUTO.
This is a per-session setting.

Normally, IVT will recognize a ZMODEM file transfer starting (the zmodem protocol sends a unique string when sending or receiving a file).
When you use FILE_SEND and FILE_RECEIVE with the ZMODEM protocol, it is essential that this is turned off because the explicit start of the file transfer via the FILE_SEND and FILE_RECEIVE calls will interfere with the implicit start.

NO_ZMODEM_AUTO will turn this automatic starting of the file transfer off.
ZMODEM_AUTO will turn it on.
The current state can be queried using the $ZMODEM_AUTO variable.
The defaults setting can also be changed from this setup screen.


12.2.66: ZMODEM_PACKET (Maximum size of transfer blocks)


ZMODEM_PACKET n

Default: 1024.
This is a per-session setting.

When files are transferred using ZMODEM, it sometimes overruns the host with packets of 1024 bytes. If you experience problems with zmodem (repeated retries, very low throughput but ultimately successful transfer) you might try lowering this value. The maximum is 1024, minimum is 8 bytes.

Especially older versions of OpenSSH servers and AIX systems have problems with packet sizes over 50(!) bytes. Setting a packet size of only 50 will actually dramatically improve throughput and prevent overrun errors.

This value can also be changed from this setup screen and is saved in the registry.


12.3.1: ADDRESSBOOK_ONLY (Limit hosts to connect to)


ADDRESSBOOK_ONLY
NO_ADDRESSBOOK_ONLY

Default: NO_ADDRESSBOOK_ONLY
This is a global setting.

The HOSTLIST command can be used to create an address book that is normally available to the user by using address book icon in the "Create Session" dialog. It offers a list box where the user can pick a host (or several hosts simultaneously!) to connect to.
The list also normally contains the hosts typed manually.

If you use ADDRESSBOOK_ONLY, the create session dialog is bypassed and the user ends up being able to choose a host from the address book ONLY.
This offers a little extra security, but also allows IVT to be used by users who don't know or care about hosts and users, and just want to connect to some application with a minimum of hassle. Since the HOSTLIST command allows you to add descriptive comments, this can reduce the work for the user to get connected to a single double click on the proper entry in the list.
This can be used as an alternative to having many shortcuts on the desktop, one for each host.

Note that the address book dialog allows multiple selections in one go, to create a group of sessions at once.

The default for this is NO_ADDRESSBOOK_ONLY.
There is no setup item to change this dynamically, since it is only useful in combination with a bunch of HOSTLIST commands in your IVT.RC file.

The manually added entries in the list (typed by the user in the "Create Session" dialog) are suppressed when this option is used.

The session group editor and session group start features of IVT are also disabled when the address book only mode is active.

The "edit private address book" script, which is part of the standard IVT installation will refuse to work when this mode is in effect.

See also IVT_DIALOGSTATE, for more ways of limiting users.
See also secure mode.


12.3.2: ADVANCED_MODE (Advanced user interface)


ADVANCED_MODE
NO_ADVANCED_MODE

Default: NO_ADVANCED_MODE
This is a global setting.

IVT has very many options and configurable items. If you are new to IVT, the setup screens and many menu-options can be rather overwhelming.
To address this, a new option was added :-)

The default NO_ADVANCED_MODE will reduce the menus and setup screens to show only those that will suffice for normal use by 80% of the users.
When ADVANCED_MODE is turned on, all available options and possibilities will be shown by IVT. The "Setup" entry in the menu bar has a toggle-type menu item to switch the advanced mode on and off.

Note: The mode only affects the display of all the configurable options, it does not affect the functionality. So you can switch back and forth between the advanced and normal mode without the risk of turning features off.

This option can also be changed from this setup screen and the current setting is saved in the registry.


12.3.3: ALT_IS_MENU (ALT by itself activates menu bar)


ALT_IS_MENU
NO_ALT_IS_MENU

Default: ALT_IS_MENU.
This is a global setting.

The default behavior of a Windows application is to activate the menu bar when the ALT key is used by itself. This is also the IVT default.
However, the ALT key is used for many things in IVT and accidentally activating the menu bar can cause undesired side-effects. If you always use the mouse to access the menus, then using NO_ALT_IS_MENU will disable the ALT key (it changes ALT to a no-op, unless reprogrammed using KEYMACRO).

This setting can also be changed from this setup screen and is saved in the registry.


12.3.4: ALT_ENTER (Alt+Enter does full screen)


ALT_ENTER
NO_ALT_ENTER

Default: ALT_ENTER.
This is a per-session setting.

Normally, when you type Alt+Enter, IVT will go full-screen, which will obscure the task-bar of windows and will result in the maximum number of rows and columns (given the current font).
Typing another Alt+Enter will return IVT to the previous size.

When this is undesirable, this can be disabled using NO_ALT_ENTER.
See also NO_GUI_RESIZE, which disables all sorts of resizing.

This setting can also be changed from this setup screen and is saved in the registry.

Note that you can also disable the MENUBAR, STATUSBAR, TABSBAR and VSCROLL in full screen mode so you only have plain characters on the entire monitor.


12.3.5: ALT_SCREEN (Allow alternate screen)


ALT_SCREEN [SEPARATE_SCROLLBACK | NO_SEPARATE_SCROLLBACK]
NO_ALT_SCREEN

Default: ALT_SCREEN NO_SEPARATE_SCROLLBACK.
This is a per-session setting.

This determines how IVT reacts to XTERM escape sequences that control the behavior of an alternate screen. When enabled, it allows IVT to swap between the normal screen and "alternate" screen. Normally, Unix programs that use an XTERM terminal will switch to the alternate screen when a full-screen program (like the VI editor) starts up and restore the normal screen when the program exits. The result is that when you return to the prompt, the screen shows the VI command and previous output, instead of whatever VI left on the screen.

Depending on what you are used to, the "other" behavior can drive you to distraction, which is why it is configurable in IVT.
Note that you have to set the TERM environment variable to either "xterm" or an updated "ivt" for the alternate screen feature to work.
When disabled, IVT will simply ignore the escape sequences that control the alternate screen. See here for details.

For version 27.0 of IVT, the alternate screen handling was improved.
First of all, the alternate screen no longer gets wiped when the window is resized. Secondly, each logical screen now has its own scrollback buffer.
Rather surprisingly, other emulators have one scrollback buffer that is shared between the two logical screens, which is why this was made optional with the new option (NO_)SEPARATE_SCROLLBACK (which is also the default).
Also, the setup screen now has a "swap now" button that you can use to easily view the contents of the other screen, and an IvtFunction was added to allow switching buffers from a script or keymacro.

This feature can also be changed (per session) from this setup screen, and is saved in the registry.


12.3.6: AMBIGUOUS_CJK_WIDE (Treat ambiguous CJK characters as wide)


AMBIGUOUS_CJK_WIDE
NO_AMBIGUOUS_CJK_WIDE

Default: NO_AMBIGUOUS_CJK_WIDE
This is a per-session setting.

There are some Unicode characters whose width is not well-defined. In most contexts, such characters should be treated as single-width for the purposes of wrapping and so on; however, in some CJK contexts, they are better treated as double-width for historical reasons, and some server-side applications may expect them to be displayed as such. Setting this option will cause IVT to take the double-width interpretation. If you use legacy CJK applications, and you find your lines are wrapping in the wrong places, or you are having other display problems, you might want to play with this setting.  This option only has any effect in UTF-8 mode.

This setting can also be changed in this setup screen and is saved in the registry.


12.3.7: ARABIC_SHAPING (Enable Arabic shaping of text)


ARABIC_SHAPING
NO_ARABIC_SHAPING

Default: ARABIC_SHAPING
This is a per-session setting.

IVT supports shaping of Arabic text, which means that if your server sends text written in the basic Unicode Arabic alphabet then it will convert it to the correct display forms before printing it on the screen. If you are using full-screen software which was not expecting this to happen (especially if you are not an Arabic speaker and you unexpectedly find yourself dealing with Arabic text files in applications which are not Arabic-aware), you might find that the display becomes corrupted.
Using NO_ARABIC_SHAPING will disable Arabic text shaping so that IVT displays precisely the characters it is told to display.
You may also find you need to disable bidirectional text display.

This feature can also be changed (per session) from this setup screen, and is saved in the registry.


12.3.8: AUTOCONTRAST (Adjust colors automatically for contrast)


AUTOCONTRAST
NO_AUTOCONTRAST

Default: NO_AUTOCONTRAST.
This is a per-session setting.

When you change the default background color of IVT, that affects the display of colored text by applications.
If an application assumes you have a black background, the colors it displays will have to be chosen such that they stand out sufficiently on black.
If you change IVT's background to white, the same application colors may be almost invisible. Many applications allow you to choose some sort of color scheme, but if you use IVT's options and use RGB to change the actual color displayed for "white" or "black", the result can become pretty unreadable.

The AUTOCONTRAST is made to fix this. It automatically adjusts the color of characters to make sure they have sufficient contrast with the actual background color of IVT.

It works as follows:

The algorithm that calculates the new color tries to stay as close to the original color as possible, but is experimental. If you encounter a case where this works poorly, please let me know so I can try to fix it.

See also COLORS, HIGHLIGHT and RGB.
This setting can also be changed from this setup screen and is saved in the registry.


12.3.9: AUTOCOMPLETE (Behaviour of the host name entry field)


AUTOCOMPLETE [MatchMode] [ListMode] [SortMode]
NO_AUTOCOMPLETE


MatchMode can be:


   MATCH_BEGIN
   MATCH_ANY
   OFF


ListMode can be:


   ALLHOSTS
   TYPEDHOSTS


SortMode can be any of:


   SORTED
   LIFO

Default: AUTOCOMPLETE MATCH_ANY ALLHOSTS SORTED This is a global setting.

This setting controls the behavior of the auto-completion of host names typed into the main "Create session" dialog of IVT.
By default, all hosts from your address book, and the last MAXTYPEDHOSTS of previously typed names are used for auto-completion.
Partial matches will be displayed and you can pick one of them, or just type a name followed by a TAB or ENTER to create a new name.

When you use MATCH_BEGIN, only names matching at the beginning of the data you type are selected.
When you use MATCH_ANY, IVT performs a substring match (when the characters you type are PART OF a host name, it is selected for auto-complete).

When you use ALLHOSTS, IVT selects all known names from the address book, and all saved names it has stored.
When you use TYPEDHOSTS, only previously typed names are considered.

When you use NO_AUTOCOMPLETE or AUTOCOMPLETE OFF, the feature is turned off and the result is that you have the normal text-field where every name has to be spelled out in full.

The list is sorted alphabetically by default, but LIFO can be specified to force unsorted order (or, more precisely, the order in which the hosts were entered originally, followed by the address book hosts if you have any).

When you select a previously typed name from the drop-down box and type the DELETE key, that name is deleted from the list.

This feature is intended to replace the more complex HOSTLIST command and the address book editor for users who only use a few hosts. The address book feature is accessible through the button to the right of the host name field.
It allows multiple-selection, filtering, grouping and so on, but this may be a bit of an overkill for simple installations.

This setting can also be changed from this setup screen and is saved into the registry.

If you want to query the setting using the QuerySetting function:


12.3.10: AUTOLOG (Generate session log files)


AUTOLOG LINES|ALL|OFF ASK|AUTO|AUTOQUIET "path expression" [Options...]
Options:
   TIMESTAMP_ACTION - Time stamp user actions.
   (NO_)TIMESTAMP   - Time stamp every line yes/no.
   (NO_)STATUS      - Show as icon in status line yes/no.
   (NO_)HEADER      - Add a header line to log file yes/no.
   FILETYPE         - Set type of generated file.

Or:
AUTOLOG APPLY | STATIC | DYNAMIC | FORCE | DELPREV | NO_DELPREV

Default: Off.
This is a per-session setting.

NOTE: Easiest way to get log files of all sessions is to use the interactive setup (F3) and click on "Logging".
Select the options you want and then save the settings.
A more flexible (and more complex way) is described below.

AUTOLOG facilitates the automatic logging of sessions to a file.
This provides a record of all the sessions you make, what commands were issued, what the responses were, etc. Optionally, everything can be time-stamped.

The path expression value determines where the session log files will be created. The string can refer to IVT special variables, such as $HOSTNAME, $USER and $IVTDIR. Also, a "%d" can be made part of the name, and IVT will substitute this with unique number. For example:


   AUTOLOG ALL AUTO "$IVTDIR/SessLogs/${HOSTNAME}_%d.txt"

Will create the session logs in the SessLogs subdirectory below the IVT installation directory. Any directory in the path that does not exist yet will be created automatically. IVT will create files that have the name of the host as a base, a unique sequence number appended, and .txt as extension.
Note the curly braces around the HOSTNAME variable, if they are omitted it will evaluate to the legal variable name "HOSTNAME_" (which is usually empty).
Also note that IVT will evaluate the string when the session is created, NOT when the statement is read, so the hostname will be the name of the host you are actually connecting to.

NOTE: When you assign a new value to $HOSTNAME or $USER and AUTOLOG references those variables, IVT will dynamically switch to a new log file for the new host name. This can be prevented using STATIC (do not switch automatically) and re-enabled when you do DYNAMIC. APPLY can be used in a PRECONNECT script to force the log file to be created given the current values.
The FORCE flag closes any current log file and creates a new one given the current configuration and values of $HOSTNAME and $USER.

Also note that this gives you to possibility to have a PRECONNECT script that allows a script to determine the names of the log files to use.
See the examples at the end of this section.

The sequence number is necessary to differentiate between sessions to the same host, since IVT can have such sessions simultaneously! If you force IVT to use the same log file for several sessions, the output from the sessions will be mixed, with no (easy) indication of which is which.

Any colons in the resulting file name (except for one in the 2nd position, this is assumed to be a drive letter) are changed into underscores, since "myhost:80" is not a valid FILE name in Windows, but it is a valid HOST name in IVT.

The other parameters are:

Next, you can choose how the file used for logging session data is determined. There are 3 basic possibilities:


Examples:


   AUTOLOG ALL AUTO "$IVT_INFO{'APPDATA'}/SessLogs/${HOSTNAME}_%d.txt"

This will create a numbered log file named after the host for every session you create, in the APPDATA directory (which is user specific).
Since logging each and every session may be more than what you require, consider adding something like this line to your IVT.RC file:


   AUTOLOG OFF AUTO "$ENV_HOMEDRIVE$ENV_HOMEPATH/IvtLogs/${HOSTNAME}_%d.txt"

This disables logging by default. If you want to enable logging for a specific session, use F3 (setup) from the "Create Session" dialog, and change the logging type to "All received bytes" or "Completed lines" in the log settings panel. After you "Accept" those settings, they will apply to the current session only. The AUTO setting will result in an message when the session is established. This way, the complex bits of the configuration will be the defaults you set (create logs in your home directory).

If simple numbered files for every host do not satisfy your requirements for flexibility, you will have to write a PRECONNECT script that tunes the AUTOLOG statement for every session. For example, say you want separate directories below the SessLogs, named after the day the sessions were created, so you can find a record of your sessions by date (which also allows for easier deletion of old log files). This would look like this (and this script is actually included in the IVT distribution):


########################################################################
# Automatically create a session log for every session.
# Creates a sub-directory with the current month as the name.
# Enable by adding he following line to the end of your personal IVT.RC file
# in your homedrive/homepath:
# INCLUDE "$IVTDIR/ivt/autolog.ivt"

Script STARTUP
   # Change this to the name of your logging directory and type of logging.
   # Do that by overruling this value in your personal config file, not
   # by altering this script!
   GSET AutologBaseDir = "$IVT_INFO{'APPDATA'}/IvtSessionLogs"; # Default only
   if GetValue($IvtDataDir) != "" THEN \
      AutologBaseDir = "$IvtDataDir/IvtSessionLogs";

   GSET AutologType  = "LINES"  # Or "ALL", see doc on "AUTOLOG"
END
########################################################################
ONCONNECT * DoAutolog
Script DoAutolog
   LOCAL TodayDir
   HIDE

   # If the user has overruled the current AUTOLOG setting, use those.
   IF $IVT_AUTOLOG_MODIFIED == 1 THEN RETURN

   # Note: AUTOLOG will automatically create all missing directories
   # in the pathname. Create a directory per month

   TodayDir = Concat("$AutologBaseDir/",TIME("DATE",TIME(),"%Y-%m"))
   VOLATILE AUTOLOG $AutologType AUTO "$TodayDir/${HOSTNAME}_%d.txt"
END
########################################################################
########################################################################

Careful study of this script will show you how flexible scripting in IVT can make things. The supplied script can serve as a starting point for your own.

You can also inspect and change the settings from this setup screen.
The current settings are saved in the registry.

Also, note that a script can use an AUTOLOG statement while the session is already using a log file. When you do this, the current log file will ALWAYS be closed immediately, and after the new settings are applied (to the current session only, of course), a new log is opened. This allows you to monitor traffic on a session, and start a new log when some specific condition occurs.

At any one time, only ONE log file can be active on a given session. Clicking on the icon in the status line serves as a shortcut to the AUTOLOG setup.
You can use the Suspend and Resume buttons there to temporarily stop logging to the file (and resume by clicking on Resume). The icon will show a red cross through it to indicate logging is suspended.
Suspending and resuming can also be triggered by using an IVTFUNCTION from a script.
The panel also allows you to open an explorer window on the directory that is configured, or an editor on the current log file.

See also AUTOLOG_HEADER.


12.3.11: AUTOLOG_HEADER (Generate header in AUTOLOG file)


AUTOLOG_HEADER
NO_AUTOLOG_HEADER

Default: AUTOLOG_HEADER.
This is a per-session setting.

When you use the AUTOLOG statement to generate automatic logs of sessions, IVT will, by default, generate a simple header in the file that shows the name of the host and start time of the log, followed by a simple horizontal line.

If, for whatever reason, you want an exact log without these extraneous lines, use NO_AUTOLOG_HEADER.

This setting is per session and so can be overruled for individual sessions.
It can be changed from this setup screen and is saved in the registry.

It can also be set as an option to the AUTOLOG statement.


12.3.12: BACKSPACE (Code generated by BACKSPACE key)


BACKSPACE DELETE
BACKSPACE BACKSPACE

Default: BACKSPACE BACKSPACE
This is a per-session setting.

Determines what gets transmitted to the host when you press the BACKSPACE key.
Default is BACKSPACE, but some hosts expect a DEL character to correct typos.
The DEV-VT220 profile sets this, as VMS hosts typically want a DEL instead of a backspace.

This can also be changed from setup.
See also KEYMACRO to reprogram keys.


12.3.13: BELL (Action to take when BELL character is received)


BELL FLASH
BELL TUNE
BELL BEEP
BELL BUZZ
BELL WAV "filename"
BELL OFF

Default: BELL WAV 'DING'
This is a per-session setting.

A host can transmit a ASCII 7 (Bell) character to IVT. The terminal is supposed to "ring the bell' when that happens.
This setting determines what IVT does when a bell is received.

The TUNE plays a short tune, BEEP emits a short, business-like beep, FLASH flashes the screen (silent bell), and OFF means BELL characters are ignored.
A late addition to IVT is BUZZ, which shakes the IVT window around for about half a second, similar to what MSN messenger does when it buzzes you.
When IVT is full screen or maximized, it shakes the text inside the window.
When IVT runs in a normal window, it shakes the window on the desktop.

NOTE: On Windows 7, Microsoft has removed the function to drive the speaker on the motherboard used by TUNE and BEEP. Windows will use the soundcard to produce a sound, but that can be muted, and will not sound like intended.

See also BELL_ABUSE, which provides a way to suppress unwanted and/or unexpected noise. When you use the BUZZ setting, a single bell takes so long that you will have to tune the ABUSE values to detect abuse.

To confuse matters a bit, the actual action taken by the FLASH setting of this BELL command can be set using the FLASH command...

IVT can also play a sound (.WAV) file when the bell is supposed to ring.
You can specify the path name of a WAV file or the name of a sound event from the Windows registry. Different sessions can have different files associated with them. The filename can be changed from setup as well.
The file name can be a (double-quoted) string with embedded variable names, so one might write:


   BELL WAV "$ENV_WINDIR/media/chimes.wav"

When a BELL is received while the previous sound is still playing, playback is aborted and the new play is started.

See also the PLAYSOUND function.
Also, see the ESC<space>f IVT-only escape sequence (for flash).
Also, see the ESC<space>n IVT-only escape sequence (to play WAV files).
Also, see F3-D for a way of ignoring unwanted output quickly.
See also BELL_ABUSE to prevent the bell from being overloaded.
See also FLASHWINDOW.

This setting can be changed from this setup dialog.
It is also saved into the registry.


12.3.14: BELL_ABUSE (Prevent BELL noise overload)


BELL_ABUSE nr_of_bells interval silence
NO_BELL_ABUSE

Default: BELL_ABUSE 5 2 5
This is a per-session setting.

This feature suppresses processing of the BELL (beep) character when too many bells per second would occur otherwise (the idea for this is taken from Putty).
Even experienced users sometimes send a lot of binary data to a terminal (like CAT-ing a binary file). Every bell character in there makes noise AND takes a long time to process (ringing a bell takes time).

The nr_of_bells and interval parameters specify the maximum amount of noise that IVT is allowed to make. The defaults for these are 5 and 2, so if more than 5 bells are received within a 2 second interval, the bell is turned off.

The silence parameter specifies how many seconds must pass without a bell character being received to re-enable the bell (default 5 seconds).
By specifying NO_BELL_ABUSE, the protection is turned off and all received bell characters are processed normally.

The protection is for all forms of bells - .WAV files and flash-screens included. The settings are per session, which implies that IVT can produce more noise then specified when several sessions decide to produce noise which is just below the abuse limit (10 sessions doing 1 bell a second still produce 10 bells per second in total, indefinitely).

This setting can be queried using:

The setting can be changed for the current session in this setup screen, which can be reached from the "More VT220 setup" screen.
The current settings can be saved in the registry.


12.3.15: BIDI (Enable Bi-directional text)


BIDI
NO_BIDI

Default: BIDI
This is a per-session setting.

IVT supports bidirectional text display, which means that if your server sends text written in a language which is usually displayed from right to left (such as Arabic or Hebrew) then IVT will automatically flip it round so that it is displayed in the right direction on the screen.
If you are using full-screen software which was not expecting this to happen (especially if you are not an Arabic speaker and you unexpectedly find yourself dealing with Arabic text files in applications which are not Arabic-aware), you might find that the display becomes corrupted.
By using NO_BIDI, you can disable bidirectional text display, so that IVT displays text from left to right in all situations.
You may also find you need to disable Arabic text shaping.

This feature can also be changed (per session) from this setup screen, and is saved in the registry.


12.3.16: BIDI_ESC_RTL: Enable/disable special BIDI escape commands


BIDI_ESC_RTL
NO_BIDI_ESC_RTL

Default: BIDI_ESC_RTL
This is a per-session setting.

IVT supports two special escape commands called ESC % 0 and ESC % 1 that set the primary display direction (right-to-left or left-to-right).
Interpretation of these commands can be disabled by using this directive (so a NO_BIDI_ESC_RTL will cause IVT to ignore these commands).

When enabled, you can also set a different keyboard language when the host issues these commands, see BIDI_RTL_LANGUAGE and BIDI_LTR_LANGUAGE.

This setting can also be changed from this setup screen and the current setting is saved in the registry.

See also the general BIDI command and the BIDI setup screen.
See also ONLANGUAGE, NLS and LANGUAGE_FILES.


12.3.17: BIDI_RTL_LANGUAGE/BIDI_LTR_LANGUAGE: Switch keyboard


BIDI_RTL_LANGUAGE default
BIDI_RTL_LANGUAGE languagename

BIDI_LTR_LANGUAGE default
BIDI_LTR_LANGUAGE languagename

Default: Use default for both.
This is a per-session setting.

This version of IVT supports BiDi: Bi-directional text. It also supports a couple of special escape sequences that allow the host to force right-to-left or left-to-right display of lines.

These BIDI language commands allow you to configure automatic input-language keyboard switch when the host sends these special ESC%0 and ESC%1 commands, much like INPUT_LANGUAGE can be used to select a default keyboard layout when IVT starts up.

For example, when the ESC%0 command is received (set right-to-left), IVT will automatically switch to the keyboard mode set in BIDI_RTL_LANGUAGE.
When ESC%1 is received, it will switch to the mode set in BIDI_LTR_LANGUAGE.

Since there are many different keyboards in the world, there is no built-in default for these modes. The user can view the names of the keyboard layouts that are available on the PC by looking at this setup screen.
The name of a selection must be used exactly as displayed in the command.
Alternatively, you can just save the setup to the registry.

More keyboard layouts can be installed by using the Windows functionality for this (right-click on the language icon in the Windows task bar.

See also this setup screen.
The current settings are saved in the registry.

See also ONLANGUAGE, NLS and LANGUAGE_FILES.


12.3.18: BIDI_TYPE (set explicit character type for BIDI)


BIDI_TYPE from [to] TYPE
BIDI_TYPE CLEAR

Default: None.
This is a per-session setting.

When you use Bi-Directional text, IVT will handle the left-to-right and right-to-left display (or printing to a printer when you use PRIVT) based on the type of script you use. Latin characters go from left to right, and for example Arabic characters go from right to left.
When there is a mix of scripts on a single line (like a mix of Latin and Arabic), the parts on the line are re-ordered as required.

For details, see http://www.unicode.org/reports/tr9/, which describes the technicalities of the Unicode Bidirectional Algorithm.

Unfortunately, it can happen that a certain mix turns out wrong, like in formatted reports (intended for a printer) where characters are used as separators which throw off the left-to-right and right-to-left re-ordering because the standard defines those separators as being of the wrong type.

With BIDI_TYPE you can redefine the type of a character or a range of characters. The "from" and "to" can be either hexadecimal Unicode code points, or single ASCII characters. When you omit "to", it is considered equal to "from". The TYPE sets the type of character, valid values for TYPE are:


Strong:
L       Left to right
LRE     Left to right embedding
LRO     Left to right override
R       Right to left
AL      Right to left Arabic
RLE     Right to left embedding
RLO     Right to left override

Weak:
PDF     Pop directional format
EN      European number
ES      European number separator
ET      European number terminator
AN      Arabic number
CS      Common number separator
NSM     Non-spacing mark
BN      Boundary neutral

Neutral:
B       Paragraph separator
S       Segment separator
WS      Whitespace
ON      Other Neutrals

For example:


BIDI_TYPE ! R


Sets the type of the exclamation mark to hard right-to-left.

Another example:


BIDI_TYPE A Z RLO


Sets the entire Latin upper case character set in right-to-left override.

Last example:


BIDI_TYPE 0x1000 0x2000 EN


Sets a huge range of Unicode characters to be treated as 'European number'.

Needless to say, you can use this to make a huge mess of things. It is intended to be used in rare cases, to specify single characters to a subtly different type to fix subtle problems.

The BIDI_TYPE can be used in 3 different ways:

Currently there is no way to specify these BIDI types interactively in setup, only the above methods are supported.

The BIDI_TYPE CLEAR can be used to explicitly delete all BIDI_TYPE commands of the same type (global, session or for PRIVT).

See also BIDI, ARABIC_SHAPING and AMBIGUOUS_CJK_WIDE.


12.3.19: BIT8COMMANDS (display/execute 8-bit commands)


BIT8COMMANDS DISPLAY
BIT8COMMANDS EXECUTE

Default: EXECUTE.
This is a per-session setting.

A VT220 terminal has a number of single-byte commands that are the equivalent of some two-byte commands. These commands and their function are described in details in this escape sequences section.

Note that these 8-bit commands are rarely used. Still, a proper emulator (such as IVT) has to recognize these commands and execute them.
However, some applications require that a particular 8-bit command is not executed, but a character is displayed instead. You can use CODEPAGEMOD to specify which Unicode character to display for these commands. However, if you want IVT to display the normal codepage character instead of executing the command, it is not easy to find out which Unicode character to specify, since it depends on the selected codepage.
The DEFAULT option of the CODEPAGEMOD command allows you to set the DISPLAY attribute for a single 8-bit command.

The BIT8COMMANDS DISPLAY says that ALL of the above special commands are NOT to be executed, but that the codepage character must be displayed instead.
Note that this breaks VT220 compatibility, so only use this when you know what you are doing.

See also CODEPAGEMOD, 8BITCHARS and VTTEST.
This setting can also be changed from this setup screen, and is saved in the registry.


12.3.20: BIND (Bind a SCRIPT to a key)

This command is deprecated. See KEYMACRO with the VT220 option instead.
This is a global setting.


BIND       key script [params]...
BIND_ASYNC key script [params]...
BIND_SYNC  key script [params]...

Bind a SCRIPT called script to a key named key.
For a list of valid key names, see programming keys.

Every time the key is pressed afterwards, the corresponding script is executed. When you use the BIND command, the script is started asynchronously, when a BIND_SYNC is used, a synchronous call is made, see here for more details.
The BIND is only effective for keys typed in session mode, not for keystrokes used in setup, menus, help and so on.
The older BIND command is a synonym for BIND_ASYNC.
See also MOUSE_KEY, which allows you to bind scripts to mouse actions.
See also KEYBOARDMOD for simple (fast) translations.
See also KEYNAME, to assign simple strings to standard VT220 keys.

See also "Learn mode & Keyboard macros", which allows very powerful things to happen when keys are pressed.
See also KEYMACRO, which is a more powerful version of BIND.

Scripts are a major feature of IVT, they can be used to do almost anything.
It requires its own chapter to explain it. Also see the F4-X screen.


12.3.21: BOLD_STYLE (How to make character bold on screen)


BOLD_STYLE AUTO | FONT_BOLD | FONT_HEAVY | COLOR | SHADOW

Default: AUTO
This is a per-session setting.

When the server sends a control sequence indicating that some text should be displayed in bold, this can be handled in several ways.
It can either change the font for a bold (or very bold) version, or use the same font in a brighter color, or use "shadowing", where it artificially makes a bold character by displaying the same character twice, shifted by a single pixel.

The AUTO style means IVT will pick the best alternative under the given circumstances. For example, if you want 'bold black', choosing 'bright black' is not an option, so a bolder font is required. If a bold font with the same basic size cannot be found, shadowing is used.
When possible, simply brightening the color is used.

The issue can be forced by choosing one of:

This setting can also be changed from this setup screen and the current setting is saved in the registry.

See also FONT.


12.3.22: BRACKETED_PASTE (Support for bracketed paste)

BRACKETED_PASTE [SMART|NORMAL]
NO_BRACKETED_PASTE

Default: BRACKETED_PASTE NORMAL
This setting is per session.

See: https://en.wikipedia.org/wiki/Bracketed-paste

Mind: This setting turns support for the feature on or off, only needed when there is a problem with it. The feature itself is turned on or off by the host, which sends an escape sequence to make IVT start or stop sending the brackets.
When NO_BRACKETED_PASTE is in effect, IVT will ignore the on/off commands and never send the brackets.

See the above WiKi page for a full explanation, but basically this feature allows programs running on the host to see the difference between text that is pasted and text typed manually. The program can then decide to treat spaces at the start of a line differently, for example.

One feature I personally find extremely annoying on Linux is that Bash will show pasted text in reverse video. Every file name, word, part of a command etc. is shown that way, which distracts me to no end.
Also, when a key is programmed to send a simple command (like "ls -l\r"), the command is highlighted and not executed until I confirm it with enter.
Very handy when you accidentally paste a large clipboard on the command line, very annoying when you are used to programming the keyboard with handy oft- used commands.

Therefore, SMART brackets will not send the bracket start/stop command for simple data that does not contain a carriage return or newline.
Since the purpose of the brackets is to prevent bad formatting, there is no point in sending the brackets when there is nothing to format, and also nothing to accidentally execute becasue there is no carriage return or newline in the data. When the brackets are not present the host will treat the data as it were typed by a human.

The default for SMART is off (NORMAL), so as not to confuse users who are used to this reverse video appearing.
When you use KEYMACRO comands (or program keys using the interactive setup) there is an option (per key) to handle this bracketing.

This feature was introduced in IVT 27.0, Sun Mar 24 13:34:22 2024.

It can also be set in this setup screen and is saved in the registry.


12.3.23: CAPSBUG (CAPS + SHIFT behavior)


CAPSBUG
NO_CAPSBUG

Default: CAPSBUG.
This is a global setting.

This setting determines what happens when you have CAPSLOCK active and use the shift key. In my humble opinion, CAPSLOCK should mean that CAPITALS are LOCKED. However, as far back as 1980, MS/DOS got this wrong - when you combine CAPSLOCK and SHIFT it generates LOWER case characters. For years, IVT corrected this bug by making sure that it generated upper-case only.

However, since the bug has been around for so long, many people consider it a feature, so upon special request I have added this CAPSBUG feature and even made it the default setting to emulate the bug. I personally have the CAPSLOCK setting turned to "Ignore", so CAPS is turned off anyway.

CAPSBUG will cause CAPS+SHIFT to generate lower case.
It can also be changed from this setup screen. The current setting is saved in the registry.


This is an important feature, others are prev/next


12.3.24: CAPSLOCK (Set mode for CAPS lock key)


CAPSLOCK
CAPSLOCK SESSION
NO_CAPSLOCK

Default: CAPSLOCK.
This is a per-session setting.

Enable/disable (NO_CAPSLOCK) the CAPS lock key. This is a very nice feature.
Disabling the CAPSLOCK key means that the key (and corresponding light) will be turned off as soon as you turn it on (presumably by accident). The upshot is that you have to use SHIFT to get capitals.

Caps Lock is not very useful when using a Unix host, and this will prevent you from accidentally "shouting" at Unix.

The "SESSION" addition will make IVT track the state of the CAPSLOCK key per session. When you switch between sessions, the state is saved and restored as appropriate. When new sessions are created, they inherit the current state of the CAPS key. Note that this setting is per session, too, so one session can have CAPS disabled, another can be restored to its private setting whenever you switch to it, a third can leave CAPS alone...

Upon special request, a final possibility is offered by the CAPSBUG setting.

It can also be changed (for the current session only) from setup.


12.3.25: CHARSET (Set DECVT220 or IBMPC character set)


CHARSET DECVT220|IBMPC

This command is obsolete. See CODEPAGE instead.
See also NATIONALITY.


12.3.26: CLICK (keyboard click on/off)


CLICK
NO_CLICK

Default: NO_CLICK.
This is a per-session setting.

Turn key click on (or NO_CLICK for off). Makes a bothersome noise whenever a key is typed. NO_CLICK is the default, you probably don't want to change this.
Supported because a VT220 has it.

It is even supported from setup (for the current session only).


12.3.27: CLOCK (Status line clock on/off, old-fashioned)


CLOCK
NO_CLOCK

Default: CLOCK
This is a global setting.

The CLOCK command is the same as STATMIDDLE CLOCK.
The NO_CLOCK command is the same as STATMIDDLE OFF.

This is a holdover from the past, when only a clock or nothing was displayable in the middle of the status line. Nowadays, there are several other options, see STATMIDDLE.


12.3.28: CODEPAGE (Set Windows output code page)


CODEPAGE Description
CODEPAGE n

Default: Dynamic.
This is a per-session setting.

The codepage determines the output codepage (what characters are displayed) of IVT. A codepage is a look-up table of 256 positions, where a received character us used as an index to look up the unicode character that is going to be displayed by IVT when that character is received.
The rules are:


I have copied the codepage tables and bits and pieces of the relevant code from the source of PuTTY, and would like to say thanks to the authors of that program for making this available. Also, please note this copyright.
The following values for Description are available (specify the first word only):


   ISO-8859-1   Latin-1, West Europe
   ISO-8859-2   Latin-2, East Europe
   ISO-8859-3   Latin-3, South Europe
   ISO-8859-4   Latin-4, North Europe
   ISO-8859-5   Latin/Cyrillic
   ISO-8859-6   Latin/Arabic
   ISO-8859-7   Latin/Greek
   ISO-8859-8   Latin/Hebrew
   ISO-8859-9   Latin-5, Turkish
   ISO-8859-10  Latin-6, Nordic
   ISO-8859-11  Latin/Thai
   ISO-8859-13  Latin-7, Baltic
   ISO-8859-14  Latin-8, Celtic
   ISO-8859-15  Latin-9, "euro"
   ISO-8859-16  Latin-10, Balkan
   KOI8-U
   KOI8-R
   UTF-8
   HP-ROMAN8
   VSCII
   DEC-MCS
   Win1250      Central European
   Win1251      Cyrillic
   Win1252      Western
   Win1253      Greek
   Win1254      Turkish
   Win1255      Hebrew
   Win1256      Arabic
   Win1257      Baltic
   Win1258      Vietnamese
   CP437        Standard OEM Ascii
   CP819
   CP878
   CP<Number>   That codepage when available in Windows

Example:


CODEPAGE ISO-8859-1

Another relevant setting is INPUT_LANGUAGE - if your locale implies that you type a lot of accented characters, you can configure IVT to use an American keyboard layout so quotes and so on immediately produce a quote.
See also CODEPAGEMOD.
See also NATIONALITY.

This setting is saved in the registry.
It can also be changed (on a per session basis) in this setup screen.


12.3.29: UTF-8 (What it is)

From Wikipedia:
UTF-8 (8-bit UCS/Unicode Transformation Format) is a variable-length character encoding for Unicode. It is able to represent any character in the Unicode standard, yet the initial encoding of byte codes and character assignments for UTF-8 is backwards compatible with ASCII. For these reasons, it is steadily becoming the preferred encoding for e-mail, web pages], and other places where characters are stored or streamed.  UTF-8 encodes each character (code point) in one to four octets (8-bit bytes), with the 1-byte encoding used for the 128 US-ASCII characters.
End quote.

Note that IVT is a VT220 emulator, and such terminals were only able to display simple 8-bit characters. Unicode has millions of different characters, and to be able to display them, fundamental changes had to be made to the display code of IVT.
When you select the UTF-8 CODEPAGE, IVT will recognize and process data from the host and display them correctly. Also, it will alter the behavior of the keyboard: normally this is a simple 8-bit character stream, but when you select a foreign keyboard, IVT will support IME (Input Method Editor) which allows Windows programs to accept Asian languages (such as Korean and Chinese) to be typed. Data entered this way is transmitted to the host in UTF-8 format, too.

Printing, copy & paste and logging data to files all support UTF-8, so you can use IVT in an international environment.

Even the language tables used by IVT to  customize the dialogs and menus support UTF-8 now, so you can make a Chinese version of the interface if you so desire.

See also ONLANGUAGE, NLS and LANGUAGE_FILES.
See also CODEPAGE, CODEPAGEMOD and KEYBOARDMOD.


12.3.30: CODEPAGEMOD (Modify current codepage)


CODEPAGEMOD position UnicodeCharacter [KEYBOARDMOD]
CODEPAGEMOD position DEFAULT

Default: None.
This is a per-session setting.

For a description of the DEFAULT option, see the discussion under BIT8COMMANDS.

This statement can be used to modify the current CODEPAGE.
A codepage has 256 positions, numbered 0 - 255. The value of each position determines what character is displayed by IVT when a byte is received from the host. IVT comes with many standard codepages, but sometimes the need arises for custom codepages. The position must be a value between 0 and 255 (or, when a hexadecimal notation is used), 0x00 - 0xFF). The UnicodeCharacter must be a value between 0x0000 and 0x10FFFF and should specify a valid Unicode character.

When a UnicodeCharacter value of zero is used, NOTHING is displayed, not even a space. This can be used to filter out any character.

When the (optional) keyword KEYBOARDMOD is specified, the statement implies a reversed KEYBOARDMOD statement.

It is important to understand exactly what is modified:

NOTE: A VT220 emulator such as IVT also supports a number of 8-bit command characters. When a byte with such a value is received, IVT normally executes the action defined by that command byte. However, when you EXPLICITLY set a CODEPAGEMOD to display a unicode character for one of the 8-bit commands, IVT assumes you know what you are doing and will display the character you specify WITHOUT executing the command. Note that this breaks VT220 compatibility! However, every 8-bit command code has a 7-bit equivalent, see here.
When you do not know the code for a particular position of a codepage, but just want to make IVT display the default character for the currently active codepage, use the CODEPAGE position DEFAULT form of the command.
See BIT8COMMANDS for details.

As a first example, the following will make a change for all sessions in IVT:


   CODEPAGE "ISO-8859-5"        # Load "Latin Cyrillic"
   CODEPAGEMOD 0x20 0x0119      # Modify SPACE into some random character
   CODEPAGEMOD 0x30 0x0039      # Change all zeroes into nines

Note that the second line will make it impossible to display the character zero! You probably want to use this with care :-)

See also CODEPAGE, BIT8COMMANDS and these escape sequences.
See also NATIONALITY.
Changes to the codepage are only possible in an IVT.RC file, thus they are not saved into the registry or modifiable in setup.


12.3.31: COLOR_CUT (Color of selected area during CUT operation)


COLOR_CUT REVERSE
COLOR_CUT ForeGround BackGround [[BRIGHT|NOBRIGHT] BRIGHT|NOBRIGHT]
COLOR_CUT RGB RGB
COLORCUT is an older alias for this command.

Default: Dynamic.
This is a per-session setting.

This determines what the screen looks like during a CUT operation.
The default is REVERSE, which will reverse the foreground and background colors of the characters on the screen. If you do not have very colorful screens, this is normally OK.

When you CUT from a screen with lots of reverse video data already on-screen, it is not always clear what is "select" reverse video and what is "native" reverse video. Also, if you have different colors for different hosts, you may want to select a different CUT color, too.

COLOR_CUT allows you to specify a fixed color. This is used to show the selected area. The ForeGround and BackGround colors must both be between 0 and 7 (see the color table).
It is also possible to specify a color by name ("blue", "white", etc).

The FIRST BRIGHT/NOBRIGHT can be used to specify the BRIGHT attribute for the foreground color, the SECOND BRIGHT/NOBRIGHT does the same for the background color.

Lastly, you can specify absolute RGB values for the colors. When you use one of the other forms, it is translated automatically to the proper RGB values, and those are used in the setup screen.

You can experiment in the color setup screen to find the nicest setting.

See also COLORS and COLOR_HELP.


12.3.32: COLOR_READY (Specify screen colors for ready indicator)


COLOR_READY ForeGround BackGround [BRIGHT|NOBRIGHT] [BRIGHT|NOBRIGHT]

Default: WHITE GREEN BRIGHT BRIGHT
This is a global setting.

IVT supports an escape sequence that can be used in your shell prompt. Whenever the session prints the prompt (is "ready"), IVT will make the activity- indicator for that session the specified color when that session is in the background. When the session is in the foreground, nothing happens.
The default color for this indicator is a green background, so the session will show "green" when it is ready!
The COLOR_READY statement allows you to set any foreground and background color.

See the color table for a list of valid colors.
You can also change the color from the setup screen.
Any modifications made in setup are also saved into the registry.


12.3.33: COLORS (Specify primary screen colors)


COLORS ForeGround BackGround [[BRIGHT|NOBRIGHT] BRIGHT|NOBRIGHT]

Default: WHITE BLACK
This is a per-session setting.

You can use this to specify the default foreground and background colors that IVT uses for the session screens.
The old syntax looks like:


COLORS GREEN BLACK BRIGHT NOBRIGHT

I.e., a foreground color, a background color, an indicator for the brightness of the foreground color and lastly an indicator for the background color.
The new syntax allows a more intuitive color syntax and allows you to specify non-standard colors by using absolute RGB values. Examples:


COLORS BRIGHTGREEN BLACK
COLORS 10,20,30   120,130,140
COLORS BLACK      250,250,250

As the example shows, a mix of absolute RGB and symbolic color names is allowed.
Note: If you change the RGB value of a symbolic name (see the RGB statement) of a color used as foreground or background, the display will change accordingly. If you use a fixed RGB value, then that value is used, always.
The preferred way is to use absolute values. This is why the setup screen will automatically translate to that format, saving to the registry is done in that format as well (and older saved profiles from versions of IVT that did not have this feature are converted automatically).

The hypertext help screens have a separate color setup, see COLOR_HELP.

The FIRST BRIGHT/NOBRIGHT can be used to specify the BRIGHT attribute for the foreground color, the SECOND BRIGHT/NOBRIGHT does the same for the background color. HIGH/NOHIGH accomplish the same thing.

See also the discussion on software blinking.

The foreground and background names can be chosen from the color table.
You can use the setup screen to change the colors (for the help screens, setup screens etc).

It is also possible to temporarily change the default background and foreground colors of the current session from the host. IVT supports its own extension to the ESC[...m command (see here).

The ESC[139m command restores the real foreground default, the ESC[149m does the same for the background color. This can be used when you start an application that uses a color scheme that assumes (for example) that you have white characters on a black background (and looks extremely ugly when you have a blue background). Before you start such an application, you could send ESC[137;140m to force white-on-black, when the application finishes you can send ESC[139;149m to restore your normal colors.

NOTE: When you draw colored text in a DIALOG, you can use the COLORATTRIBUTE function to code a color for text. In that case you can specify the explicit 'DEFAULT' for either the foreground or background color. The text in the dialog will be drawn with the appropriate default for the Windows GUI dialogs.

See also COLOR_CURSOR and CURSOR_HEIGHT.


12.3.34: COLORSCR (Detection of monochrome/color screen overrule)


COLORSCR
NO_COLORSCR

Default: COLORSCR
This is a per-session setting.

Enables or disables the use of color by the application.
When NO_COLORSCR is used, all attempts by the host to change the colors of the displayed text are ignored.
If you have a particularly garish application, you might want to turn this option off (NO_COLORSCR) and make IVT only use the default foreground and background colours.

The setting can be changed (for the current session only) from setup.

Note: The meaning of this keyword has changed: It used to specify that IVT was running on a PC with monochrome hardware. Such hardware is not in serious use anymore, so that option is removed from IVT.

See also COLOR_FOR and COLOR_ATTRIBUTE, which allow you to specify the use of colors instead of video attributes such as blink and underline.


12.3.35: COLOR_HELP (Specify screen colors for these help screens)


COLOR_HELP ForeGround BackGround [BRIGHT|NOBRIGHT] [BRIGHT|NOBRIGHT]

This is a global setting.

The default color scheme for the help screens is chosen such that they are most readable (black characters on a white background).

For those who insist on having different colors, this statement can be used alter those defaults.
The FIRST BRIGHT/NOBRIGHT can be used to specify the BRIGHT attribute for the foreground color, the SECOND BRIGHT/NOBRIGHT does the same for the background color.

See also the colors for the links, LINKSELCOL and LINKUNSELCOL.
See also COLORS.
See the color table for a list of valid colors.


12.3.36: COLOR_SEARCH (Colors to use for searched text)


COLOR_SEARCH R G B   R G B

Default: 0 0 0  255 255 0
This is a global setting.

When you activate the history pager (scroll back memory), you can use the built-in search commands of IVT to search for strings in the history buffer.
Strings that match are highlighted using the colors you specify here.
Multiple matches are easily spotted this way.
The default is black letters on a bright-yellow background.

The color itself is specified as two RGB (Red, Green, Blue) values, one for the foreground and one for the background color of matching search strings.

For a description of the color specification, see COLOR_CURSOR.

This item can be changed in this setup screen, and is also saved in the registry.


12.3.37: COLOR_TIPS (Colors to use for tooltip windows)


COLOR_TIPS R G B   R G B

Default: Taken from the system.
This is a global setting.

When IVT displays tool-tip windows, they can appear on top of the session screen. Since the colors of the session screen can be configured, the tips can be almost invisible. The COLOR_TIPS keyword allows you to specify the colors for all tips displayed on the current session. Every session can have its own colors.
The color itself is specified as two RGB (Red, Green, Blue) values, one for the foreground and one for the background color of tool-tip windows.
For a description of the color specification, see COLOR_CURSOR.

Windows has defaults for this, they are IVT's defaults, too.

This item can be changed in this setup screen, and is also saved in the registry.

See also COLOR_SEARCH.


12.3.38: COLOR_ATTRIBUTE/FOR (use colors instead of video attributes)


COLOR_FOR       Attribute FOREGROUND
COLOR_FOR       Attribute BACKGROUND [DEFAULT_ONLY]]
NO_COLOR_FOR    Attribute FOREGROUND|BACKGROUND
COLOR_ATTRIBUTE ColorName FG|BG  R G B

Default: NO_COLOR_FOR all attributes.
This is a per-session setting.

The RGB default color values are "nice" for a screen with a bright blue background.
Attribute can be BLINK, UNDERLINE, INVERSE or BRIGHT.
REVERSE is an alias for INVERSE.
BOLD is an alias for BRIGHT.
FG is an alias for FOREGROUND.
BG is an alias for BACKGROUND.
ColorName is a combination of up to 4 attributes, see examples below.
See also RGB for an explanation of RGB values.

A VT220 has a number of video attributes:

Normally, IVT will display these modes as you would expect: true blinking text, true underlining, reverse video by swapping background and foreground color, bright video by making the color more intense.
Ancient versions of IVT (and other emulators) that could not do true blinking because the underlying hardware did not support it, used to use colors to indicate blinking characters.
Some people have come to prefer this over actual blinking, so IVT allows you to set a color (foreground & background) that will be used for blinking characters.
The same goes for other video modes, because as soon as you use colors to indicate blinking or underlined text, how do you deal with text that is both blinking AND underlined? The answer is to define all 16 combinations of the four attributes, both the foreground color and background color.
You choose whether to use a color instead of the true attribute using the COLOR_FOR keyword. The actual colors to use are specified using the COLOR_ATTRIBUTE keyword.

To complicate matters yet a little further, some color themes want to use colors for (say) bold characters (foreground and background RGB values), but the background color can be overruled by the application: When the current background color is the default session colour, the COLOR_FOR background color is used, but when the application has set an explicit background color, that muse be used. This is specified using the DEFAULT_ONLY option for the BACKGROUND command. This can also be specified in interactive setup using the "Default only" options in the color setup screen.

For example:


COLOR_FOR BLINK     FOREGROUND BACKGROUND
COLOR_FOR UNDERLINE FOREGROUND BACKGROUND
COLOR_ATTRIBUTE BLINK FOREGROUND 255 255 255  # Bright white
COLOR_ATTRIBUTE BLINK BACKGROUND   0   0 255  # Bright blue

COLOR_ATTRIBUTE UNDERLINE FOREGROUND   0   0  0  # Black
COLOR_ATTRIBUTE UNDERLINE BACKGROUND 255 255  0  # Bright yellow

COLOR_ATTRIBUTE "UNDERLINE BLINK" FG  80 80 80  # Grey
COLOR_ATTRIBUTE "UNDERLINE BLINK" BG  200 200 0 # not-so-bright yellow

The first COLOR_FOR says: when a character should be blinking, change both the foreground and background color. When a background or foreground is left out, that color is unchanged (remains whatever the host has currently selected).
The actual color to use for the foreground color of blinking text is bright white (RGB value of 255,255,255), the background color is bright blue.
The colors for underlines are set in the next 2 ATTRIBUTE statements.
then the COMBINATION colors are set for text that is both blinking and underlined. The most complex combination of attributes would be:


COLOR_ATTRIBUTE "UNDERLINE BLINK INVERSE BRIGHT" FG  100 100 100

which specifies the color to use when all attributes apply.

An example with the DEFAULT_ONY option:


COLOR_FOR BOLD FOREGROUND BACKGROUND DEFAULT_ONLY
COLOR_ATTRIBUTE BOLD FOREGROUND 100 100 100
COLOR_ATTRIBUTE BOLD BACKGROUND 200 200 200


This will set both the foreground and background color for bold video, unless the application has set an explicit background color.

This item can also be changed from this setup screen, and is saved in the registry. By setting the checkboxes the appropriate combination with their actual colors will be displayed. By clicking on the examples, you can alter the RGB value of the specific item.

See also COLORS, COLOR_CURSOR, COLOR_SEARCH, COLOR_CUT.


12.3.39: COLOR_BLINK (use colors instead of true blinking)


COLOR_BLINK {R G B|DEFAULT}  {R G B|DEFAULT}
NO_COLOR_BLINK

Default: Not used (NO_COLOR_BLINK).
This is a per-session setting.

For a description of the R-G-B color specification, see COLOR_CURSOR.

This statement is deprecated, and the equivalent of:


COLOR_FOR BLINK FG BG
COLOR_ATTRIBUTE "BLINK" FG  R G  B
COLOR_ATTRIBUTE "BLINK" BG  R G  B


12.3.40: COLOR_MARKER (use mouse to mark text)


COLOR_MARKER R G B     R G B

Default: 0 0 0  255 255 0
Black foreground, bright yellow background.
This is a per-session setting.

You can use the mouse as a highlighter pen, to mark a part of the screen so you can find the marked text easier on a large screen.
To do this, select text with the mouse (or keyboard) and then, without releasing the mouse button, press the F3 key.
The selected text is painted using the given colors of COLOR_MARKER.
The first RGB value is for the foreground, the second for the background color.
You can mark text on the current screen and in scroll back memory.

You can erase the marker color by using F4 instead of F3.
There is also an entry on the menu (Edit, Clear marked text) that erases all marker colors on the current session, both on the active session screen and in scroll back memory.

See also HIGHLIGHT, which will automatically highlight text that matches a regular expression.
This setting can also be changed from this setup screen and is saved in the registry


12.3.41: COLOR_TAB_SELECT/DESELECT/ERROR (Session tab colors)


COLOR_TAB_SELECT   R G B   R G B
COLOR_TAB_DESELECT R G B   R G B
COLOR_TAB_ERROR    R G B   R G B
COLOR_TAB_BASE     R G B


Defaults:


COLOR_TAB_SELECT   0   0   0   255 255 255 (black on white)
COLOR_TAB_DESELECT 0   0   0   181 181 181 (black on grey)
COLOR_TAB_ERROR    255 255 255 255   0   0 (white on bright red)
COLOR_TAB_BASE     240 240 240             (light grey)


For a description of the R-G-B color specification, see COLOR_CURSOR.

When the TABSBAR is configured using the EXTENDED mode, IVT has full control over all aspects of the tabs bar (which is normally handed off to Windows).
So IVT can control the colors and fonts used for the texts in the tabs.

COLOR_TAB_SELECT specifies the foreground and background colors of the tab of the currently selected session.
COLOR_TAB_DESELECT specifies the colors of all other tabs.
COLOR_TAB_ERRORS specifies the colors a tab will get when the session is in an error state (like when the network goes down).

The COLOR_TAB_BASE gives the base color of the tab bar itself.

These colors can also be specified in this setup screen, and the current values are saved in the registry.


12.3.42: COLOR_UNDERLINE (use colors instead of true underlining)


COLOR_UNDERLINE {R G B|DEFAULT}  {R G B|DEFAULT}
NO_COLOR_UNDERLINE

Default: Not used (NO_COLOR_UNDERLINE).
This is a per-session setting.

For a description of the R-G-B color specification, see COLOR_CURSOR.

This statement is deprecated, and the equivalent of:


COLOR_FOR UNDERLINE FG BG
COLOR_ATTRIBUTE "UNDERLINE" FG  R G B
COLOR_ATTRIBUTE "UNDERLINE" BG  R G B


12.3.43: COLOR_VOLATILE (Setup colors of volatile items)


COLOR_VOLATILE R G B    R G B

Default: 0 0 255   0 0 0
For a description of the color specification, see COLOR_CURSOR.
This is a global setting.

This sets the color in the setup screens for items marked VOLATILE.
Since it is important that the user should have some visual feedback for items in setup that are marked as volatile, the texts belonging to these items are drawn in the specified colors instead of the default dialog colors.
The first RGB value is for the foreground, the second for the background color.
When a color is specified as 0 0 0, the default dialog color is used.
So the default is bright blue foreground on the default background.

There is no interactive setup item for these colors.


12.3.44: COLUMNS (Default number of screen columns)


COLUMNS num
COLUMNS num%

This command has been removed, see WINDOW_SIZE.


12.3.45: CONFIRM_URL_CLICK


CONFIRM_URL_CLICK
NO_CONFIRM_URL_CLICK


Default: CONFIRM_URL_CLICK

Starting with IVT 27.0, IVT supports hidden hyperlinks in texts. See: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda for details.
This allows an application to embed hyperlinks in output, like so:


printf '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\\n'

The "This is a link" text will be displayed on the terminal screen, but the link to http://example.com is associated with that text. When clicked, IVT will open the URL. This avoids ugly, long hypertext addresses on screen and is, for example, used by the GCC compiler when you pass it the instruction to generate links for every error or warning: -fdiagnostics-urls=always.
When you click on the highlighted bit of text, it will take you straight to page on the internet that explains the problem in detail.
More and more applications (and terminal emulators) implement this feature.
See  https://github.com/Alhadis/OSC8-Adoption/?tab=readme-ov-file for an overview of products that support this feature.

IVT will indicate the presence of a hyperlink by using a dotted-underline.
When you hover the mouse over such text, it will turn that nto a normal hypertext-link underline (bright blue) and show a tooltip that displays the link that will be opened. When you move the mouse away without clicking, the dotted lines are restored.

By default, IVT will ask for permission to open the link. This can be turned off by using NO_CONFIRM_URL_CLICK, which will open the link without further delay. Note that the user must still click on the actual text, and hovering mouse over the link text will still show the URL in a tooltip.
It goes without saying that it is never wise to follow links offered by unreliable sources.
See also this OSC 8 escape sequence.

This feature can also be set using this setup screen and is saved in the registry.


12.3.46: COPYSPEED (Scroll speed during COPY)


COPYSPEED lines-per-second

Default: COPYSPEED 4.
GUI_COPYSPEED is an old alias for COPYSPEED.
This is a per-session setting.

IVT will automatically scroll through the history data when the cursor reaches the top or bottom of the screen (standard Windows behavior) while selecting text with the mouse (or keyboard).

The speed with which the data scrolls is determined by this COPYSPEED setting. For every pixel that the mouse moves beyond the sensitive point, IVT starts scrolling the indicated number of lines per second. Depending on the number of pixels that you have at the top and bottom of the screen, you may want to set this value higher or lower.

If you press SHIFT during the scroll-operation, the speed will be increased by a factor of five.

See also HSPACE to create extra room at the top and bottom of the window, and FULLSCREEN to determine the objects on screen when IVT operates in FULLSCREEN mode.
See also MOUSE_SCROLL_FACTOR.

This setting can also be changed from this setup screen.
It is also saved in the registry.


12.3.47: COPY_RICH_TEXT (Copy data to the clipboard in RTF format)


COPY_RICH_TEXT [ALL_COLORS] [SCALE_FONT=x]
NO_COPY_RICH_TEXT

Default: COPY_RICH_TEXT, NO_ALL_COLORS, SCALE_FONT=1.4 This is a global setting.

If you enable this option, IVT will write formatting information to the clipboard as well as the actual text you copy. The effect of this is that if you paste into (say) a word processor, the text will appear in the word processor in the same font, colour, and style (e.g. bold, underline) IVT was using to display it.

Since the same text is also stored as plain text, a paste into another application will always work (either formatted or unformatted text will be pasted, depending on what the app supports).

The ALL_COLORS modifier determines what happens with the default colors of the foreground and background characters.
When ALL_COLORS is not specified, these are translated to "black" for the foreground and "white" for the background (so if you paste into Word, the default background is the white paper on which you get black characters).
With ALL_COLORS, the real colors you have chosen in IVT will be used, so you get an exact copy of how it looks on the screen pasted into the Word document.
NOTE: For some reason, pasting into WordPad will faithfully reproduce the RGB values of all the colors. When pasting the same clipboard contents into Word, all colors are subtly altered by Word. Nothing IVT can do about that, it creates the clipboard contents with the proper RGB color values...

The SCALE_FONT option can be used to increase or decrease the font size. It is a floating point number, used as a multiplication factor for the IVT font.
For some reason, a font that looks nice and normal on an IVT screen looks rather small when pasted into Word, so the default for this 1.4. When that does not suit you, values below 1.0 will decrease the pasted font size, values over 1.0 will increase.

This option can also be changed in the mouse options in setup.
The current values are saved in the registry.


12.3.48: COPY_STRICT (Strict or fuzzy COPY mode)


COPY_STRICT
NO_COPY_STRICT

Default: NO_COPY_STRICT.
This is a global setting.

When you do a COPY operation (with the mouse or keyboard), IVT can operate in either LINE or BLOCK mode (see CUTMODE).
Toggling between the two is done by tapping F1 during the COPY operation.

In strict BLOCK mode, IVT will always add newline characters at the end of the block selection, even when you select entire lines from beginning to end and some lines that occupy 2 physical lines on screen are really only one line.
In LINE selection mode, IVT will join such wrapped lines, so pasting produces a single line.

NO_COPY_STRICT (also known as fuzzy mode) will lift this restriction somewhat.
In fuzzy mode, lines that were wrapped will be pasted as a single line when you select them entirely in block selection mode. Also, IVT will use a slightly broader view on what "wrapping" is, exactly.
The upshot is that copy/paste works more intuitively, which is why NO_COPY_STRICT is the default mode.
If you want a more predictable block-selection, set it to COPY_STRICT.

This setting can also be changed from this setup-screen. The current setting is saved in the registry.

See also CUTMODE and, of course, Cutting & Pasting.


12.3.49: COPY_TRIM (Trim trailing spaces after select)


COPY_TRIM
NO_COPY_TRIM

Default: NO_COPY_TRIM.
This is a global setting.

When selecting text with the keyboard or the mouse, empty space between words can be trimmed away, so the trailing spaces are not copied and so also not pasted. The default is NO_COPY_TRIM, as many people find this more logical.
Older versions of IVT had a non-configurable COPY_TRIM as default behavior.

It can also be changed from this setup screen, and an altered value will be saved to the registry.


12.3.50: CRDIALOG (Use dialog to create sessions)


CRDIALOG OLD (Deprecated)
CRDIALOG MINIMAL
CRDIALOG MEDIUM
CRDIALOG MAXIMAL

Default: MEDIUM.
This is a global setting.

This setting determines what the "Create Session" dialog looks like initially.
Depending on the version of IVT that you use, this will result in a panel with fewer or more options being visible.

The default setting is MEDIUM, which hints at the many possibilities without overwhelming the first-time user.
Higher settings show more possibilities. While the dialog is being displayed, you can switch between the various modes by using the MORE and LESS buttons.

This setting can also be changed from this setup screen.
The current setting is also saved into the registry.

The "old" setting used to a simple (text-mode) prompt. That possibility is now removed, and automatically changed to MINIMAL if you attempt to use it.

Note that IVT_DIALOGSTATE can be used to customize this further.


12.3.51: CURSOR_BLINK (Blinking cursor yes/no)


CURSOR_BLINK
NO_CURSOR_BLINK

Default: CURSOR_BLINK
This is a per-session setting.

The blinking of the cursor can be turned on or off (default is on).
The blink speed is determined by the system, it can be changed in the system configuration panel of Windows.

This option can be configured for every session, can also be modified in this setup screen and is saved in the registry.

The color of the cursor is configurable, see COLOR_CURSOR and this setup.
The height of the cursor is configurable, see CURSOR_HEIGHT.


12.3.52: COLOR_CURSOR (Color of the cursor)


COLOR_CURSOR R G B   R G B
COLOR_CURSOR "#RRGGBB"
COLOR_CURSOR ColorNumber
COLOR_CURSOR ColorName
COLOR_CURSOR DEFAULT
CURSORCOLOR is an older alias for this command.

Default: Dynamic.
This is a per-session setting.

This determines the color of the cursor used by IVT on the session screen.

Colors can be specified in various ways (several commands use this format):

When IVT has to display the cursor it will compare the background color of the text the cursor is on with the background color of the cursor. If the two are somewhat alike (which would make the cursor badly visible or even invisible), IVT will switch foreground and background colors to make sure the cursor remains visible at all times.

The default for this setting is:


COLOR_CURSOR 255 255 255   0 0 0

Which gives a black (0 0 0) background on a bright white foreground.
The height of the cursor is determined by CURSOR_HEIGHT, and is by default the full height of the font. Blinking is determined by CURSOR_BLINK.

The color can also be changed from this setup screen.
There you can use the Windows GUI color picker to find the proper RGB values make a "nice" style cursor.
Every session can have its own style for the cursor.
The current setup is saved in the registry.


12.3.53: CURSORMODE (Application/normal mode of cursor keys)


CURSORMODE normal
CURSORMODE application

Default: normal.
This is a per-session setting.

The cursor keys of a VT100-like terminal can be configured in either NORMAL mode or APPLICATION mode.

In NORMAL mode, they will emit CSI x, where x is the letter A, B, C or D.
CSI, in turn, depends on the 7- or 8-bit mode that the session can operate in. In 7 bit mode, CSI is ESC [, in 8-bit mode it is 0x9B (an ESC character with the upper bit turned on).

When the mode is APPLICATION, the keys emit ESC O (capital letter o) followed by the same letter in 7 bit mode, and 0x8F followed by the same letter in 8-bit mode. Yes, it is confusing :-)

This setting can also be changed from setup, and is saved in the registry.
See also CODEPAGEMOD for a way to change the behavior of 8-bit commands.
See also KEYPADMODE for a way to change the behavior of the numeric keypad.


12.3.54: CURSOR_HEIGHT (Height of text-mode cursor)


CURSOR_HEIGHT Nr

Default: CURSOR_HEIGHT 16 (maximized)
CURSORHI is an old alias for CURSOR_HEIGHT.
This is a per-session setting.

The height of the cursor is (carry-over from MS/DOS) specified as a value from 1 - 16 inclusive, and is interpreted as a fraction of the current font height. So, a value of 16 specifies the maximum (same height as the font), a value of 0 is the minimum (1 thin line, forced by IVT).

IVT will draw a solid cursor of the resulting height, in the colors specified by COLOR_CURSOR. Blinking is controlled through CURSOR_BLINK.
Blink rate is controlled by Windows.

When IVT loses focus, it will draw a rectangle around the current position to leave a visual indication of where the cursor is.

Every session can have its own style cursor. The setting can also be changed from this setup screen, and is saved in the registry.


12.3.55: CUTMODE (Line or Block CUT-mode)


CUTMODE BLOCK
CUTMODE LINE

Default: CUTMODE BLOCK.
This is a per-session setting.

See mode for an explanation of these modes.
The default for this mode can be changed using the setup screen.

During a CUT (either keyboard or mouse driven), the mode can be toggled with the F1 key.
See also COPY_STRICT.


12.3.56: DEADKEYS (Enable/disable dead keys)


DEADKEYS
NO_DEADKEYS

This feature was a mistake and has been replaced by INPUT_LANGUAGE.


12.3.57: EMACS (Set EMACS keyboard mode)


EMACS
NO_EMACS

Default: NO_EMACS.
This is a per-session setting.

Some EMACS users insist on being able to type things like ALT-m and then expect IVT to send "ESC-m" to the host. When ALT-SHIFT-m is typed, it should send "ESC-M", of course.
Furthermore, CTRL-S and CTRL-Q have to be passed to the host unaltered (rather than being used for local flow control, part of the TELNET protocol).

So, when IVT runs in EMACS mode, all left-ALT key combinations are treated as EMACS meta-keys. When the key used in combination with the left-ALT is a normal character, it is combined with ESC and sent to the host.
When TELNET sessions are initiated, IVT will NOT negotiate local flow control and this implies that CTRL-s and CTRL-q are not considered special by IVT.

As a consequence of this, many built-in IVT keyboard commands are disabled (ALT-P for paste, ALT-S for slower and so on).
See here for a complete list.

Note: The newer KEYBOARD_MAP command can be used to switch the IVT keyboard into XTERM mode, which is actually a superset of EMACS mode. When XTERM mode is selected, the EMACS option is implied and so will be greyed-out in the dialog.

The setting can be changed from this setup screen (for the current session only) and is saved into the registry.


12.3.58: EXPLICIT_EXIT (IVT has to be terminated explicitly)


EXPLICIT_EXIT
NO_EXPLICIT_EXIT

Default: EXPLICIT_EXIT.
This is a global setting.

Normally, IVT will exit when the last session terminates (normally when you log out from your last session). When RECONNECT is in effect, sessions will not disappear when you log off, but IVT will re-establish the connection.
In that case, you have to use ALT+F4 to force IVT to disconnect the session.
See also RETAIN_SESSIONS, which does not cause a reconnect but leaves the session in a "zombie" state (with an optional reconnect to the same or a different host).

When EXPLICIT_EXIT is in effect, the behavior is a little of both. Normal sessions will disappear when you log off, except the last one. This will prevent IVT from exiting. If you want to stop IVT, you either have to use ALT+F4 on the last session, click "Exit ivt" on the menu bar or click on the close button of Windows. Or, hit ESC in the "Create session" dialog.

IVT will essentially perform a restart when EXPLICIT_EXIT is in effect. The initial login screen is displayed and you are prompted for a host name. When the autologin was used initially, it will be used again.

This setting can also be changed from this setup screen. It is also saved in the registry.


12.3.59: EXTRA_PANEL_ROOM (Horizontal spacing in dialogs)


EXTRA_PANEL_ROOM number


Default: 3 pixels
Number can range between -5 and 20.

Traditionally, IVT tried to make all dialogs (like the create-session panel and setup screens) as compact as possible to cram maximum information in a minimum number of pixels. In 1992, that was not without reason on small, low resolution screens.

In 2019, large, high resolution screens make it possible to use more room without problems. This setting can be used to have IVT create horizontal spaces between items in dialogs: Every line is extended by the given number of pixels. For high-DPI screens, this number is scaled automatically.

The default of 3 makes most dialogs look "nice", but that is a personal preference. The number can be set between -5 and 20.
A negative number will actually cause items to be on top of each other, or overlap. Higher numbers will create roomier dialogs.

Currently, there is no interactive setup item for this setting, so it can only be used in a configuration file or script.


12.3.60: F1F4 (Reverse meaning of F1-F4 and CTRL+F1 - CTRL+F4)


F1F4
F1F5
NO_F1F4

Default: NO_F1F4.
This is a per-session setting.

Reverse F1-F4 with CTRL+F1 to CTRL+F4 (Also NO_F1F4). F1F5 is an alias for F1F4 for historical reasons.

Normally, F1-F4 perform internal IVT functions such as hold screen (F1), print screen (F2), setup (F3) and help (F4). A VT220 also has four function keys called PF1 - PF4, which are missing on a PC keyboard. Therefore, IVT maps CTRL+F1 to CTRL+F4 to these keys.

This may inconvenience users who use applications that make heavy use of PF1 - PF4 (Oracle SQL*Forms and AIX 'smitty' are a good examples of this).
These applications are usually full-screen style, so they in turn do not need functions such as hold-screen and print-screen.

For this reason, you can use F1F4 to swap the PF1 - PF4 keys with the F1 - F4 keys (so you will have to use CTRL+F2 to invoke the IVT print screen function).
The PF1 - PF4 keys are also mapped to the top row of the numeric keypad (NUMLOCK to minus key) using the NUMERICF1F4 keyword (default setting).

The setting for the current session can also be changed from this setup screen and is saved in the registry.


12.3.61: FLASH (Action to take for flashing screen)


FLASH FLASH|TUNE|BEEP|OFF
FLASH WAV name

Default: FLASH FLASH
This is a per-session setting.

The IVT special command escape sequence ESC<space>f will cause the screen to flash, which is a way to have a silent BELL command (attracting the attention of the user without making a noise).
The standard IVT.TIC file also configures this, which implies that Unix commands that use the TERMINFO database (such as the VI editor) will use a visual bell by default. Some users don't like this, and requested a way to override this, which is what the FLASH command is for. When the escape sequence is received, IVT will flash the screen by default, but the same actions that are valid for a "normal" bell character can be configured, as well.

The TUNE plays a short tune, BEEP emits a short, business-like beep, FLASH flashes the screen (default), and OFF means FLASH commands are ignored.

This Windows version of IVT can also play a sound (.WAV) file when the FLASH command is received. You can specify the pathname of a WAV file or the name of a sound event from the Windows registry. Different sessions can have different files associated with them. The filename can be changed from the setup screen as well.
See also the PLAYSOUND function.

Also, see the ESC<space>f IVT-only escape sequence.
Also see the BELL_ABUSE function to suppress lots of BELL characters.
Also, see F3-D for a way of ignoring unwanted output quickly.

This setting can be changed from this setup screen.
It is also saved into the registry.


12.3.62: FONT_DISPLAY_0 (How to display "0" character)


FONT_DISPLAY_0 NORMAL | SLASH | DOT [x [y [l]]]

Default: NORMAL.
This is a per-session setting.

Many fonts make it difficult to distinguish between a zero (0) and the capital letter O. In the current font, they look like 0 and O.
Older systems used to use a slash through the zero, or a dot in the middle of the zero to make the distinction more visible.
Most modern fonts do not do this anymore, so IVT can be configured to do this for you. The default "NORMAL" setting does nothing special: you see the zero as the font defines it.

The "SLASH" setting means IVT will display a "/" character (as the font defines it) on top of the zero.

The "DOT" setting means it will draw a dot in the middle of the character.
It attempts to adjust the size of the dot to the size of the font, but when a font defines a strange form of zero the idea of "middle" may be wrong.
The defaults seem to work fine with fonts like Lucida Console and Courier New, and most other common fonts.
When the result is ugly, you can adjust the horizontal and vertical alignment of the dot, and the length of it (a dot is actually a 1-pixel long line), The optional x option for DOT can be a positive or negative value to shift the start position to the right (positive) or left (negative).
The optional y option for DOT can be a positive or negative value to shift the start position down (positive) or up (negative).
The optional l option for DOT denotes the length of the dot (default 1).
The defaults are "0 0 1" for x, y and l values.

When you make this setting the global default for IVT, these manual pages and all other text displayed by IVT will use that setting, too.

When you use the print-screen function, printed zeroes will be rendered according to this setting, too.

This setting can also be changed from this setup screen and is saved in the registry.


12.3.63: FOREIGN_ALT_NUMERIC (Recognize ALT-0/9 on foreign keyboard)


FOREIGN_ALT_NUMERIC
NO_FOREIGN_ALT_NUMERIC

Default: FOREIGN_ALT_NUMERIC.
This is a global setting.

Version 22 of IVT introduces UTF-8 and IME (International Method Editor) to support display and entering of international characters. This partial rewrite causes ALT key combinations like ALT-1 to ALT-9 (to switch between sessions) to work only when the proper combination is typed on foreign (non-American) style keyboards. However, users were so used to typing the keys in their American positions that it felt like a real handicap when those combinations no longer worked due to this change.

Therefore, this FOREIGN_ALT_NUMERIC setting can be used to force IVT to recognize the American-style ALT-0 to ALT-9 keystrokes when used on a foreign keyboard. It ONLY does this for those 10 keys, and should not ever cause problems, but because it might cause unexpected behavior on REALLY foreign keyboards, this feature can be disabled.

If you experience strangeness when typing ALT key-combinations, you might try to turn this off. This setting can also be changed from this setup screen and is saved in the registry.


12.3.64: FULLSCREEN (What to show in full screen mode)


FULLSCREEN [MENUBAR|VSCROLL|STATUS|TABSBAR|NONE],...

Default:


FULLSCREEN MENUBAR,VSCROLL,STATUS,TABSBAR


This is a global setting.

New in IVT 16.3a: Full screen mode, entered by typing ALT+Enter or by using the menu bar, or by using the FULLSCR function. Note that using this keyword does not mean IVT will switch into full screen mode by default - it only describes what the screen will look like.
Note: Use NO_ALT_ENTER to disable the key combination.

In full screen mode, IVT will maximize the window to use all available space (removing the IVT title bar, Windows taskbar and other screen clutter to give you the maximum possible number of rows and columns on the physical screen.
Typing another ALT+Enter (or by using the - optional - menu bar will return to normal window mode). A SCRIPT can also use the FULLSCR function.

The FULLSCREEN statement is used to specify what objects should be left on screen in full screen mode.
The menu bar (MENUBAR), vertical scroll bar (VSCROLL) and status line (STATUS) and TABSBAR are all optional, and can be specified as a comma-separated list of options.
Before the option list is processed, all options are turned off, so:

FULLSCREEN STATUS,VSCROLL

will show the status line and vertical scroll bar in full screen mode and not the menu bar or tabs bar. Note that the full screen settings are independent of the normal settings.

The default is to have all objects enabled. NONE leaves nothing.

See also VSPACE and HSPACE, which also determine what the screen will look like in full screen mode.

This setting can also be changed from this setup screen.
The current setting is also saved in the registry.


12.3.65: FONT (Set the screen font for session)


FONT "font description"

Default: Dynamic.
This is a per-session setting.

This command sets the font that IVT uses for the session screens.
GUI_FONT is an old alias for "FONT"

Any fixed-pitch font can be used, you will get an error when attempting to use a variable-width font. Every session can have its own font.

See also, the SIZEFONT, which allows you to specify that the font size must be adjusted when the window is resized, rather than the number of rows and columns.

IVT automatically derives double-wide and double-high fonts from the one you specify. There is also some very clever checking to see if the font you have chosen contains decent line drawing characters. IVT needs those characters internally to draw lines and boxes, and the host can use them for the same purpose. When a font does not contain the proper symbols, a program like PuTTY will resort to "poor man's line drawing" where the lines are built from normal dashes, the pipe symbol (|) and a plus sign.

IVT will actually study the pixel-pattern of two line-drawing characters in the chosen font to see if they actually are lines. When not, a separate font is used for the line-drawing characters only! The substitute font MUST be a scalable True Type font, so IVT can obtain the proper symbols in exactly the right size. When that fails, IVT gives in and uses poor man's line drawing as a last resort. The substitute font is set with SUBSTITUTE_FONT and defaults to "Lucida Console". Change at your own risk.
This feature enables IVT to use ANY font and still display all the VT220 characters correctly.

The fontdescription is a number of comma-separated clauses of the form KEYWORD=VALUE. The following keywords are valid (case insensitive):

The built-in default for this is:

   FONT "Facename=Lucida Console,Points=9"

The font can also be changed from the "Setup" menu bar. A dialog will appear that allows you to choose from all the available fonts. Such a selection is of course saved to the registry when you choose "Save setup".

If you want to add a manually selected font to your IVT.RC setup, you can view the description of the manually selected font in this setup screen.

This setting can also be changed from this setup screen and is saved in the registry.

See also SIZEFONT and FONT_QUALITY.


12.3.66: FONT_QUALITY (Set font quality for all fonts)


FONT_QUALITY DEFAULT|ANTIALIASED|NON-ANTIALIASED|
           CLEARTYPE|DRAFT|PROOF

The default setting is DEFAULT.
GUI_FONT_QUALITY is an old alias for FONT_QUALITY.
This is a global setting.

You can specify any single word out of the list above.
IVT will use this to instruct the Windows font mapper to choose a particular font quality for use in the main IVT window. The default behavior of the font mapper will usually be optimized for your environment, but if you have extreme fonts or hardware you may want to tweak this...

From the actual Microsoft documentation:

See also FONT.
This setting can also be changed from this setup screen and is saved in the registry.


12.3.67: GUI_CLOSE (Disable Windows close button)


GUI_CLOSE
NO_GUI_CLOSE

Default: GUI_CLOSE.
This is a global setting.

When NO_GUI_CLOSE is specified, users are prohibited from forcibly closing IVT sessions. The close button (X on the title bar) will be greyed-out, the system menu "Close" option will be greyed out, the ALT-F4 key is disabled.
Lastly, the "Close session" and "Kill all sessions, exit" entries on the "Sessions" menu of the menu bar are disabled.

This means that users can only exit IVT by cleanly logging off all sessions.

Use this when the users use an application on the host that needs to be stopped in a clean way (for example to save data). Aborting the connection must be prevented in such a case.

See also EXPLICIT_EXIT and secure mode.
See also IVT_DIALOGSTATE to disable parts of the interface of IVT.

This setting cannot be changed in setup, is not saved in the registry and is applied as soon as IVT is initialised. There is no way to "unprotect" IVT once started in protected mode. In other words, when you add a NO_GUI_CLOSE command to your IVT.RC file, all sessions have to be exited cleanly before IVT can terminate. Note that this may leave you with no other alternative than to forcibly kill IVT from the Windows task manager. For example, when you use IVT to connect to a serial modem port, it is unwise to have this protection on, since such a device cannot disconnect. When the application on the host misbehaves and does not allow you to log off, you will have to kill IVT (which also kills all other IVT sessions you have).

Finally, the host can still receive forced terminations when users turn their PC off, or disconnect the network cable. Also, an IVT script can use the ENDSESSION statement to force a disconnect under script control.


12.3.68: GUI_ONTOP (Force window on top)


GUI_ONTOP
NO_GUI_ONTOP

Default: NO_GUI_ONTOP
This is a global setting.

This statement forces the IVT window to be "always on top" of all the other windows. The default for this is, of course, NO_GUI_ONTOP.

It can be changed from this setup screen, too, and is saved in the registry.
Mind you, if you configure IVT to be always on top, and configure a 100% screen size, it becomes very hard to use any other application. If you want to lock users in a single application environment, also check out secure mode and GUI_CLOSE.
Another nice feature is IVT_DIALOGSTATE that allows you to disable arbitrary bits of the IVT interface.

The statement can also be used to force IVT to the foreground by issuing the following commands in a script:


   GUI_ONTOP
   NO_GUI_ONTOP

The first forces IVT to the front, the second turns the feature off but leaves the IVT windows visible. This is handy when some important condition is discovered that requires immediate user attention.
See also FLASHWINDOW.


12.3.69: GUI_RESIZE (allow resize of session)


GUI_RESIZE
NO_GUI_RESIZE

Default: GUI_RESIZE.
This is a per-session setting.

When NO_GUI_RESIZE is specified, the session cannot be resized by means of the maximize/restore button or by dragging the borders of the window.
The host can still send a resize command, and a script can control the size, but the user cannot (easily).

But since this is "just an option", it can be set with this setup screen and can thus be turned off by a user that insists (but see IVT_DIALOGSTATE to disable this, too).
For example:


   IVT_DIALOGSTATE S1_RESIZE   SKIP
   IVT_DIALOGSTATE S1_SIZE4ALL SKIP


Would remove the options for resizing from the setup screen.

When the user changes the font, the NO_GUI_RESIZE may result in a different size of the window, but the number of rows and columns will remain fixed.

See also SIZEFONT, which will cause the number of rows and columns to stay the same and resize the font when the user resizes the window.
See also ALT_ENTER for full-screen switching.

The setting is per session, so you can use it in a script to force a specific size for a specific session.
It is also saved in the registry.

See also ONRESIZE scripts. They can track (and/or undo) size changes.
See also SIZE4ALL, WIN_MINIMIZE and FULLSCREEN.


12.3.70: HIDEMOUSE (hide mouse pointer while typing)


HIDEMOUSE
NO_HIDEMOUSE

Default: HIDEMOUSE.
GUI_HIDEMOUSE is an old alias for HIDEMOUSE.
This is a global setting.

IVT can remove the mouse pointer from the IVT window during typing. This makes sure that the pointer-image does not hide or interfere with the typing itself.
The mouse is re-enabled as soon as it is moved or used in any way.
The mouse is NOT hidden when a (clickable) dialog or IVT menu is visible.
Hidden by default. Can also be changed from this setup screen.

The current setting is saved in the registry.


12.3.71: HIGHLIGHT (Highlight expressions on screen, act on them)


HIGHLIGHT PATTERN=regexp [options...]
NO_HIGHLIGHT [LOCAL|GLOBAL|ID NAME [...]]

Default: None.
This is a per-session setting.

It allows you to specify regular expressions that trigger a highlighting on the session screen, to make certain messages "jump out" at you.
Any RGB combination of colors can be specified for foreground and background colors, not just the 16 VT220 colors. Optionally, you can make them blink or be underlined as well.
Matching strings can have tool-tips associated with them and you can configure scripts to start when the user clicks on the highlighted text.
There is even a CALL_AUTO, that will call a script whenever a match occurs.

NO_HIGHLIGHT will remove existing highlight patterns.
There are two lists: GLOBAL (all sessions) and LOCAL (current session only).
When no mode is specified, the proper list is determined automatically.
When an explicit mode is specified, that list is cleared.

You can also specify a IDs to clear, in that case a HIGHLIGHT statement that was created with an (optional) ID clause exactly matching the given ID will be removed (searched for in both lists). This is needed when you write highlight statements that have patterns and/or tooltips that depend on the current IVT language. When the user switches language an ONLANGUAGE script can delete and redefine such highlight statements. See the highlight.ivt script that is part of the standard IVT distribution for an example.

There are many options you can specify for HIGHLIGHT. The complete list is:

The interactive setup screen can be used to easily view the details of all HIGHLIGHT statements. You cannot use the interactive editor to change or remove the patterns that were created using a HIGHLIGHT statement in an IVT.RC file. The only thing you can change is the state of the "Enabled" flag, to temporarily disable (or enable) a pattern.

New patterns can be added, and patterns added this way can be edited and removed interactively as well. When you save setup, patterns that were added interactively will be saved as part of the setup. HIGHLIGHT entries that are not saved are lost when IVT exits!
HIGHLIGHTs can be part of a PROFILE, and IVT will load and unload sets of such highlight statements when you switch profiles.

A pattern can be GLOBAL or "This session only". When you save a profile, the "per session" patterns are promoted to global. You can also write scripts to add (or delete) patterns for specific sessions. You can also change this setting on this setup screen.

Examples:


   HIGHLIGHT PATTERN="IVT" BLINK


This will make the word "IVT" be displayed in the brightest white on the brightest red background the system can manage, AND will blink. This is display only (no scripts or actions are configured).

A more useful one:


HIGHLIGHT PATTERN="https?://[^ ,<>\(\)\`\"\'!]+"        \
          FG=brightblue BG=Default underline            \
          CALL_BUTTON1=ClickURL                         \
          ON_DEFAULT_COLORS_ONLY                        \
          TIP="Click to follow"

This one is so useful it is part of the standard distribution of IVT. The pattern matches an URL. Basically, it matches all http://blah or https://blah types of string. When a match is found, it is shown in bright blue characters, underlined (this format may look slightly familiar).
The BG=Default makes sure the background color is unaltered.
When a host sends a URL in special colors, IVT will take NO special action at all on the match (because of the ON_DEFAULT_COLORS_ONLY).
When the mouse is hovered over a URL, the tooltip will say: "Click to follow".
When the user clicks the text, the ClickURL script is started.
That script (also part of the standard distribution) will use SHELLEXECUTE function to actually start a browser, passing it the URL on the screen.
In other words: This highlight statement will make IVT recognize web URLs both on the session screen and in this documentation itself.

Searching for highlighted strings in the session history has a special exception.
If you search for the pattern "." and check the "highlighted" option, this would normally mean a search for individual characters that have the 'highlight' property.
It then takes many presses on the 'N' key to skip all characters on the same line. This is why IVT optimizes this special case: it only matches a highlighted pattern once. So "." means: look for HIGHLIGHT matches one by one, allowing for efficient searching for the 'next' (press 'n') or previous (press 'N'). Also, the matches are not shown in the COLOR_SEARCH colors, but in the original colors specified in the HIGHLIGHT statement.

NOTE: If you program HIGHLIGHT statements using a SCRIPT, make sure you pass valid script syntax. IVT will interpret everything that follows the HIGHLIGHT as a series of expressions. The sequence of expression RESULTS is passed to the HIGHLIGHT statement. For example:


Script Something
   HIGHLIGHT PATTERN="Demo 1" BG=green
END

Looks valid, but is not because this is seen as an assignment of "Demo 1" to the variable $PATTERN, and the result of that expression is "Demo 1".
Similarly, the word "green" is assigned to the $BG variable, result is "green".
So the highlight statement sees:


   HIGHLIGHT Demo 1 green

And this will trigger several errors:


   Unexpected keyword: Demo 1 green
   Missing PATTERN=string clause

Because it sees things it does not recognize and misses the compulsory PATTERN.
The proper way to write this is:


Script Something
   HIGHLIGHT "PATTERN=\"Demo 1\"" "BG=green"
END

And now the resulting statement reads:


   HIGHLIGHT PATTERN="Demo 1" BG=green


And THAT will highlight a string with a space in it using a green background.

See also HIGHLIGHT hash.
See also REGMATCH and SUBSTITUTE.
See also WAIT REGEXP.


12.3.72: HIGHLIGHT_MODE (Turn all HIGHLIGHT string on/off)


HIGHLIGHT_MODE
NO_HIGHLIGHT_MODE

Default: HIGHLIGHT_MODE
This is a per-session setting.

The HIGHLIGHT statement allows you to have (lots of) regular expressions that will cause matching strings to be highlighted on screen.
Sometimes you may want to temporarily disable those highlights.
For one thing, it takes considerable computing power to do the highlights and this may slow things down too much. Second, too many highlighted strings on the screen can cause a (colorful) mess.

Every individual HIGHLIGHT statement has an enable/disable indicator, but if you have many it may be more convenient to disable all of them at once.
The NO_HIGHLIGHT_MODE will achieve this for the current session.
Since this setting is part of the IVT PROFILE, it is saved into the registry when you use the 'Save settings' feature. If the default profile contains this flag in the "off" mode, all HIGHLIGHTS will be disabled by default and then you can use HIGHLIGHT_MODE to turn them on for individual sessions.

The setting can also be changed from this setup screen and is saved in the registry.


12.3.73: INPUT_LANGUAGE (Keyboard input language)


INPUT_LANGUAGE default
INPUT_LANGUAGE languagename

Default: INPUT_LANGUAGE default
See also BIDI_RTL_LANGUAGE.
This is a global setting.

Older versions of IVT used to have a DEADKEYS setting that allowed you to ignore dead keys which are used on international keyboards to type characters with accents. Since I am Dutch, I frequently use such keyboards that do not produce a " when it is typed, but combine it with the next character to an accented character. Very annoying when editing scripts and source code.
Normally you would change the input language (and set it to American), but I also frequently need the Dutch setting in other programs.

That is why the DEADKEYS setting was introduced: IVT would always produce the correct character, even when it was actually receiving accented characters from the Windows keyboard driver. IVT went through a lot of trouble to strip those accents off again.

When I developed the UTF-8 code, I found that the Dutch accents are only one easy form of special keyboard input: typing traditional Chinese involves many keystrokes to produce a single character, and my DEADKEY code failed in dealing with this, So, DEADKEYS is gone and replaced by INPUT_LANGUAGE.

This new setting does not try to change the code generated by the keyboard, but allows you to change the Windows keyboard setting for IVT to any of the installed languages on your system. The list can be changed using the language tool bar, and switching input languages is normally also done using the language icon in the Windows toolbar.

Adding languages results in a list of keyboards supported by your system.
The names can be shown in IVT setup (Keyboard/font, input language), My system normally shows "United states (international)" and "United states".
The international setting produces the accented characters.
Those names can now be used as arguments to the INPUT_LANGUAGE command:


   INPUT_LANGUAGE "United states"

will force my "normal" setting in the current session.
The setting can be changed for every session, and the Windows input language icon will change when you switch between sessions.

When left on the "default" setting, IVT will not do anything to change the keyboard input language, so you will have to manually change the input language when you need it.

See also this setup screen.
This setting is saved in the registry.

NOTE: This function is also available through IVTFUNCTION, in which case you need to specify the name of the language as an argument. The difference between using the IVT.RC statement and the IVTFUNCTION is that the setting for the session is not changed, only the Windows function to change the language is called.

NOTE: When you enable BIDI and BIDI_RTL_LANGUAGE, then the language setting for BIDI takes precedence over the default language set by INPUT_LANGUAGE.
When you use multiple sessions, some of which actually use BIDI and some do not, it is best to set INPUT_LANGUAGE, BIDI_RTL_LANGUAGE and BIDI_LTR_LANGAUAGE all explicitly, so IVT will explicitly set the keyboard language every time you create a new session, or switch between them. When one or more settings are left on "Use system default", IVT will take no special action and that can make switching between sessions set an unpredictable keyboard layout.

See also ONLANGUAGE, NLS and LANGUAGE_FILES.


This is an important feature, others are prev/next


12.3.74: IVT_DIALOGSTATE (Configure dialogs and menus)


IVT_DIALOGSTATE name ENABLE
IVT_DIALOGSTATE name DISABLE
IVT_DIALOGSTATE name SKIP

This is a global setting.

This command allows you to selectively disable or omit all parts of the IVT menus and dialogs. Every menu item, every button, textbox, radio button and every checkbox has an internal, unique name. These names are also used for the translation of the IVT user interface into another national language.
This name can be used to configure the visibility state of such items as well. The state of an item can be normal (ENABLE), greyed out (DISABLE) or omitted entirely (SKIP). The rules are as follows:

Since this allows you to make arbitrary elements of the dialog unavailable, you can make IVT totally unusable by disabling OK buttons all over the place, or omitting essential parts of the interface. So be careful.

It is MEANT to be used to allow users only access to those parts of the interface that you think they actually need, without allowing them to change arbitrary settings which will disrupt normal use of applications by IVT.
A nice example of this is to allow the user to change the printer used by IVT (which requires access to setup) without allowing access to Kerberos setup which may break secure authentication or have an adverse effect on security.

The IVT_DIALOGSTATE can be used to disable the "Kerberos" button in the setup panel by doing:

   IVT_DIALOGSTATE SETUP_KERBEROS DISABLE

which will make this button permanently greyed out.
Within a dialog, you can disable or omit any item, as long as you know the name. This name can be obtained in various ways:

There is no warning or error when you misspell the name, as not all of the names are used by all versions of IVT. For example, Kerberos dialog items are not known by versions of IVT without Kerberos support compiled in.
Unknown items are simply ignored.

And, of course, this "get name" feature itself can be disabled using NO_OBJECT_ID, so users cannot obtain the names of the internal ID's (or be confused when they accidentally trigger one of the actions that causes a name of an internal object to be displayed).

See also security.


12.3.75: IVT_LANGUAGE (Language used by IVT itself)


IVT_LANGUAGE "name"

Default: IVT_LANGUAGE "English"
This is a global setting.

Chooses the national language of IVT itself. Valid choices are:

IVT will, during start-up automatically scan the "Languages" subdirectory for files containing translation tables for IVT itself and scripts.
The file called "ivt.main" is the translation for IVT itself, and have items for all menus and dialogs into a foreign language.
Most of IVT is translated, only the more obscure messages and error pop-ups are in English only.
All other files are assumed to be used for scripts that use DIALOG statements and plain strings. Dialogs are automatically translated, the strings can be accessed using the NLS() function. There are plenty of examples in the Language structure to serve as guidelines for developing your own.

The language directory called "Example" serves as a template for translations into other languages. It contains the original English strings, and shows what you have to do to adapt IVT to a new language.
There is no need to compile the file - a new file or version of a file works immediately.

If you do write a file in a new language, please be so kind to mail a copy to support@ivtssh.nl, so it can be included in future releases.

The files can also be used to customise the look & feel of IVT. Copy one of the files, modify as desired, give it a unique language name and this will become a valid choice for an IVT_LANGUAGE statement.

You can change the language from this setup screen, too.
This will switch to the new language immediately; no restart of IVT required.
The current setting is saved in the registry.

The LANGUAGE_FILES keyword can be used to point IVT to extra translation table files. A script or package can use this to have private translation tables to support multiple user languages in scripts.
See also ONLANGUAGE, NLS and LANGUAGE_FILES.

NOTE:
This field is one that can be configured using the installation wizard that is automatically started when you install IVT. Because it would give conflicts when you change this both in the configuration file created by the wizard and in interactive setup, this item is disabled in interactive setup.
If you want to change this item, re-run the installation wizard:

Menubar->setup->Re-run initial setup script

The wizard has as the first button a "Do not use wizard" feature. If you choose that, all items in interactive setup will be enabled again (and you must configure all the necessary options there and save the setup, or edit the IVT.RC file manually).


12.3.76: KEYBOARD_MAP (Select XTERM/VT220 type of keyboard)


KEYBOARD_MAP VT220
KEYBOARD_MAP XTERM [option,]...


Option is one of:


CTRL_CURSOR
NO_CTRL_CURSOR

ALT_CURSOR
NO_ALT_CURSOR

ALT_T
NO_ALT_T

ALT_DIGIT
NO_ALT_DIGIT

CTRL_PGUP_DOWN
NO_CTRL_PGUP_DOWN

Default: VT220, NO_CTRL_CURSOR,ALT_CURSOR,ALT_T,ALT_DIGIT,CTRL_PGUP_DOWN

A VT220 has a keyboard with 20 function keys, cursor keys and so on that emit well-defined, time-honored sequences recognized by millions of hosts worldwide.
An Xterminal nowadays uses a standard PC keyboard (fewer function keys) and has been modified to emit subtly different sequences that allow greater control.
For example, a VT220 does not make a difference between a cursor key and the same key combined with SHIFT. Using CTRL-cursor emits nothing on a VT220, so IVT has used such combinations for internal functions (session switching) for over 25 years.

An Xterminal will emit codes in such a way that the host can see the difference between a normal cursor key, shifted cursor, ALT-cursor, Ctrl-Cursor and even combinations like CTRL-SHIFT-Cursor and so on.
Similar things happen with function keys: F7 on a VT220 will send the code for the F7 key, SHIFT-F7 (in IVT) will send the code for F17.
An Xterm does not have an F17 key, so it sends code for "F7 + Shift" (and other codes for Ctrl, Alt and combinations thereof).

When KEYBOARD_MAP XTERM is used, IVT will emit keyboard codes identical to a modern Xterm. This allows you to use editors like "micro" on Linux, which rely heavily on this.

However, there is a conflict with existing key-combinations in IVT. In Xterm mode these have to send data to the host, but IVT uses:

The options on this KEYBOARD_MAP XTERM can be used to configure what you want to happen when you use these IVT keyboard-combinations.

Note: These options are rather special: The KEYBOARD_MAP command is a per- session setting, but the options are global (since they are used for switching sessions, behavior would be very illogical if different sessions had different behavior for session-switching keys).

These settings can also be changed from this setup screen and current settings are saved in the registry.


12.3.77: KEYBOARDMOD (Modify keyboard codepage)


KEYBOARDMOD InputValue UseValue

Default: Not used.
This is a per-session setting.

See also CODEPAGEMOD for more information.

The KEYBOARDMOD statement is useful to build custom keyboard translations.

When a KEYBOARDMOD statement is used, IVT will test every single keystroke against all specified InputValues (you can have many different KEYBOARDMOD statements in your IVT.RC file).
When a match is found, IVT simply pretends that the UseValue key was typed.
The UseValue can be any valid Unicode character (range 0 to 0x10FFFF). This allows you to simplify typing certain complex characters, but you probably want to set the CODEPAGE to UTF-8 in such cases, since characters outside the normal range can only be properly transmitted and received in UTF-8.

The InputValue and UseValue can be specified in hexadecimal, and must both be values between 0 and 0x10FFF (any Unicode character value).
Example:


   KEYBOARDMOD 0x30 0x31
   CODEPAGEMOD 0x31 0x30

The FIRST line causes every zero you type to be translated into a one.
The SECOND line causes every received '1' to be displayed as a '0'.
This will make your host see a '1' while you are seeing a '0'! This example is not very useful but it is instructive :-)

If you want to modify a certain keystroke (combination) on your keyboard, you can use the keyboard-debug feature of IVT (setup->Language/keyboard panel) to make IVT show the internal codes of every typed character. The VirtualKey code is the value to use as the first parameter in the KEYBOARDMOD statement (it is the value generated by your actual keyboard driver). For IME input (International Method Editor) the Unicode and UTF-8 representations for every generated character are shown. Use the IME-CHAR value for the InputValue parameter if you want to translate such characters.

There is a local KEYBOARDMOD list (created by having a script running in the context of a session, see PRECONNECT and ONCONNECT), and there is a global KEYBOARDMOD list (from normal IVT.RC statements or by using the GLOBAL keyword in a script). When the local list has a match, that is used, else the global list is searched.

See also "Learn mode" which allows you to have more complex translations, ONKEY which allows you trap the keyboard events and KEYMACRO which allows you to triggers scripts when keys are typed.


12.3.78: KEYMACRO (Program any key to do anything)


KEYMACRO "Key description" STRING        [options] "String value"
KEYMACRO "Key description" SYNCFUNCTION  [options] Script [params]
KEYMACRO "Key description" ASYNCFUNCTION [options] Script [params]
KEYMACRO "Key description" IVTFUNCTION   [options] "Internal function"


This is a per-session setting.

Options are:

The keyboard macro recorder allows you to reprogram keys in various ways, where any key combination can be programmed to either send a string, invoke a script, perform an internal IVT function and so on.
Traditionally, these programmed keys had to be saved in files which had to be loaded at IVT start-up time using the LOAD keyword. In version 22 and later of IVT these recordings are saved as part of setup, though.

The simple KEYNAME command can be used to program keys that have predefined VT220 names (such as F1 - F20, NXTSCR and so on). That command, however, does not allow you to program key-combinations (such as ALT+F10 and so on).

Various people requested a means to program these key combinations with the flexibility and power of the macro recorder in IVT.RC files only, since this allows for better maintainability, distribution to many users and readability.
For this reason, the KEYMACRO command was added. The rules are as follows:

For the difference between calling a script synchronously or asynchronously, see the BIND_SYNC and BIND_ASYNC commands.

IMPORTANT EXTRA FEATURE:
The keymacro recorder in setup only allows you to program keys that generate data. This is because you have to type the key to program, and that part of IVT does not respond to Ctrl, Shift, Alt and so on being typed by themselves.
BUT: you can code this in a KEYMACRO statement in your IVT.RC file! This allows you to code reactions to such keys pressed singly or in combination.
For example:


KEYMACRO "-Shift+LCtrl+RCtrl-Alt" IVTFUNCTION "Show current cursor position"

This says: When none of the shift keys is down, Left control is down, Right control is down, none of the Alt keys is down: show where the cursor is.
Result: when you press both CTRL keys together, IVT briefly shows a large red cross through the current cursor position. This one is part of the standard distribution of IVT - try it now!
If you write this macro as:


KEYMACRO "+LCtrl+RCtrl" IVTFUNCTION "Show current cursor position"

It ALSO does this when you press both CTRL keys together with one or more of the SHIFT and ALT keys (it does not mention the state of the Shift and Alt, so they are "don't care" keys).

The resulting set of words that the KEYMACRO key description can contain is described below. The ORDER is very important: use the order below to string descriptions together. "+Shift+Ctrl" is OK, "+Ctrl+Shift" is NOT! Also, strings are case sensitive: +CAPS and -caps work, -CAPS does not!

Name of the key.
   This comes first, it gives the name of the data-generating key. Use the
   name generated by the keyboard macro recorder for the key.
   NOTE: This is language dependent! A Swedish installation of Windows will
   give a Swedish name for the ENTER key. This is why there is a "Copy to
   clipboard" function on the macro recorder.
   When this is omitted, the KEYMACRO can match non-data generating keys.
   Use the constant ANY_KEY to match anything (make sure the rest of the match
   describes other properties of the key). A lone ANY_KEY will truly match
   every key.

+LShift
   The left shift key must be down, or the KEYMACRO does NOT match.

+RShift
   The right shift key must be down, or the KEYMACRO does NOT match.

+Shift
   One of the shift keys must be down, or the KEYMACRO does NOT match.

-Shift
   None of the shift keys may be down, or the KEYMACRO does NOT match.

When nothing is mentioned about Shift at all, the state of the shift keys is irrelevant.

+LCtrl
   The left CTRL key must be down, or the KEYMACRO does NOT match.

+RCtrl
   The right CTRL key must be down, or the KEYMACRO does NOT match.

+Ctrl
   One of the CTRL keys must be down, or the KEYMACRO does NOT match.

-Ctrl
   None of the CTRL keys may be down, or the KEYMACRO does NOT match.

When nothing is mentioned about Ctrl at all, the state of the CTRL keys is irrelevant.

+LeftAlt
   The left ALT key must be down, or the KEYMACRO does NOT match.

+RightAlt
   The right ALT key must be down, or the KEYMACRO does NOT match.

+Alt
   One of the ALT keys must be down, or the KEYMACRO does NOT match.

-Alt
   None of the ALT keys may be down, or the KEYMACRO does NOT match.

When nothing is mentioned about ALT at all, the state of the Alt key is irrelevant.

+CAPS
   The CAPS LOCK key must be on.

-caps
   The CAPS LOCK key must be off.

When nothing is mentioned about CAPS, the state is irrelevant.

+NUM
   The NUM LOCK key must be on.

-num
   The NUM LOCK key must be off.

When nothing is mentioned about NUM, the state is irrelevant.

+SCROLL
   The SCROLL LOCK key must be on.

-scroll
   The SCROLL LOCK key must be off.

When nothing is mentioned about SCROLL, the state is irrelevant.

+SCAN XX
   The XX must match the hexadecimal scan code for the key (can be more than
   2 digits), this can be used to differentiate between 2 otherwise identical
   keys (such as PgDown on the numeric keypad and the "normal" PgDown key).
   When SCAN is not used, it is irrelevant  which key is used.
   Use keyboard debugging to find the particular scan code of a key, or turn
   on the "Scan code" flag in the keyboard macro setup. If you want to match
   a data key on scan code instead of name, use a combination with ANY_KEY:
   KEYMACRO "ANY_KEY+SCAN 4A"
   will work.

+KBSTATE XX
   The keyboard state is a bit pattern that describes the state of all
   modifiers such as Ctl, Caps, Scroll lock, num lock and so on.
   It can be used to match odd combinations. Seldom used.
   Use keyboard debugging to find the particular code, shown as "Cntl".
   Only used in scripts, never generated by IVT itself.
   
+VIRTUAL XX
   The Windows virtual key code for a key (can be more than 2 hex digits).
   It can be used to match odd keys, or in combination with ANY_KEY.
   Use keyboard debugging to find the particular code, shown as "Virtual".
   Only used in scripts, never generated by IVT itself.

Note that you can have a keymacro for "F8" and another for "F8+Shift".
The first one says nothing about the state of the shift keys, so it matches when you press F8 and shift. However, the SECOND one matches better, so when given the choice, IVT will use the best match.

To complicate matters yet a little more, you can have KEYMACRO definitions on the global level (from normal lines in an IVT.RC file) and on the session level (either from PRECONNECT or ONCONNECT scripts or marked as "session only" when the key was defined using the recorder).
When searching these lists, the best match wins, so if you define "F8" on the session level and "F8+Shift" on the global level, a lone F8 will match the session macro, a shifted F8 will match the global macro.

Perhaps needless to say, but the combination of all the settings in the key description, plus the power to invoke internal functions or scripts that use the IVTFUNCTION and whatever logic you care to program, allows you to make very flexible keyboard mappings. It can also confuse users to no end if you use all these possibilities in an entertaining mix :-)

Examples:

See also learning mode and keyboard macros and LOAD. See also KEYNAME and SEND.
See also CAPSLOCK (to disable the CAPS lock key).


12.3.79: KEYNAME (Program VT220 keys)


KEYNAME stringexp

This command is deprecated: see KEYMACRO instead.
This is a per-session setting.

Programs KEYNAME to stringexp. The KEYNAME must be the name of a valid VT220 function key. If this is used in an IVT.RC file, the key will be programmed in ALL sessions. When used in a SCRIPT, it will only apply to the current session. Examples:


   NXTSCR "ls -lab\r"
   F6 Hello
   REMOVE "\7F"

This will program the PageDown key to send the Unix command 'ls -lab RETURN'.
The VT220 function key F6 will emit the string "Hello".
The VT220 function key "Remove" (mapped to the PC "Del" key) is programmed to emit a single DEL character.
Also, see the keyp program for Unix, which allows the host to (temporarily) program the IVT keys.

Note that the keyboard can be reprogrammed in SCO-ANSI mode instead of the default VT220 keyboard map. Keys programmed in the way shown here will work regardless of that setting!

See also BIND (to tie a key to a script) and keyboard macros.
See also KEYMACRO.

Attention: Previous versions of IVT allowed no quotes in the stringexp, but version 18.1 of IVT now forces a more logical and consistent syntax. When you omit the quotes, you can have only a single word. When you need embedded spaces, use the quotes. When you want to emit a quote, use a backslash to escape it.


12.3.80: KEYPADMODE (change numeric keypad behavior)


KEYPADMODE NORMAL|APPLICATION|BLOCKED


Default: NORMAL

A VT220 terminal can operate the numeric keypad in two modes:

IVT shares this multiple use with Windows, where the extra numeric keypad can be operated in numeric mode and as an alternative for PgUp, PgDown, cursor keys and so on. Furthermore, the top row of the numeric keypad (the Num Lock, /, * and - keys) can be configured in IVT to be the VT220 PF1 - PF4 keys (not to be confused with F1 - F4). Then there is 7 or 8 bit mode, which further determines what actual codes will be sent.

All of this can be a bit confusing, since there are many different sets of codes emitted by the keys on the numeric keypad:

Confused? Just experiment with the various settings until you get what you desire. When an application requires the "Application" mode, it should set this by means of this escape sequence (ESC =) explicitly.
When absolutely necessary, things can be forced out of kilter by:



ONCONNECT * ForceApplicationMode
Script ForceApplicationMode
   VTECHO "\1B="
END

Add this to your IVT.RC file, and it will make IVT think that every host it connects to sends the string to switch into application mode as the very first thing.
BTW, "\1B>" will switch back into numeric mode.

The BLOCKED setting means that IVT will ignore all attempts by the host to set the keypad mode to APPLICATION. This is required because hosts exists that will send the command to set application mode but then do not recognize the codes that are actually emitted in that mode. Since plain numeric values are always recognized, setting it to 'BLOCKED' means the numeric keyboard will work.
Note that even the VTECHO trick shown above will be ignored when the mode is set to BLOCKED.

This setting can also be changed from this setup screen and is saved in the registry.
Note that when you change this setting in a script, it is probably a good idea to use VOLATILE.


12.3.81: LANGUAGE_FILES (Add extra translation tables for scripts)


LANGUAGE_FILES "pathname-expression"

Default: None.
This is a global setting.

IVT is a multi-lingual program, and extends the support for those multiple languages to the scripts that you write yourself. Many items in IVT can be translated fully automatically because IVT knows the context of the text.
The AutoPrompt system of IVT is entirely written in the script language of IVT.
It is used here as an example of how to achieve the automatic switch to any supported language (there is a dialog to configure it, an item on the menu bar, and various popups and error-messages that can be displayed, all in the currently selected language. Click here to go straight to the example.

The NLS() function uses the translation tables that come with IVT (in the Languages subdirectory) to provide texts in all supported languages.
The LANGUAGE_FILES statement can be used to teach IVT the location of your own files and directories with translation tables. Every time the NLS function is used, the system searches the translation tables for a named item (the 1st parameter of the NLS function) given the currently selected national language, the current script name and so on. If it can find a translation, that is returned. If no translation can be found, the 2nd parameter of NLS is returned (which is intended to be the original English text).

In detail, the rules are as follows:

Every translation file can have the following types of lines:

The "AutoPrompt" system serves as an example of how to write a multi-lingual script that interacts with the user in various complex ways.
Follow the above link to see the low-level details. The gist is:

It may be instructive to study the source of AutoPrompt.ivt (part of the distro), and the translation tables in the Languages/Dutch directory of IVT.

Using this system, any script can be created to use any existing language.


12.3.82: LAST_POSITION (Restore last position and size)


LAST_POSITION
NO_LAST_POSITION

Default: LAST_POSITION
This is a global setting.

IVT will, by default, restore the last size and position of the window when it starts up. This can be suppressed using NO_LAST_POSITION, in which case the configuration will determine the startup size (see WINDOW_SIZE).

When a size is saved as part of the default profile, or the user has an explicit command in a private configuration file specifying a default window size, the last saved position is ignored automatically.

Currently, there is no interactive setup item for this.
See also LAST_PROTOCOL.


12.3.83: LAST_PROTOCOL (Restore last protocol on startup)


LAST_PROTOCOL
NO_LAST_PROTOCOL

Default: LAST_PROTOCOL
This is a global setting.

IVT will, by default, restore the protocol of the last session that was created when it starts up. This can be suppressed using NO_LAST_PROTOCOL, in which case the configuration will determine the protocol (see PROTOCOL).

Currently, there is no interactive setup item for this.
See also LAST_POSITION.


12.3.84: LEAVE_COPY_SELECTION (Leave selected area visible)


LEAVE_COPY_SELECTION
NO_LEAVE_COPY_SELECTION

Default: NO_LEAVE_COPY_SELECTION.
This is a global setting.

Copying and pasting in IVT is, by default, different from most other applications. Applications like X-windows and PuTTY will allow you to select an area with the mouse, and when you release the mouse button, will leave the selected area visible on screen.
I think that is wrong - the only thing the application can do with the selected area is to copy it to the clipboard - you cannot cut from an SSH or TELNET application, and there is nothing else to do with selected text.
Permanently changing the contents of the screen is, IMHO, simply wrong.

So, by default, IVT will remove the selection from the screen and do the COPY operation as soon as you release the mouse.

However, many people are so used to the way other applications handle selection of text that they think they do something wrong when they release the mouse and the selected area disappears. Even worse, some think IVT does something wrong :-)
The MOUSE_SELECTION command can be used to configure IVT to use the more common PuTTY/XTERM selection method.

So, the LEAVE_COPY_SELECTION setting will cause IVT to do what others do, more or less. The selection is left on-screen, but still removed as soon as the contents of the screen is updated. You can select from the scroll back buffer and scroll around, and the selection is left intact. You can switch to other sessions, and the selection will be left intact. Multiple sessions can have their own selections visible.
This allows you to use the mouse as a sort of highlighter.
A single short click in the session window will also remove any current selection. So will starting a new COPY operation.

BTW: Extending the current selection is usually not done by double/triple clicking, but by clicking the right-hand button while the left is KEPT DOWN. I find this gives a much more reliable way of selecting words, since it does not depend on the timing of the clicks. It also allows a finer degree of control over extending the selection.
But see the MOUSE_SELECTION command to alter this.

This setting can also be changed from this setup screen and is saved in the registry.

NOTE:
This field is one that can be configured using the installation wizard that is automatically started when you install IVT. Because it would give conflicts when you change this both in the configuration file created by the wizard and in interactive setup, this item is disabled in interactive setup.
If you want to change this item, re-run the installation wizard:

Menubar->setup->Re-run initial setup script

The wizard has as the first button a "Do not use wizard" feature. If you choose that, all items in interactive setup will be enabled again (and you must configure all the necessary options there and save the setup, or edit the IVT.RC file manually).


12.3.85: LF_IMP_CR (Linefeed implies Carriage return)


LF_IMP_CR
NO_LF_IMP_CR

Default: NO_LF_IMP_CR
This is a per-session setting.

See also here.
Simple option with long history.

When this option is ON, IVT will position the cursor on the first position of the line after receiving a new line character. The default of a VT220 terminal is NOT to do this, and so an explicit carriage return character is required.
Hence the name: LineFeed Implies Carriage return.

Using an CSI 20 h/l escape sequence, the host can also change this setting.

Older versions of IVT refused to save this setting in the registry, as that will break VT220 compatibility (something I take very seriously).
However, hosts exist that assume this setting to be ON without actually TURNING it on, so to accommodate such hosts the setting can now be saved in the registry and be set from the setup language using this statement.

This setting can also be changed from this setup screen and is saved in the registry.


12.3.86: LINK[UN]SELCOL (Color for (un)selected links)


LINKSELCOL   ForeGround BackGround [[BRIGHT|NOBRIGHT] BRIGHT|NOBRIGHT]
LINKUNSELCOL ForeGround BackGround [[BRIGHT|NOBRIGHT] BRIGHT|NOBRIGHT]

This is a global setting.

These command determines the way these manual pages look on screen. There are two ways to display a hypertext link such as this:

You can experiment with the settings using this setup screen. The colors can be specified in words (black, white, etc), or as numbers.
The valid values are in this color table.


12.3.87: LOAD (Loads a learned key-definition file)


LOAD M|RG|L File

Note: Deprecated. Use KEYMACRO or save-to-registry instead.
This is a global setting.

The LOAD command loads a file with keyboard macros into memory. This file must have been previously created using WRITE option of the F4-K screen.

Following the word LOAD there must be a two-character string.
The FIRST character must be one of:

The SECOND character must be one of:

If you want to redefine the keyboard to be ANSI compatible, see SCO_ANSI.

This feature allows you, for example, to program all sorts of strange key combinations using F3-L from setup. After all definitions are to your satisfaction, you save the file and use a LOAD command in your default IVT.RC file to restore those definitions any time you start IVT.
Since version 22 of IVT, macro's are also saved as part of normal setup. Make sure you choose ONE method and not both at the same time, it is easy to lose track of where key definitions come from otherwise.

Most keys can be programmed, even ALT keys that are used by IVT. You lose the standard function, however (unless you move them to other keys first).

Example:


   LOAD MG "$IVTDIR/mykeys.key"

Adds the key definitions in the named file to the global list (so they work in all current and future sessions).

NOTE: This version of IVT also allows you to simply use "save" in setup to save the entire setup, including programmed keys, into the registry.
This is much easier, but does not allow you to share those programmed keys with other users.
Programming explicit KEYMACRO statements in an IVT.RC file is the most portable and maintainable way (and hence the preferred way).


12.3.88: LOCKTIMER (Locks keyword with PASSWORD after N minutes)


LOCKTIMER num

Default: 0 (off).
This is a global setting.

Auto-lock keyboard after num minutes. IVT will start a countdown 30 seconds before the keyboard is locked, unlocking is done by typing the correct PASSWORD. The timer can be set using the setup screen, and so can the password.
A locked keyboard will cause a keys-icon to appear in the status bar and only a valid password followed by return will unlock it. Typing RETURN without a valid password preceding it will sound the BELL.

The keyboard can be locked manually using ALT+L.
This feature works only when a password is defined to unlock it.


12.3.89: MOUSE (Configure left/right mouse buttons)


MOUSE OFF
MOUSE SUPDUP
MOUSE XTERM
MOUSE XTERM2
MOUSE CURSOR
MOUSE VI
MOUSE CUTPASTE

Default: MOUSE CUTPASTE.
This is a per-session setting.

MOUSE tells IVT what to do when a mouse is connected and used. In sessions, it can be used for cutting and pasting or cursor positioning.
In this hypertext-help system it can be used to navigate through the manual.

The mode parameter can take the following values:

The default mode is CUTPASTE. It can also be changed from setup. See also the MOUSE_KEY command which can program the mouse.
See also CUTMODE and COPY_STRICT and LEAVE_COPY_SELECTION.
See also COPYSPEED.


12.3.90: MENUBAR (Enable/disable menu bars)


MENUBAR
NO_MENUBAR

Default: MENUBAR (on).
This is a per-session setting.

Menu bars provide an easy way to access the more powerful features of IVT.
The rules are:

For more information, see the separate chapter on menu bars. This setting is per session, and can also be changed from this setup screen.


12.3.91: MOUSE_SELECTION (Select words/phrases with mouse)


MOUSE_SELECTION IVT
MOUSE_SELECTION PUTTY

Default: Chosen at installation time.
This is a global setting.

Traditionally, IVT uses the mouse in a unique way to select words and phrases from the screen (see here for details).
This 2-button technique is timing-independent, and also leaves the screen the way the host has intended it.
PuTTY, and X-terminals, use a double-click, triple-click and even 4-click technique that depends on timing, a steady hand (if you move the mouse too much during the triple-click it is seen as a drag-select) and has to leave the selection visibly on screen (which alters the screen, leaving an image that the host did not put there, which is arguably incorrect).

Lastly, because you continuously keep at least one button down during the IVT style select, it can be combined with keyboard actions to store data in various buffers (letter), to abort the select (ESC), switch between block-select and line-select (F1), print selection (F2) and so on. PuTTY cannot do this because as soon as you release the mouse as part of a double-click, the selection process ends and any keystrokes are destined for the host.

However, many users simply never find out all these advantages. They simply assume double-clicking will work.

To accommodate those users, IVT now can emulate the Xterm and PuTTY behavior.
Setting the mode to PUTTY also enables LEAVE_COPY_SELECTION.
The initial install procedure asks the user his preference.

It uses the Windows double-click speed timer, and extends the selection the way PuTTY would if you click fast enough. During double-clicking, the mouse can stray one line and/or character up, down, right or left and it will not be seen as dragging by IVT.
When you use simple drag-select, all the special IVT keyboard commands during the select still work.

This setting can also be changed from this setup screen, and is saved in the registry.

NOTE:
This field is one that can be configured using the installation wizard that is automatically started when you install IVT. Because it would give conflicts when you change this both in the configuration file created by the wizard and in interactive setup, this item is disabled in interactive setup.
If you want to change this item, re-run the installation wizard:

Menubar->setup->Re-run initial setup script

The wizard has as the first button a "Do not use wizard" feature. If you choose that, all items in interactive setup will be enabled again (and you must configure all the necessary options there and save the setup, or edit the IVT.RC file manually).


12.3.92: MOUSE_EXTEND_TO_LINE (Mouse copy behavior)


MOUSE_EXTEND_TO_LINE
NO_MOUSE_EXTEND_TO_LINE

Default: MOUSE_EXTEND_TO_LINE.
This is a global setting.

When you use the word-selection mechanism (see MOUSE_SELECTION), you can choose to have IVT eventually select the whole line, including a new line.
When you paste such a selection, it also pastes a new line.
With NO_MOUSE_EXTEND_TO_LINE the selection stops just short of a line, so you will have to type the new line manually.

This setting is global, and can be changed from this setup screen.
The current setting is also saved in the registry.

Older versions of IVT did not have this, so if you dislike the new default behavior you can restore the old functionality.


12.3.93: MOUSE_KEY (Configure mouse in combination with keyboard)


MOUSE_KEY BUTTON KeyBoardKey MouseAction [CALL Script [args...] ]
MOUSE_KEY BUTTON KeyBoardKey MouseAction ["data"]

MOUSE_KEYLOC BUTTON KeyBoardKey MouseAction [CALL Script [args...] ]
MOUSE_KEYLOC BUTTON KeyBoardKey MouseAction ["data"]

MOUSE_KEYLOC CANCEL
NO_MOUSE_KEYLOC

This is a per-session setting.

MOUSE_KEY programs the mouse buttons in combination with special keyboard keys such as CTRL and ALT. Press such a special key and click one of the mouse buttons and IVT will take a special action. IVT has a few very handy built-in special MouseActions, but you can also call your own scripts.

For example, you might want to use VI mode cursor positioning and enter insert mode when you keep the left CTRL key pressed while using the LEFT mouse button. This will move the cursor to the clicked position using VI commands, and then send an "i" to start inserting text:


   MOUSE_KEY BUTTON1 LEFTCTRL VI "i"

Or you want to trigger a special script when an unlikely combination of keys is used:


   MOUSE_KEY BUTTON2 LEFTALT&RIGHTSHIFT&SCROLLLOCK NONE Call MyScript

The NONE means that IVT does not perform a built-in action, only the user- defined script MyScript is started.

The full possibilities of this statement are as follows:

The valid words for the KeyBoardKey are:

CTRL Any CTRL key
LEFTCTRL The left-hand CTRL key
RIGHTCTRL The right-hand CTRL key
ALT Any ALT key
LEFTALT The left-hand ALT key
RIGHTALT The right-hand ALT key
SHIFT Any SHIFT key
LEFTSHIFT The left-hand SHIFT key
RIGHTSHIFT The right-hand SHIFT key
SCROLLLOCK Activated SCROLL LOCK key
NONE No key at all (replacement for MOUSE command)

The valid words for the MouseAction are:

COPY Initiates a COPY operation
CUT Same as COPY.
PASTE Pastes the default buffer
VI Positions cursor VI style
CURSOR Positions cursor using single cursor motion commands
XTERM Sends XTERM style mouse action
SUPDUP Sends SUPDUP style mouse action
NONE Does nothing

MOUSE_KEY statements are examined for every mouse action in the order that they are defined. This can be significant since only the first matching statement is executed. If you define a SHIFT first and an LSHIFT later, the LSHIFT is not going to be seen since the SHIFT will match either shift key...


12.3.94: MOUSE_NOXTERM2 (Disable support for XTERM2 mouse mode)


MOUSE_NOXTERM2
NO_MOUSE_NOXTERM2

Default: NO_MOUSE_NOXTERM2
This is a per-session setting.

The new XTERM2 support in IVT causes different responses to be sent to the host when the mouse is used. Old applications (like CSCOPE) did not expect this change and misbehaved. By setting this option, the command to turn the XTERM2 mouse mode on (CSI?1000h) is interpreted as CSI?9h, the old X10 mouse mode.

Try toggling this option when you have text-based applications that use the mouse but it does not work as expected.
But really, you should get your apps updated if you need this!

This option is per session, can be set in this setup screen, and is also saved in the registry.


12.3.95: MOUSE_PUTTY_WORDS (Putty compatible word selection)


MOUSE_PUTTY_WORDS
NO_MOUSE_PUTTY_WORDS

Default: NO_MOUSE_PUTTY_WORDS
This is a global setting.

For a detailed explanation, see next chapter on MOUSE_PUTTY_SELECT.
The MOUSE_PUTTY_WORDS setting means IVT will use the character-class based word-selection algorithm that Putty uses.
The NO_MOUSE_PUTTY_WORDS means IVT will use its built-in word/phrase selection algorithm that requires multiple clicks before an entire line is selected.
In the putty-compatible setting, a triple-click will always select the entire line. In the IVT setting this can take up to 6 clicks.

This setting is saved in the registry and can also be changed in setup.
See also MOUSE_PUTTY_SELECT.
See also MOUSE_SELECTION.
See also MOUSE_EXTEND_TO_LINE.


12.3.96: MOUSE_PUTTY_SELECT (Putty compatible character classes)


MOUSE_PUTTY_SELECT char 0|1|2

This is a global setting.

IVT has several ways to select words and phrases from the screen using the mouse. There is the special IVT way, and there is the Putty-compatible way.
The default is the Putty way, because most people expect it to work that way.
The IVT way is different but more flexible and user-friendly, IMHO.

The Putty multi-click way can be further configured using either the word boundaries that IVT uses, or Putty's (configurable) grouping of characters.
Again, the IVT word boundaries have more flexibility but require more clicks before an entire line is selected.

When you have MOUSE_PUTTY_WORDS enabled (it is disabled by default), this MOUSE_PUTTY_SELECT can be used to configure the selection characters.
The default configuration is the same as in Putty.
The idea is that when you double-click a word, the selection is automatically extended towards the left and right for all characters that have the same "class" as the character you click on.
The "class" is either 0, 1 or 2.
The normal alphabetic characters are "2".
The special delimiters are "1" (hyphens, brackets, parentheses).
All other are "0".

You can change the classification for the "/" (normally class 2) to be seen as a delimiter by:


MOUSE_PUTTY_SELECT "/" 1

The first argument should be a single character string (any form, including a hex-coded format like "\x3F" which is another way of saying "/".
The second argument must be a number, either 0, 1 or 2.

This is a global setting (applies to all sessions).
This setting is saved in the registry and can also be changed in setup.
See also advanced copy and paste with the mouse.
See also MOUSE_PUTTY_WORDS.
See also MOUSE_SELECTION.
See also MOUSE_EXTEND_TO_LINE.


12.3.97: MOUSE_SCROLL_FACTOR/PAGESIZE (Mouse scroll tuning)


MOUSE_SCROLL_FACTOR number
MOUSE_SCROLL_PAGESIZE number

The defaults for these are:


MOUSE_SCROLL_FACTOR 1
MOUSE_SCROLL_PAGESIZE 24

This is a global setting.

When the mouse scroll wheel is used, the display scrolls by the standard number of lines that has been configured in the mouse properties of the system.
Usually, this is 3 lines.
When your window screen is very large (many lines), 3 lines per click feels like a tiny amount. Therefore, IVT adds FACTOR lines for every PAGESIZE lines on the screen.

So, if your window is 48 lines, IVT adds 2 extra lines per scroll action.
When your window 72 lines, IVT adds 3 extra lines per scroll action, etc.

When you press SHIFT while using the scroll wheel, the resulting total number of lines to scroll is multiplied by 3 (turbo scroll mode).

You can tune these numbers to get the best feel when using the scroll wheel.
See also COPYSPEED.

They can also be changed in the mouse setup dialog and are saved in the registry.


12.3.98: MOUSE_USAGE (Show usage in status during select)


MOUSE_USAGE
NO_MOUSE_USAGE

Default: MOUSE_USAGE
This is a global setting.

As is explained in the "Advanced mouse topics" chapter, IVT supports some very powerful copy/paste features that can be real time-savers.
To draw attention to these, the status bar will show a simple usage message when the user starts a mouse-driven select operation.

The message explains the most important keys you can press.
When you already know all there is to know about this topic, you can turn the display of the usage off using NO_MOUSE_USAGE or by using this setup item.

The current setting is saved in the registry.
This is a global setting (same for all sessions).


12.3.99: NATIONALITY (Select national replacements)


NATIONALITY name

Default: US ASCII.
This is a per-session setting.

A VT220 terminal can operate in 7-bit mode, in which case some special diacritical characters cannot be displayed. Traditionally, a VT220 can select that some characters from the standard US ASCII set are to be replaced by a set of national special characters. This makes these original characters unusable. It concerns the #, @, [, \, ], ^, _, {, | and } characters.
Apparently, early DEC engineers thought these characters would not be used much. Later, much better alternatives to getting diacriticals displayed properly came along, such as CODEPAGE and CODEPAGEMOD.

However, some old applications (and especially things running on VMS) demand that this be implemented. For example, a Swedish application will send a '{' character and expect an A-angstrom to be displayed. Therefore IVT has support for national replacement characters.
This is selected by specifying the proper nationality in name, which can be one of:


   US ASCII
   British
   Danish
   Dutch
   Finnish
   French
   French Canadian
   German
   Italian
   Norwegian
   Spanish
   Swedish
   Swiss

Example:


   NATIONALITY "FRENCH CANADIAN"

The string is case insensitive.
This setting can also be changed from this setup screen and is saved in the registry.


12.3.100: NUMERICF1F4 (Configure PF1-PF4 on numeric keypad)


NUMERICF1F4
NO_NUMERICF1F4

Default: NUMERICF1F4
This is a per-session setting.

IVT is a VT220 terminal emulator. These DEC terminals traditionally have four special function keys called PF1 to PF4 (besides function keys named F1-F20).

In some applications, heavy use is made of these keys. A standard PC keyboard usually maps these PF1-PF4 keys to F1-F4 (like IVT normally does). This causes a problem with the DEC keys F1-F4 which provide 'Hold Screen', 'Print Screen', 'Setup' and 'Break' functionalities. On a DEC terminal, the PF1-PF4 keys are located on the top row of the extended (numeric) keypad. On a PC, these are the 'Num lock' key and 'extra' /, * and - keys.
IVT maps the NUMLOCK key to PF1, / to PF2, * to PF3 and - to PF4.

The default is NUMERICF1F4, using NO_NUMERICF1F4 turns this trick off and these keys will behave normally again.

The setting can be changed for the current session only in this setup screen.

NOTE:
If you ONLY want to change the status of the NUMLOCK key without generating a PF1, use SHIFT+NUMLOCK. IVT will ignore that combination.
Also, Ctrl-F1 to Ctrl-F4 also generate PF1-PF4, and you can swap the F1-F4 and Ctrl-F1 to Ctrl-F4 using F1F4.

NOTE 2:
Pressing the num-lock key has side effects which can be quite annoying.
See NUMLOCK_CORRECTION for details.


12.3.101: NUMLOCK_CORRECTION (Undo typing NUM-LOCK)


NUMLOCK_CORRECTION "Off"
NUMLOCK_CORRECTION "Down/Up"
NUMLOCK_CORRECTION "Up/Down"
NUMLOCK_CORRECTION "Down"
NUMLOCK_CORRECTION "Up"

Default: "Down/Up"
Default: "Down" (in RDP session)
This is a global setting.

This setting is used only when NUMERICF1F4 is on and the user types the NUMLOCK key, which then functions as the PF1 key of a VT220 terminal.

However, the NUMLOCK key is normally a non-data generating key that often has a LED-indicator on the keyboard to indicate numlock-on or numlock-off.
When "on", the numeric keys on the keypad  generate digits.
When "off", the numeric keys on the keypad generate cursor-keys and various other special keys, depending on nationality and physical keyboard.

The problem with using NUMLOCK as PF1 is that every time you use it, you also switch the state of the keypad as an unwanted side-effect.
To undo this, IVT internally generates a SECOND numlock keystroke, so the user types the key and the light goes off, IVT generates a keystroke to turn it back on (and of course ignores that self-generated, fake keystroke).
There is no other way in Windows to change the state of the NUMLOCK directly, it has to be done using fake keystrokes.

This normally works fine, EXCEPT when using IVT in an RDP (remote desktop) session. The extra IVT-generated keystroke sometimes works fine, but it may result in a double PF1, ghost-PF1 keystrokes when switching from/to the RDP session, an indicator that is on but the keyboard does not generate numeric keystrokes or vv., and various other more-or-less funny effects.
The behavior also depends on the physical keyboard, version of Windows that IVT runs on and the version of Windows you use to start the remote session. Oh joy :-)

I have been unable to make NUMLOCK work as a reliable data-generating key without side-effects. This NUMLOCK_CORRECTION is the best I could come up with.
The settings are as follows:

So: Give it a try and see what works best. This setting can also be changed in setup and is saved in the registry.
It can also be changed in a script, note the $IVT_INFO hash that may be used to see what environment IVT is running in.

Note that if all tricky down or up combinations fail, you can change it to "off", so IVT does no trickery at all. NUMLOCK will work like a PF1 key, but the keyboard (and LED if you have it) will toggle every time you use it.
You'll have to use Shift+NUMLOCK to change the keyboard to the desired state if you want to use the numeric keypad.


12.3.102: PASSWORD (Set password for keyboard lock)


PASSWORD word

Default: Not used.
This is a global setting.

Used to unlock a locked keyboard. When the keyboard is locked, the status line will show the lock icon, nothing can be typed except a valid password.
See LOCK.

The password can be either a simple string (which is not very safe) or an encrypted string. See LOCKing for a description of generating an encrypted word to put in your configuration file.

Alternatively, you can put the PASSWORD directive in an INCLUDE file that you then encrypt.


12.3.103: PASTE_LAST_NL (remove trailing newline when pasting)


PASTE_LAST_NL
NO_PASTE_LAST_NL

Default: PASTE_LAST_NL
This is a global setting.

This option determines what will happen when you paste content into an IVT session. When the contents (usually the clipboard) ends in a (series of) new lines or carriage return characters, IVT will usually send those characters to the host. When you paste something on the command line, that means the commands will be executed immediately (the host sees an ENTER).

When you use NO_PASTE_LAST_NL, then IVT will remove all trailing carriage return and new line characters before pasting. That means that in some cases you will have to type an extra ENTER to have something executed, but you will not be surprised by an unexpected ENTER that starts some process on the host that you did not intend.
As an example: when you select a single cell in Excel and copy it to the clipboard, Excel adds a new line even if the cell contains a single word.

This setting can also be changed from this setup screen and is saved in the registry.


12.3.104: PASTESPEED (regulate paste speed)


PASTESPEED lines maxbytes maxdelay CR-Only

Default: PASTESPEED 3 10000 100 NO
This is a per-session setting.

When you paste a large amount of information in a session, IVT pretends the information is typed in. However, not all hosts (and/or applications) are designed to process that information at the speed a modern PC can transmit it.
Since it is simulated keyboard input, at some point the buffers can overflow and you lose (part of) the data.
AIX is especially subject to this and logs "TTYHOG OVERRUN" in the system log when this happens.

To guard against this, IVT will not paste at full speed, but it will transmit a certain maximum number of lines, and then wait for something to be returned by the host (since you usually paste into some application that echoes the data that you type, something usually comes back).
The number of lines sent is counted, and IVT will wait for that number of lines to be returned by counting echoed CR (carriage return) characters.

If NOTHING comes back (or not the expected number of CR characters), IVT will wait for a maximum of maxdelay milliseconds before transmitting the next number of lines anyway.

Note: When CR's are received before the timeout expires, IVT will send the next batch of characters immediately. The idea is that when the data has made it to the destination application and all the way back, the buffers will be ready for more. The timeout should be big enough for a normal echo to be able to make it, it only slows down things when there is no echo at all or the system and/or network is very slow. When you paste data into a "black hole" the maxdelay parameter will determine how fast the data is sent.

When your pasted data has no carriage-returns in them (or the lines are very long), IVT counts 128 bytes as being a "line". The maximum number of lines you can set is 1000.

Note: When you paste into applications such as VI, it may be that your CR characters are not echoed, but translated into character-positioning commands that IVT cannot relate to the actual data being sent. Since it does not see the CRs, the timeout parameter will determine the speed of the paste.
If you need to paste large amounts of data and suffer from truncated data (or AIX TTYHOG overruns), paste into a "cat > file" command instead, that will result in a simple echo.

The maxbytes setting can limit lines to a certain length. Some extremely badly configured systems may even choke on a single line of (say) 50 bytes. When you set the maxbytes to (say) 10, IVT will shorten a single packet to that many bytes. The 10000 setting means that IVT will normally not truncate lines this way. The most extreme setting is 1, which means every single byte of data is transmitted in a single packet. This may slow things down severely for large pastes. A value of less than 1 is silently adjusted to 1. The maximum value is 10000.

The CR-only setting only applies when the number of lines is 1. It can either be set to YES or NO.
Normally, IVT will combine the \r with the line itself, so it gets transmitted as a single packet to the host. When CR-Only is set to YES, a single line will be sent off in a single packet, followed by the \r in another single packet.

So, a slow setting would be:


PASTESPEED 1 10000 100 YES

Send 1 line, wait for a maximum of a tenth of a second (100 Ms), send \r in a separate packet. Lines are not truncated and can be very long, in which case a packet will be sent to the host when it is full (normally 1500 bytes or so).

The slowest setting is:


PASTESPEED 1 1 1000 YES

Which causes 1 byte to be sent, wait for reply for max of 1000 Ms (a second).
The fastest would be:


PASTESPEED 1000 10000 0 NO

Send 1000 lines in a single packet (which will cause IVT to send packets when they are full since you can't fit that many lines in a packet) and do NOT wait.
This means IVT will go at full blast, possibly overrunning your host.

The default settings for this seem to work rather well, so usually there is no need to change them. IVT actually pastes large amounts of data faster than other emulators do (since it combines multiple lines into a single packet) and since it normally waits for a response, there is no risk of overrunning the host.

This setting can also be changed from this setup screen and the current setting is saved in the registry.
This used to be a global setting (affecting all sessions and host) but is a local setting (affecting just the current session) since IVT version 26.1.

See also MERCY_MODE and TCP_FLOOD.
See also XAUTH_DELAY, which works around a bug in SSH.


12.3.105: PRECONNECT (Execute scripts BEFORE session is established)


PRECONNECT hostname [PRIORITY=N] scriptname [arguments]
PRECONNECT     *    [PRIORITY=N] scriptname [arguments]
NO_PRECONNECT  *    [PRIORITY=N] scriptname [arguments]

Before a connection to the named host hostname is made, the script named scriptname is called (with optional arguments).
When you use * as a hostname, the script will be called for ANY hostname.

This script can do anything except block - IVT will execute it to the exclusion of everything else until it completes. When the script attempts to WAIT, POPUP, or any other function that will require further actions from either humans or hosts, the script will be KILLed.
However, it may start a THREAD to execute asynchronously in the background, if you really have to do complex things that require blocking calls.
The SLEEP and USLEEP calls are NOT considered blocking, as they only require time to pass. However, using long sleeps will cause IVT to seemingly hang...

You can have several PRECONNECT statements for the SAME host (or hosts). They will be executed in the order they were defined in, unless you use the PRIORITY option. Lower numbers mean higher priority, so 0 is the highest priority.
By default, IVT assigns a priority of 100000, which allows plenty of room for your scripts to make sure they get called earlier or later in the sequence when you have many. For example, the PROJECTS feature of IVT uses this to make sure its scripts get called earlier than normal.

The NO_PRECONNECT can be used to cancel a previous PRECONNECT. The statement must match the PRECONNECT exactly (same host, script and parameters and priority). See also ONCONNECT.

The purpose of this script is to set some local and/or global variables of which $HOSTNAME can be one. When IVT eventually makes a connection, it will be to the hostname set by this script. The script may also modify the value of the $USER variable.

The upshot is that you can redirect a call from one host to another, or use one host as a stepping-stone to another.
As an example, suppose you have a Unix host that is reachable from a PC box using the TELNET protocol, and you want to talk to a host that can only be reached using SSH-1 (which IVT does not support since it is a deprecated protocol).
In this case, you can do the following:


     PRECONNECT ssh1-host Redirect
     ONCONNECT telnethost TLNHost

     SCRIPT Redirect
        Hidden
        DoRedir = $HOSTNAME
        HOSTNAME = "telnethost"
     END

     SCRIPT TLNHost
        Hidden
        CALL IvtWaitLoggedIn
        IF $DoRedir == "" THEN RETURN
        CALL WaitPrompt
        SEND "exec ssh $DoRedir\r"
        CALL IvtLogMeIn $DoRedir
     END

This will result in the following:

As another example, you can use a PRECONNECT statement to give short nicknames to hosts:


   PRECONNECT * DoSubNet
   SCRIPT DoSubNet
      IF Length($HOSTNAME) > 3 THEN RETURN
      HOSTNAME = "10.8.60.$HOSTNAME"
   END

This will call DoSubNet for ANY hostname, and prefix the hostname with a IP-network when you type a short hostname. This allows you to specify only the last (non-unique) part of the hostname in DNS-less environments.

As a final example, if you want nicknames for hosts:


   PRECONNECT a HostTrans LongNameOfHostA
   PRECONNECT b HostTrans LongNameOfHostB
   ...
   PRECONNECT n HostTrans LongNameOfHostN
   ...
   Script HostTrans LongName
      HIDE
      HOSTNAME = $LongName
   END

Every time a connection is made to a host that matches one of the short names in the PRECONNECT statements, it is translated to the long name.
Note: HOSTLIST also offers nicknames.


12.3.106: RGB (set RGB values for ANSI colors)


RGB Indexnumber Red,Green,Blue

GUI_RGB is an old alias for RGB.
This is a per-session setting.

This version of IVT has full control over the RGB (red, green, blue) values for every chosen color. By default, IVT chooses the 16 ANSI colors to be the same as Windows does, but RGB can be used to modify those.
The Indexnumber must be a value between 0 to 15 inclusive, and denotes the color number to change. The Red, Green and Blue range from 0 to 255 inclusive.
The built-in defaults are:


    0: Black         0          0       0
    1: Blue          0          0       128
    2: Green         0          128     0
    3: Cyan          0          128     128
    4: Red           128        0       0
    5: Pink          128        0       128
    6: Brown         128        128     0
    7: White         192        192     192
    8: Grey          128        128     128
    9: Bright Blue     0        0       255
   10: Bright Green    0        255     0
   11: Bright Cyan     0        255     255
   12: Bright Red    255        0       0
   13: Bright Pink   255        0       255
   14: Yellow        255        255     0
   15: Bright White  255        255     255

There is also a dialog available to pick the colors with a nice color chooser interface, by clicking "Redefine ANSI colors" in the color setup screen.
The RGB triplets can be separated by a comma or a space.

Altered colors are also saved in the registry.


12.3.107: RECONNECT (Automatic destruction of sessions upon logout)


RECONNECT
NO_RECONNECT

Default: NO_RECONNECT.

NO_RECONNECT prevents automatic re-connect of a session to a host when such a session is disconnected. RECONNECT says you want to reconnect disconnected sessions automatically (so you get a new 'Login:' after logging out (from an average Unix host).
Note that sessions connected using the Kerberos protocol cannot be reconnected, since you will not be able to login as someone else (there is no "Login:" prompt, the process is automatic).

NO_RECONNECT will treat the end of the session as the end of the virtual terminal (i.e. as if Alt+F4 had been used, see session management).

The upshot is that ending IVT is easy when NO_RECONNECT is in effect. Logging out from all your sessions will make all virtual terminals disappear.
When the last session is lost, IVT will exit.
When RECONNECT is used, logging out must be followed by ALT+F4 to close the virtual terminal. Personally, I prefer NO_RECONNECT, which is why this is the default.

See also EXPLICIT_EXIT, which treats the LAST session different.
See also RETAIN_SESSIONS, which does not reconnect but keeps the virtual terminal, and allows you to reconnect to a different host.

Note: Like cloning sessions, reconnecting will use the original host and user name to connect, not the result of any rewriting by PRECONNECT and ONCONNECT scripts.

The current setting can be viewed and modified from this setup screen.
It can also be modified from the menu bar.
See also ESC<space>P for host-initiated disconnects.
See also ONDISCONNECT scripts. When RECONNECT is in effect, these scripts are called after EOF has been detected and before a new session is established.
See also WAIT_ONCONNECT.


12.3.108: RETAIN_SESSIONS (Force manual termination of sessions)


RETAIN_SESSIONS
NO_RETAIN_SESSIONS

Default: NO_RETAIN_SESSIONS
This is a per-session setting.

Normally, when you log off from a host, IVT will kill the virtual terminal.
When the last session is closed, IVT will either exit or redisplay the original "create session" dialog (see EXPLICIT_EXIT).

Some users find it inconvenient that the session is lost together with its scroll back history and would prefer to kill each session explicitly. When RETAIN_SESSIONS is used, the session is not closed and also not reconnected.
Instead, it goes into a "zombie" state where the scroll back and copy functions are available and the session must be manually terminated (using ALT+F4, or ESC, the "Close session" command in the menu bar, or by closing IVT altogether).

When you choose "Enter" to reconnect the session, this RETAIN_SESSIONS also allows you to connect to a different host than you originally connected to (it will bring up the "Create session" dialog). The standard RECONNECT behavior is to connect to the original host to simulate a real, serially connected VT220 terminal that will always show the login prompt of a host after logging off.

This setting can also be changed from this setup screen and is also saved in the registry.
See also RECONNECT and EXPLICIT_EXIT..


12.3.109: ROWS (Default number of screen lines)


ROWS num
ROWS num%

This command has been removed, see WINDOW_SIZE.


12.3.110: SCO_ANSI (enable/disable SCO ANSI mode)


SCO_ANSI [KEYBOARD | NO_KEYBOARD]
NO_SCO_ANSI

The default is NO_SCO_ANSI.
This is a per-session setting.

SCO_ANSI enables SCO (Santa Cruz Operation) ANSI compatibility of IVT.
Basically, this will make IVT recognize a number of additional escape sequences, an additional way of drawing lines and boxes on screen and a few extra color settings commands. See SCO ANSI compatibility for details.

Optionally, the keyboard can be reprogrammed by using the KEYBOARD option, which is set to NO_KEYBOARD by default (IVT will emit the normal VT220 keyboard sequences).

There is little harm in having SCO_ANSI on by default (though IVT's default is to have NO_SCO_ANSI to preserve VT220 compatibility), as long as you leave the KEYBOARD setting off.
The keyboard map of IVT is much simpler in SCO ANSI mode, function keys and special keys all emit ESC [ <character>, where the last character is a simple alphanumeric. This differs seriously from a VT220.

Use QuerySetting with "SCO_ANSI" or "SCO_ANSI KEYBOARD" to obtain the current setting.

The SCO_ANSI setting is per session, can be changed from this setup screen and is saved in the registry.


12.3.111: SCREENSAVE (activate screensaver after N minutes)


SCREENSAVE number-of-minutes
SCREENSAVE 0

Default: 0 (no screen save).
This is a global setting.

Blank screen (well - almost) after the specified number of minutes.
A value of 0 will disable the screen saver. Also, when you have reduced the size of the IVT window to only a few lines and columns, IVT won't bother with the screensaver.
This command is really not very useful on modern PC's which have their own way of saving screens, but is retained anyway.

IVT will show a black screen that is empty, save for two lines. The first line says "IVT Screen Saver - n minutes idle" (the number of idle minutes are counted, starting with the value of number-of-minutes).
The line below shows the status indicator which allows you to monitor the activity on all sessions. These lines wander about on the screen to prevent burn-in (which was a problem on old CRT monitors, mostly extinct now).
It is also possible to write your own script that will be called 10 times a second for as long as the screensaver is active. See here for an example.
The output of this script will replace the default IVT display.

The screen saver will terminate (and return to the session) when one of the following events occurs:

When you have a LOCKTIMER active which is set to a longer time than the SCREENSAVE value, the keyboard lock will be activated when its timer expires. However, this is NOT done when the screen-saver is activated from within a non-session screen (like these help-pages, the setup-pages etc.).
The reason is that if you return from the screen-saver with a keyboard-lock into a non-session, there is no status-line to indicate the keyboard LOCK and this could (did) confuse people.

The screen saver timeout can be set from setup. This is not per session, of course, but for IVT as a whole.
Lastly, you can manually activate the screen-saver using SHIFT+ALT+s (remember to release the keys quickly, or otherwise you'll exit from the saver immediately again because the SHIFT or ALT key is down :-)


12.3.112: SCRMODE (Define commands to change screen size)

This command is the old-fashioned form of WINDOW_SIZE. SCRMODE was short for "screen mode", which was a carryover from the MS/DOS days...


12.3.113: SESSION_OVERVIEW (Type of host shown in F4-S)


SESSION_OVERVIEW PHYSICAL
SESSION_OVERVIEW LOGICAL

Default: LOGICAL.
This is a global setting.

The F4-S screen shows details of all your current sessions, one of which is the hostname of the remote host. However, when you use advanced scripts, the host on the other side of the network connection can be just the first in a series of hops, and the user is actually interacting with a different host.
Therefore, IVT usually displays the LOGICAL connection, which is the current content of the $HOSTNAME variable.
When the PHYSICAL setting is used, the hostname or IP-address of the host IVT actually has a session with is displayed here.
In simple cases, these names are identical.

Currently, there is no setup-screen to modify this setting.


12.3.114: SEARCH_CASE_SENSE (Case sensitivity for search default)


SEARCH_CASE_SENSE
NO_SEARCH_CASE_SENSE

Default: SEARCH_CASE_SENSE.
This is a global setting.

When you use the "search" command in IVT to search these manual pages, the default search mode is to have case-sensitive searches. That setting can be changed using the 'c' keystroke command or by toggling the checkbox off, but if you ALWAYS prefer case insensitive searches, you can use this directive in an IVT.RC file.

There is no setup screen for this item.


12.3.115: SESWRAP (Configure behavior of CTRL+CURSOR keys)


SESWRAP
NO_SESWRAP

Default: SESWRAP.
This is a global setting.

In session management it is explained how you can switch between sessions.
The most common way is to use the CTRL+cursor keys to flip from one session to the next (in the same group). With the SESWRAP setting, using a CTRL+cursor key can take you from the LAST session to the FIRST, and from the FIRST to the LAST. When NO_SESWRAP is specified, IVT will NOT wrap around in this way.

Also, remember that SHIFT+CTRL+Cursor can take you to the last or first session immediately.

When you routinely have many sessions, NO_SESWRAP is better because you do not accidentally switch to the first session.

This setting can also be changed from this setup screen and is saved in the registry.


12.3.116: SHOWNEWS (show news screen for new version)


SHOWNEWS
NO_SHOWNEWS

This is a global setting.

When you upgrade IVT on your computer and start it for the first time, IVT detects the fact and shows the F4-N news screen. This lists the new features of the upgraded version so a user can take advantage of them.

However, users of an application that happens to use IVT as part of the infrastructure are not interested in the technical details. So if you deploy IVT to non-technical users, a NO_SHOWNEWS will prevent the unnecessary confusion.

The default is SHOWNEWS, and there is no corresponding setup-screen entry for this, you have to configure it in an IVT.RC file.

See also NO_TIPS.


12.3.117: SIZE4ALL (Resize all sessions simultaneously)


SIZE4ALL
NO_SIZE4ALL

Default setting is NO_SIZE4ALL.
This is a global setting.

The default behavior of IVT is to maintain sizes and window positions for all sessions independently. When you have a default WINDOW_SIZE of 100%, and all sessions are created and kept that way, you would not even notice that.

When you have multiple sessions (remember IVT runs all sessions in a SINGLE window), and resize some of them, paging through the sessions will make IVT jump from place to place, restoring position and size for every session.

Some users find this annoying and would expect a resize to apply to all sessions, not just the foreground one. This can be achieved using the SIZE4ALL option. Resizing a session will resize all background sessions, too.

This only works if the applications running in those sessions can handle such a resize, so Your Mileage May Vary when you use this.
Also, this feature will automatically skip sessions that have the GUI_RESIZE feature set to NO.

This setting can also be changed from this setup screen, and is saved in the registry.

NOTE:
This field is one that can be configured using the installation wizard that is automatically started when you install IVT. Because it would give conflicts when you change this both in the configuration file created by the wizard and in interactive setup, this item is disabled in interactive setup.
If you want to change this item, re-run the installation wizard:

Menubar->setup->Re-run initial setup script

The wizard has as the first button a "Do not use wizard" feature. If you choose that, all items in interactive setup will be enabled again (and you must configure all the necessary options there and save the setup, or edit the IVT.RC file manually).


12.3.118: SIZEFONT (size font when window is resized)


SIZEFONT
SIZEFONT FULL_POINTS_ONLY
NO_SIZEFONT
SIZEFONT NEVER

Default: NO_SIZEFONT.
This is a per-session setting.

Short summary:

For a more detailed description, read on...

SIZEFONT will make IVT fix the number of rows and columns and will adjust the font size instead (the default is to change the number of rows & columns).
Even when you maximize the window, or go FULLSCREEN, the number of rows and columns stays the same.
When you start with a relatively small screen (say 25 rows, 80 columns and the default font of 9 points), then maximize on a large monitor, you'll end up with very, very large characters.

When you resize only one dimension, you'll get an elongated or squished font, this can be prevented by using the FULL_POINTS_ONLY option. In that case, IVT will only select fonts that are expressed in a full point size, so the width and the height of the characters are in proportion, even if it means choosing a different window size than selected by the user.

The default is, of course, to change the number of rows and columns when you resize the window and keep the font the same.

This feature works best when you choose a TrueType base font, as they can be scaled to any required size. Other fonts are rounded off by Windows to the nearest match, and this may result in an adjusted window size (the window border will "snap back" to force a certain minimum size). The "full points" option prevents this to some degree, but it is best to choose a TrueType font!

NOTE: There is a subtle difference between NO_SIZEFONT and SIZEFONT NEVER.
The default NO_SIZEFONT is ignored when a VT220 command is used to switch explicitly between 80 and 132 columns (the only 2 official screen widths of a VT220 terminal). The 132-columns is implemented just like a real VT220 by switching the font to a narrow one. Explicitly sizing to 80 columns keeps the current font and switches the IVT window to 80 characters wide.
The SIZEFONT NEVER setting forces IVT to ALWAYS adjust the window size and never to adjust the font. This can be used if you dislike the narrow font or suffer from side-effects of the switch. Note that this does not break VT220 compatibility one way or the other: IVT ends up in 132 or 80 columns regardless.

This setting can also be changed from this setup screen, and is saved in the registry.
See also FONT and SUBSTITUTE_FONT.
See also ONRESIZE, GUI_RESIZE, ALT_ENTER and SIZE4ALL.


12.3.119: SOFTBLINK (enables/disables software blinking)


SOFTBLINK Blinkrate             (blink rate in milliseconds)
SOFTBLINK 0                     (software blink turned off)

Default: SOFTBLINK 400
This is a global setting.

To simulate blink, IVT simply alternates between two displays; the first displays the normal screen, the second one omits all the blinking characters.
Alternating this 2 or 3 times a second results in blinking. Expensive, but effective. The BlinkRate parameter specifies the blinking speed. The default is 400 milliseconds, valid values are between 100 (blinks ten times a second) and 3000 milliseconds (once every 3 seconds).

When software blinking is not viable on your system, it can be disabled with SOFTBLINK 0. In this case, IVT will change the background color of the text so you at least get a visible difference.
I guess the "expensiveness" stopped being a problem around 1995 or so, any modern PC will not have any problem with this.

The setting can be altered from this setup screen, and is saved into the registry.


12.3.120: SPEED (Set default screen refresh/scroll speed)


SPEED TURBO
SPEED NORMAL
SPEED SLOW
SPEED SLOWER
SPEED CRAWL

Default: TURBO.
This is a per-session setting.

This (sort of) sets the screen scrolling speed.

The current speed is also shown in this setup screen.
TURBO means that the contents of the internal IVT screen-buffer is only shown on the actual screen after the end of every network packet (which can contain many lines).

In NORMAL mode, the screen is synchronized after every line of output.
This makes NORMAL mode scroll much smoother, but TURBO requires less overhead and is therefore faster (but possibly jerky to the eye).

The slow modes can be used to view output very carefully. When you write software that builds complex text-mode screens, much can be learned from watching a screen appear in slow or crawl mode - it gives you a sense of the enormous amount of work it takes to build such a screen. Inefficient output shows up because you see the same patterns drawn several times, etc.

The speed can also be changed by typing ALT+s (slower) and ALT+Q (quicker).


12.3.121: SPLASHTIME (Set maximum display time for splash screen)


SPLASHTIME millisecs

This is a global setting.

The Windows splash screen is displayed for 5 seconds by default. This window is created right after IVT starts up. Some users complained this is too long, so this SPLASHTIME can be used to reduce (or increase) the amount of time the window stays on the screen. IVT has to read the configuration files to find this command, these files might be encrypted, might be on slow network connections, etc., so the logo might be displayed for a while longer but IVT will do its best to limit the time to what you specify.

IVT enforces a maximum of 10000 milliseconds.
The splash screen gets removed automatically when you start typing data into a dialog, such as the prompt for a hostname or a password during start-up.

If you want to disable the splash screen altogether, use the -B command line option. An OPTIONS statement can also use the -B flag.

Another way to suppress it is to have a "nosplash" file in the current directory.


12.3.122: STATBORDERS (Show separators in GUI status line)


STATBORDERS
NO_STATBORDERS

This is a global setting.

The status line can be displayed in 2 styles: with little divider separator lines (borders), or without.
The default is to display them. Use NO_STATBORDERS to turn them off.
Depending on personal taste and the version of windows, the borders of the status bar differ in style and appearance.

There is also an option to the STATUS command to change this.

You can also change this setting in this setup screen.
The current setting is saved in the registry.

To query this setting, use QuerySetting("STATUS BORDERS").


12.3.123: STATMIDDLE (What to display in middle of status line)


STATMIDDLE OFF
STATMIDDLE CLOCK
STATMIDDLE DATETIME
STATMIDDLE CURSORPOS
STATMIDDLE MOUSEPOS
STATMIDDLE ELAPSED

Default: CLOCK.
This is a global setting.

This determines what gets displayed in the middle of the status line.
Choices are:


OFF       - Nothing
CLOCK     - Current time (hours:minutes, 24 hour clock)
DATETIME  - Current date and time (YYYY/MM/DD hours:minutes, 24 hour clock)
CURSORPOS - Current cursor position
MOUSEPOS  - Current mouse cursor position
ELAPSED   - Elapsed time since session was created

The current setting can be changed by clicking on the relevant part of the status line or from this setup screen.
CLOCK shows the time, DATETIME shows date and time (handy if you use FULLSCREEN all the time and there is no Windows taskbar visible).
See also STATUS, STATUSCLICKS and STATMIDDLE.

NOTE:
This field is one that can be configured using the installation wizard that is automatically started when you install IVT. Because it would give conflicts when you change this both in the configuration file created by the wizard and in interactive setup, this item is disabled in interactive setup.
If you want to change this item, re-run the installation wizard:

Menubar->setup->Re-run initial setup script

The wizard has as the first button a "Do not use wizard" feature. If you choose that, all items in interactive setup will be enabled again (and you must configure all the necessary options there and save the setup, or edit the IVT.RC file manually).


12.3.124: STATUS (Enable/Disable the status line).


STATUS
NO_STATUS
STATUS BORDERS
STATUS NO_BORDERS
STATUS [OLD|NEW] (Deprecated)

This command turns the status bar on or off and determines the style.
This version of IVT no longer supports the old text-mode status, but only the GUI one with icons and so on. So the old/new setting is ignored.

Using the NO_BORDERS option creates the status bar without the little divider lines on it between the fields (which are on by default).
The BORDERS keyword can be used to force these dividers on.
See also STATBORDERS.

A screen print will also print the status bar in the same fashion as on-screen when PRSTATLINE is in effect.

The status bar displays this information.
See also STATUSCLICKS and STATMIDDLE.


12.3.125: STATUSCLICKS (Enable/disable mouse on status line)


STATUSCLICKS
NO_STATUSCLICKS

Default: STATUSCLICKS
This is a global setting.

Normally, you can use the mouse to click on the various fields of the status line. When you use the NO_STATUSCLICKS option, this feature is disabled.
This prevents the user from altering the text, switching sessions, or entering the help-system (by right-hand clicks).
Tooltips are also suppressed in this mode.
See also the secure option.

There is no way to change this setting from a setup-screen.
See also STATUS and STATMIDDLE.


12.3.126: SMOOTH (smooth scrolling)


SMOOTH ms [Pixels]

GUI_SMOOTH is an old alias for SMOOTH.
Default: SMOOTH 0
This is a per-session setting.

Smooth scrolling is a graphics trick where lines scroll smoothly pixel for pixel instead of a line-at-a-time.
You can set the delay in milliseconds and the distance in pixels for every partial scroll operation. The default for ms is 0, which turns it off.
A value of 1 gives the "fastest" smooth scroll, since this will enable smooth scrolling without delaying per-pixel.
Higher values will sleep the specified number of milliseconds.
A value of 10 gives a very stately form of display.

This feature can be very CPU intensive - Your Mileage May Vary.
By increasing the number of Pixels per partial-scroll operation, fewer steps are required to scroll a single line, thus increasing the total speed.
Low values of Pixels are silently adjusted to 1, high values are silently adjusted to half of the current font height. The default (when omitted) is 1.
The fastest setting is thus SMOOTH 1 1000, which soft-scrolls half lines without sleeping.

Active WINDOWS are temporarily removed from the display before smooth-scroll is performed, since those are meant to be stationary.

This feature is mainly intended to increase the VTTEST score of IVT by a further point, since few people will (I think) actually want to use this by default. It is, however, a standard feature of a VT220 terminal.

The host can control this setting using CSI ? 4 h/l, which will set the delay to 10 Ms and leaves the Pixels value unchanged.

It can also be changed from this setup screen, and is saved in the registry.

If you want to query the current setting using QuerySetting:


12.3.127: SUBSTITUTE_FONT (for line drawing characters)


SUBSTITUTE_FONT "font description"

The default for this is "Facename=Lucida Console".
GUI_SUBSTITUTE_FONT is an old alias for SUBSTITUTE_FONT.
This is a global setting.

As explained in the section on FONT, there exist fonts that do not contain the line-drawing symbols required by IVT. If you choose such a font (Terminal and Fixedsys being notorious ones), older versions of IVT would display the wrong characters in the places where line drawing was needed.

Version 16.2c of IVT introduces a clever trick - those line drawing characters are selected from a decent, scalable font like Lucida, scaled to the exact same size as the chosen font. IVT automatically determines the necessity for this by examining the actual shapes of the symbols in the user-selected font.

Since "Lucida Console" may not be available everywhere, it is not hardwired into IVT but can be changed using the SUBSTITUTE_FONT statement.
You should know what you are doing when you change this, and the font you specify MUST be a scalable, decent font.
It is used for both the screen and printer font, when you select a font for the printer that does not contain proper line-drawing characters.

It is NOT saved in the registry, and can NOT be changed from setup. If you want to change the default you have to edit the IVT.RC setup file and make sure you use proper syntax for a font.


12.3.128: SMART_PASTE (Translate common Unicode characters on Paste)


SMART_PASTE
NO_SMART_PASTE

Default: SMART_PASTE
This is a per-session setting.

If you copy text to the clipboard from (say) a Word document and paste it into an ASCII session using IVT, it will try to convert some Unicode characters placed on the clipboard by Word into their common ASCII counterparts.
A common case is where you document Unix commands in a Word document. Say you type:


rpm -Uhv package.rpm

in Word. It will translate the "minus" into a Unicode "Em dash", a slightly longer dash, which "looks nice" on screen and when printed.
But when you try to PASTE the "Em dash" into an ASCII session, it can't do that because the character is not in the normal ASCII set.
Older versions of IVT used to paste a "." in such cases. Later, it was made smarter by translating a number of such common characters back to their logical ASCII counterparts. The table is, among others:

Into the logical minus, single quotes, double quotes and so on. The upshot is that copy/paste from Word documents "just works", and most users never even notice that IVT is doing this, UNTIL you try to paste into a Unicode session. Older versions of IVT would then paste the full Unicode text into the Unicode session, preserving the special dashes and quotes (which seemed like a logical thing to do).
However, pasting into a shell command line will then fail. For example, the RPM example command above will give an error message because it wants a minus, not an "Em dash".

So, the SMART_PASTE will perform the SAME ASCII translation, even on a session that is in UTF-8 (Unicode mode).
The setting is on by default, you only need to turn this off if you want to paste into an application on the host that actually understands Unicode.

This setting can also be changed from this setup screen. It can be saved into the registry.


12.3.129: TABSBAR (Enable the TABBED interface)


TABSBAR [Option],...
NO_TABSBAR


Options:


CLOSE_ICON    | NO_CLOSE_ICON
CONFIRM_CLOSE | NO_CONFIRM_CLOSE
ADDTAB        | NO_ADDTAB
MULTILINE     | NO_MULTILINE
EXTENDED      | NO_EXTENDED
FONT "description"
ACTIVITY
NO_ACTIVITY
USER_HOST
HOST_USER
HOST
USER
SEQNO
NO_SEQNO
SIZEADJUST Adjust

Default:


TABSBAR CLOSE_ICON,USER_HOST,CONFIRM_CLOSE,ADDTAB,NO_MULTILINE,SIZEADJUST 2
TABSBAR NO_SEQNO
TABSBAR ACTIVITY


This is a global setting.

The TABSBAR allows yet another, intuitive way to switch between sessions in IVT. It is on by default. Use NO_TABSBAR to turn it off.

The options are:

A script can also use the SetTabText() function. Once it has done this, the text supplied that way overrules any default. By setting the empty string, IVT will display the default again.

When you use application groups, every group gets its own logical tabs bar.
When you switch between sessions in different groups, the tabs are updated accordingly.

A script can use the SetTabIcon() function to set a different icon, in which case it will also have to use ONTABICON to indicate what should happen when the icon is clicked. IVT itself will take no action when a user-defined icon is clicked.

This setting can also be changed from setup and the current setting is saved in the registry.
See also COLOR_TAB_SELECT.


12.3.130: TITLEBAR (Set Window title)


TITLEBAR "A fixed string of text"
TITLEBAR COMMENT
TITLEBAR HOSTNAME
TITLEBAR XTERM_CLEAR
TITLEBAR SESSION "Private session string"
TITLEBAR DEFAULT

This command sets the contents of the Windows title bar of IVT.
The default is "IVT Secure Access".
This is a global setting.

If you choose the first form, the specified text will replace the default for all sessions.
If you choose COMMENT, the title bar will show the comment field from the status line (and will change as you switch between sessions).
The HOSTNAME command will cause the name of the host as displayed in the status line to be displayed (and will change as you switch sessions).
If you choose DEFAULT, the global default string will be restored.

If you use SESSION "String", a private string is displayed for the current session only (separate from the comment in the status line).
This form can, currently, only be used in a script. To revert back to the normal title bar, set the SESSION string to an empty string, like so:

   TITLEBAR SESSION ""

You can also change the title bar settings from this windows setup screen.
Also see XTERM set window title command.
This allows you to set the title from the host.
The XTERM_CLEAR command can be used to clear any such title, which is handy if you have hosts which insist in trying to set the title.

When the user does an interactive resize, the title bar will show the resulting number of rows and columns. The chosen title is restored as soon as the resize operation ends.


12.3.131: TOOLTIPS (Show tooltips for status bar)


TOOLTIPS InitDelay Duration
NO_TOOLTIPS

Default: TOOLTIPS 300 3000
This is a global setting.

When you hover the mouse over the fields on the status bar, a small window explaining the purpose of the field or icon will display after the mouse is over the field for more than InitDelay milliseconds. Nothing will happen if you move the mouse out of the field before that time.

When the tip appears, it will disappear after Duration milliseconds.
The defaults for this are 300 for InitDelay and 3000 for Duration.
Any mouse click will also kill the tooltip window.

Use NO_TOOLTIPS to turn the tips off.
You can also change the settings in this setup screen, where you can use a value of zero for either field to turn tooltips off.

The current settings are saved in the registry.


12.3.132: TRANSPARENCY (Set window transparency)


TRANSPARENCY percentage

Default: TRANSPARENCY 0
This is a global setting.

Transparency of a window means that you can "see through" the IVT window and see the underlying windows and the desktop. The percentage must lie between zero and 100. A value of 0 turns this feature off. Higher values mean higher transparency, a value of 99 means IVT is almost invisible, a value of 1 means it is almost solid (normal).
Using 100 actually makes the window invisible. This can be convenient if you want to hide the actual window from the user.

Turning transparency on means your computer has to calculate the color values for every pixel from all underlying windows and desktop, which gives a very noticeable drop in performance when IVT is scrolling lots of text in a large window, so only turn this on when you have enough horsepower available.

Thanks to Roald Ribe for suggesting the idea and supplying example code.

The setting can be changed from this setup screen and is saved in the registry.


12.3.133: VERTICAL_LINE (colored, vertical lines on session screen)


VERTICAL_LINE CharacterPos Width [RELATIVE] R G B

Default: None.
This is a per-session setting.

This causes colored, vertical lines to appear just after the character pos specified in CharacterPos.
The idea is to have a sort of "margin" line as on a typewriter that indicates a certain position. For example, if you want to limit your lines to a maximum of 80 characters, and you want a visual indication of column 80 on your session screen (which usually is much larger than 80 positions) you could specify:


VERTICAL_LINE 80 1 240 240 240

This draws a line just after character 80, 1 pixel wide, with an RGB (Red, Green, Blue) value of 240,240,240 - a very light grey. So this gives a thin, barely visible grey line to indicate the position (assuming the background color of the session is bright white, see the RELATIVE keyword below).

Depending on the color of your screen and personal preference, you can choose a thicker line or different colors.
The maximum thickness IVT will allow is 15 pixels.

There can be as many lines as you want, of different colors and thickness.
Every line runs the entire height of the screen. It tries to be between two characters on the screen. Drawing the lines will only affect pixels that have the default background color, so characters like X, W and _ that usually occupy that position (depends on the font) are not mutilated by the line (as used to happen in older versions of IVT).
NOTE: This means that every pixel where a line might pass is examined first, then set when that pixel is the background color. On large screens, if you have several lines, when the screen is updated frequently, even a fast PC according to modern standards will show a noticeable drag on performance.
So use it, don't abuse it.

It also means that if you use full-screen color applications such as Midnight Commander, the lines will not be drawn in places where the screen has a color that is not the default background (in older versions of IVT, a light-gray line on a white screen is just visible, but the same grey stands out in an ugly fashion when the background is made blue by Midnight Commander).

Another problem with these lines occurs when you have sessions which do not have the default color scheme. For example, if your normal background color is bright white, but some sessions have a black background, the barely visible light-grey looks almost bright white on a dark screen (i.e. ugly).
This is why the RELATIVE keyword was added in version 18.1 of IVT.
When this option is used, IVT will interpret the RGB color values as offsets from the current background color. IVT will darken the color values when the background is bright, and brighten it when the background is dark. When you use a relative offset of, for example, "15", this will guarantee that the lines remain relatively unobtrusive, so:

   VERTICAL_LINE 80 1 RELATIVE 15 15 15

is probably the best.

The lines appear only on the session screen. When there are dialogs on the screen, or POPUPs, they are (temporarily) removed.

There is currently no way to define these lines through setup dialogs, you have to define them in an IVT.RC file.

These lines can be disabled and enabled through the 'Extra' menu on the session menu bar, and through the VLINES script function.
This is handy if you don't want the lines displayed all of the time.
Currently, there is only ONE set of lines possible, so all sessions have the same line(s) in the same position(s), or none at all.


12.3.134: VSCROLL (enable vertical scroll bar)


VSCROLL
NO_VSCROLL

Default: show scroll bar.
GUI_VSCROLL is an old alias for VSCROLL.
This is a global setting.

The scroll back history is accessed through this scroll bar.
Simply clicking the appropriate parts is the equivalent of keyboard commands such as ALT-PgUp and ALT-CursorUp.
These keyboard commands still work, of course.

For people who do not like screen clutter, the scrollbar can be turned off (using NO_VSCROLL). It can also be turned on and off from this setup panel.
See also NO_MENUBAR, NO_TABSBAR and NO_STATUS to remove more screen clutter.

The vertical scroll bar is a global feature - you either have it for all sessions or for none.

This setting can also be changed from this setup screen, the current setting is saved in the registry.


12.3.135: VSPACE/HSPACE (extra border space)


VSPACE Pixels
HSPACE Pixels

Default: 2 pixels in both directions.
This is a per-session setting.

This controls the extra amount of space between the window borders and the text in the window. Horizontal space is added to the top and bottom of the window, vertical space at the left and right edges.
The default setting is 2 pixels for the vertical border and zero for the horizontal.
A zero setting disables any extra border. In that case, when you maximize the window, the leftmost characters will touch the physical edge of the screen.
Depending on your color setup, this can lead to black characters touching the black edge of the screen, creating a very ugly effect.

It can also be changed from this setup screen.
The values are saved in the registry.
See also FONT and VSCROLL.


This is an important feature, others are prev/next


12.3.136: WINDOW_SIZE (Set the size of the IVT session window)



WINDOW_SIZE Rows[%] Columns[%] [DEFAULT]
WINDOW_SIZE MAXIMIZED  [DEFAULT]
WINDOW_SIZE FULLSCREEN [DEFAULT]

Default: Dynamic.
This is a per-session setting.

Set the IVT window size for the current session to the indicated size.
These are the rules:

Examples:


        WINDOW_SIZE MAXIMIZED DEFAULT
        WINDOW_SIZE 90% 90% DEFAULT
        WINDOW_SIZE 40 120      # 40 rows, 120 columns
        WINDOW_SIZE 80% 80      # 80% of screen vertically, 80 columns.

When you specify 100%, the entire width or height of the physical screen is used. For example:


        WINDOW_SIZE 100% 100% DEFAULT

will instruct IVT to use the entire physical screen by default. All setup and help screens will also be this size.
When you use:


        WINDOW_SIZE 50% 80%

then 50% of the vertical size of the screen (rows) and 80% of the horizontal size will be used. For the actual number of resulting rows and columns, see the setup screen.

When you change the size of the font, IVT will recalculate the resulting number of rows and columns and resize the window accordingly.
The resulting numbers can be found in the IVT variables $ROWS and $COLS.
See also SIZEFONT and SIZE4ALL, though.

This method of working works best with a host that understands variable terminal sizes. The TELNET protocol over WinSock in IVT supports this. This means that IVT will communicate the resulting number of rows and columns to the remote host automatically, so any full-screen program will know the size of your terminal session. This will allow you to have very large screens, which is a VERY nice thing to have.

Other session protocols (such as RLOGIN) do not always support this (so you need to set the Unix $LINES and $COLUMNS environment variables manually or using IVT scripting).

See also FULLSCREEN and ONRESIZE.
See also WINDOW_POS (especially the LAST_KNOWN option there).

Note: One systems with multiple monitors, IVT will try to keep on the monitor that the user drags it to. The maximum window size is the combination of all monitors, you cannot drag the window larger than actually fits on your monitors.
When you use WINDOW_SIZE with a percentage, it is interpreted as a percentage of the primary monitor. You can size IVT to a maximum that is larger than the single monitor by dragging the borders.

Note that many factors influence the size of the window and the resulting number of rows and columns:

In other words: Your Mileage May Vary.


12.3.137: WINDOW_POS (specify default window position)


WINDOW_POS CENTER|CENTRE [option...]
WINDOW_POS LEAVE
WINDOW_POS LAST_KNOWN
WINDOW_POS Xvalue Yvalue [option...]

Option is one off:


STARTUP_ONLY
NO_STARTUP_ONLY

Default: LAST_KNOWN, STARTUP_ONLY.
Note: WINDOWPOS is a deprecated alias for WINDOW_POS.
This is a global setting.

This command is used to specify the initial window position of the IVT application window. If you specify CENTER (or CENTRE, if you happen to live on the wrong side of the Atlantic :-) the window will be positioned in the center of the screen. This is default.

When LAST_KNOWN is used, the position and size at the time IVT was last used is used. The last known size is also made the default size for new sessions.
This setting is the default setting, starting with version 22.3 of IVT.
When you write scripts and need to make sure that IVT starts up in a known position and size you will have to force this setting off of the default.
When there IS no last-known position, or when NO_REGISTRY is used, LAST_KNOWN is the same as CENTER.

When you specify LEAVE, it means that IVT will leave the window wherever it is (determined by the operating system). This prevents that the windows jumps hither and yon when you call IVT to perform short tasks on Unix using scripts.

You can also specify absolute coordinates of the upper left corner of the screen. IVT will position itself accordingly during start-up.
When you alter the setting from this setup screen, IVT will reposition accordingly.
When you specify a NEGATIVE value for X or Y, the result will be that the window is positioned beyond the top (Y) or left edge (X) of the physical screen. This is sometimes useful when the size of the window is a little too big, causing the status line or the title bar to be hidden by the Windows taskbar. Tweaking these values can make all relevant bits visible.

IVT will determine the whereabouts of the Windows taskbar and interpret the coordinates accordingly. Thus, if you specify "WINDOW_POS 0 0" and your taskbar is at the top of the screen, IVT will position itself just below the taskbar. Similarly, centering is done with the taskbar taken into account.

When you specify STARTUP_ONLY (the default), IVT will only position the window for the first session (created during startup), and will not re-position the window afterwards. When NO_STARTUP_ONLY is in effect, a setting of CENTER or absolute coordinates will be re-applied every time you create a new session, causing the main window to be moved to the configured position.

This setting can also be changed from setup, and is saved into the registry.

Furthermore, it can be used in a script, in which case you can control the current window position of IVT.


12.3.138: WRAP (set line wrapping mode)


WRAP
NO_WRAP

Default: WRAP.
This is a per-session setting.

Turn auto-line wrap ON/OFF. When ON, IVT will wrap to the next line after reaching the end of a line. When OFF, it will print remaining characters on the last position of that line. The length of a line is of course determined by the current settings of the WINDOW_SIZE and whether or not the host has set a wide screen.

The mode can also be changed by the host using an escape sequence.

When NO_WRAP is in effect, output longer than a line is lost, which can be exceedingly annoying. IVT has WRAP as default, but even that does not help against certain hosts (such as AIX) that explicitly set NO_WRAP at the drop of a hat.

The mode can be viewed and changed (for the current session only) from this setup screen.


12.4.1: AUTOLANDSCAPE (for text mode prints)


AUTOLANDSCAPE
NO_AUTOLANDSCAPE

Default: AUTOLANDSCAPE.

This setting only applies to Windows printers (not a file or other simulated printer).

When IVT wants to print text to a Windows printer, it will determine whether full lines of text fit the paper given the current paper, font and screen width. When the paper is too narrow and portrait mode is selected, IVT will automatically select landscape mode when the printer supports it. Note that this does not guarantee that this will make it fit, but at least a larger portion of the lines will make it to the paper.
See also PRINTER_FONT_SCALE, as a further attempt to make sure the information makes it all the way to the paper.

If, for whatever reason, you do not want IVT to switch orientation this way, it can be suppressed by specifying NO_AUTOLANDSCAPE.
The default setting (from IVT.RC) is inherited by all printers that IVT detects when starting. You can modify this setting for individual printers in this printer setup screen. This modification is stored in the registry, too.


12.4.2: CONFIRM_PRSCREEN (Confirm print screen)


CONFIRM_PRSCREEN
NO_CONFIRM_PRSCREEN

The default is CONFIRM_PRSCREEN.
This is a global setting.

When you type F2 (Print Screen), IVT will normally display the standard Windows "Printer selection" dialog where you can choose a printer, change the print job settings and/or confirm or cancel the print operation.
When the current printer is a plain file, IVT displays a simple OK/Cancel dialog to confirm the print operation.
Some users prefer not to be asked and this option allows you to configure that.

For Windows printers, this means the output is sent to the current printer (usually the Windows default) with the default settings.
For a file, the data is simply sent to the file.

It can also be changed from printer-setup and is saved in the registry.
See also CONFIRM_PRINT_SELECT.


12.4.3: CONFIRM_PRINT_SELECT (Confirm print selection)


CONFIRM_PRINT_SELECT
NO_CONFIRM_PRINT_SELECT

The default is NO_CONFIRM_PRINT_SELECT.
This is a global setting.

When you select a region on the screen (with either the mouse or the keyboard) you can hit F2 (print screen) to print just the selection to the current printer. The idea is that you define a file as the current printer for the session, and add bits and pieces of the session to that file. For example, details of error messages and other program output is pasted to the file this way with a minimum of effort.
To minimize that effort further, IVT does not normally ask for a confirmation to print the selection. Some users do not like that and for those this option can be used to force a dialog with the usual printer selection.

It can also be changed from printer-setup and is saved in the registry.
See also CONFIRM_PRSCREEN.


12.4.4: PR_CONTROLLER (How to handle host printing)


PR_CONTROLLER RAW
PR_CONTROLLER COOKED

Default: RAW.
GUI_PR_CONTROLLER is an old alias for PR_CONTROLLER.
This is a global setting.

IVT supports the DEC VT220 "Print controller" mode, where characters received by the host are not sent to the screen but to the printer, instead. This mode allows hosts to print reports on the printer connected to the PC IVT runs on, instead of printers attached to the host.
The host can initiate this controller mode with ESC[5i and stop it with ESC[4i.

This GUI version of IVT supports two ways of sending data to printers:

By default, IVT will open a print job in "RAW" mode when the host turns the printer on. The host is expected to control the printer by sending the appropriate commands to control the font, page breaks, and so on. this works fine in most cases, but it has two problems:

Therefore, IVT allows you to specify the mode for sending data to printers when the host turns controller mode on. When "COOKED", IVT opens the printer with the settings specified in the "properties" sheet for the printer, and prints the data in the selected font. It is the responsibility of the user to make sure that the data the host sends does not contain ESC-commands or PostScript commands, since these commands end up being printed instead of being executed.

The setting is inherited by all printers that IVT discovers when it starts up.
It can be overruled in setup, and such a change is saved in the registry.


12.4.5: PR_INDENT (Create a left margin in printout)


PR_INDENT number

This is only used by the manual printing subsystem of IVT.
Default value: 3.
This is a global setting.

Every line printed will be prefixed by the number of spaces you specify here.
This will create a left margin that might prevent holes being punched through my carefully created documentation :-)
Make sure that the chosen font (PRINTER_FONT) and the indent do not combine in long lines being truncated or wrapped.

This number can also be adjusted from this setup screen.
See also PR_LINES.


12.4.6: PR_LINES (Number of lines per page to use when printing)


PR_LINES num

This is only used by the manual printing subsystem of IVT.
Default value: 61.
This is a global setting.

This specifies how many lines are to be printed on a single page. After the specified number of lines, IVT will emit a form feed character to start a new page. Every page has a header of about 5 lines (depends on the level of the topic at the start of the page).

This is configurable from this setup screen, too.
The number is ignored when you are printing manual pages to a Windows printer, IVT will automatically determine the proper number of lines given the chosen PRINTER_FONT, paper size and so on. When your 'printer' is a file, the size is important.


12.4.7: PRINTER (Define a logical printer)


PRINTER FILE[,OPTIONS...]

Default: None.
This is a global setting.

This can be used to define a logical printer. When you click here IVT will show all defined printers.
This allows you to connect any printer to any session.
Normally, you will not need this statement, since IVT will detect all installed Windows printers and choose the default Windows printer automatically (but you can also use this to switch between printers under script control).
NOTE: When you use this in a script, quote the entire argument:


   PRINTER "$SomeName,APPEND,AUTO_FF"

and not (syntactical error):


   PRINTER $SomeName,APPEND,AUTO_FF

NOTE: IVT used to define a default printer called LPT1, which used to be "the" way to print on MS/DOS and early versions of Windows. Nowadays, directly attached parallel printers are a rare exception. On systems without any defined Windows printers, defaulting to LPT1 while there is nothing connected to LPT1 will cause hang-ups and serious delays. IVT no longer defines this as a printer. If you still want IVT to use LPT1, you will have to define it manually, like so:


   PRINTER LPT1,APPEND,AUTO_FF

You can also add printers on the fly in the printer setup screen (F3, Print), BUT such manually defined printers will be used as if they were files, so IVT will just open them, write text output and close them (so no colors, backgrounds, special characters, national support and so on). This is meant to be used for plain files or (very) simple printers such as LPT1.

If you just want to print a file, check out the privt support program!

FILE can be any device (e.g. LPT1) or real file (e.g. C:/TMP/SCREEN.DMP).
Note: it can also be the name of a Windows printer as shown in the IVT printer setup dialog.

The OPTIONS are a comma-separated list of options. An option can be:

You can also specify a Windows queue-name, such as:


   PRINTER \\\\BAC300\\PQ_F2-OOST_HP,OVERWRITE,TIMEOUT=5,NO_AUTO_FF

The double backslashes are necessary because a \ is special in IVT.RC files.
In this queue case, you must specify OVERWRITE, or it won't work!

Several sessions can print to the same printer simultaneously. Output will be intermixed when this happens!

The default mode is OVERWRITE. See also printing for complete description of printing.
Another default mode is NO_PROMPT, so files are overwritten without asking.

You can have scripts to select printers dynamically. For example, on a Windows machine with an HP printer and a Fax, the following will work:


Script SetPrinter New
   HIDE
   PRINTER "$New,SELECT"
   POPUP "Printer $New activated" DUM DUM 1000
END
KEYMACRO "F10-Shift-Ctrl-Alt" ASYNCFUNCTION SetPrinter "HP Photosmart D7400"
KEYMACRO "F11-Shift-Ctrl-Alt" ASYNCFUNCTION SetPrinter "Fax"

Now, when the user types F10, the HP printer is selected and a popup briefly shows the selected name. Press F11 and the Fax is now the selected printer for the current session. Allows easy switching in multi-printer environments.
Do make sure you pass the name exactly as Windows defines it, or IVT will create a new printer-to-file with the name you give!

The host can also control printing, see these special escape codes.
See also PRINTER_FONT.


12.4.8: PRINTER_AUTO_FF (Send FormFeed when closing printer)


PRINTER_AUTO_FF
NO_PRINTER_AUTO_FF

Default: PRINTER_AUTO_FF.
This is a global setting (and per-printer).

This setting only applies to simple (file-based or RAW) printers, normally IVT will use Windows printer in advanced (cooked) graphics mode. In that case, Windows will make sure that the print job ends and no extra blank pages are printed.

For simple printers, when IVT stops printing, it will send a form feed character to make sure the printer actually ejects a page. For some (line) printers, this is not desirable. Setting NO_PRINTER_AUTO_FF will prevent the form feed.
This setting can also be influenced by the host, using the CSI ? 18 h/l command sequence. IVT will initialise the setting for every session by using the default for the printer, which can be altered manually in printer setup.
See also the AUTO_FF clause of an individual PRINTER statement.

By the time it is time to close the printer, the current setting is used.


12.4.9: PRINTER_FONT (Font to use for printing)


PRINTER_FONT "font description"

This version of IVT supports graphics printing of screen and help data.
This is a global setting.

The PRINTER_FONT statement can be used to specify the font to use for all text.
Colors, shading, underlines and so on are all printed exactly as shown on screen, hardware permitting.
The syntax for this statement is the same as the one used for the screen font, see FONT for details.

It is best to choose a decent TrueType font here.
See also PRINTER_FONT_SCALE and AUTOLANDSCAPE.

You can also specify the font interactively in this setup screen.


12.4.10: PRINTER_PROMPT (Ask before overwriting/appending print files)


PRINTER_PROMPT
NO_PRINTER_PROMPT

The default is NO_PRINTER_PROMPT.
This is a global setting.

When you use a printer that is actually a file, IVT will normally just open the file and either overwrite it or append data to it depending on the setting of the OVERWRITE/APPEND mode.
Setting PROMPT to ON will cause IVT to display a "Proceed yes/no" dialog when the file already exists before altering the file. Click on CANCEL to prevent printing, OK to proceed with printing.

This setting only affects printers that are files, it is ignored for "real" printers (nothing is destroyed when printing to a real printer).

NOTE: Using this statement only sets the default for all printers that are defined, either interactively through setup, or using a PRINTER statement in an IVT.RC file. Use the PROMPT/NO_PROMPT clause in a PRINTER statement to overrule this default (or set the appropriate checkbox).

Changes made to individual, interactively defined printers are saved in the registry.


12.4.11: PRSTATLINE (Print status line with print-screen yes/no)


PRSTATLINE
NO_PRSTATLINE

Default: PRSTATLINE
This is a global setting.

The default is PRSTATLINE, which means 'Print Status Line'. When you use F2 to print the current screen, any status line that may be on the screen will be printed. If, for whatever reason, you would like to omit this line, use NO_PRSTATLINE, which will suppress the status line when printing.

The setting can be changed for the current session only in setup.


12.4.12: PRBLACKWHITE (Force black & white printing)


PRBLACKWHITE
NO_PRBLACKWHITE

Default: NO_PRBLACKWHITE.
This is a global setting (and per-printer).

IVT can use Windows printers in graphics mode to produce very nice-looking screen prints and reports. The capabilities and defaults settings for these printers are obtained from Windows when IVT starts up.
By default, IVT will use the color capabilities of the printer when possible, but for very colorful screens this can result in the background being printed in (say) dark blue, eating a lot of expensive toner or ink.

When you specify PRBLACKWHITE, IVT will only print the text on the screen in black, and not print any background colors for the basic text on the screen.

Even when you redefine the "black" and "white" using RGB, IVT will still select real black and real white.

This attribute can also be set (and saved) for individual printers in this setup screen, the PRBLACKWHITE sets the default for all printers.

See also PRINTER and PRTIMEOUT.


12.4.13: PRINTER_FONT_SCALE (Adjust font to fit paper)


PRINTER_FONT_SCALE
NO_PRINTER_FONT_SCALE

Default: PRINTER_FONT_SCALE.
This is a global setting (and per-printer).

When IVT sends data to a real printer (not a file or other simulated printer), it will by default try to make the printout fit on a single sheet of paper.
The first thing it tries is to use the AUTOLANDSCAPE feature (to choose landscape or portrait orientation depending on the current size of the paper and the current size of the IVT window).

When a print screen still does not fit on a single sheet of paper (or the AUTOLANDSCAPE feature is disabled), IVT will attempt to scale the font down to make the printout fit a single sheet of paper exactly. Under normal circumstances this works very well - even large screens can be scaled to fit an A4 sheet of paper and produce a very legible result. This is why this feature is turned on by default.

However, it works best when:

IVT will scale the font down horizontally (narrower) or vertically (lower) or both to make it fit. This can produce an ugly effect depending on circumstances. In that case, you can use NO_PRINTER_FONT_SCALE and IVT will simply use the font set by PRINTER_FONT. This may result in truncated lines, a single print screen requiring more than a single page, or both.

The PRINTER_FONT_SCALE in an IVT.RC file governs the default for ALL printers that are detected by IVT. You can change the setting for a single printer by going into setup->printers and change the "Font scaling" feature there for a selected printer (see here).
When you save the setup, any such modification to a printer is saved as well.

See also AUTOLANDSCAPE and PRINTER_FONT.


12.4.14: PRTIMEOUT (Auto flush printer after N seconds)


PRTIMEOUT seconds
PRTIMEOUT 0
NO_PRTIMEOUT

This is a global setting (and per-printer).

When IVT opens a printer, this will (by default) be your standard Windows printer. This will usually be a network printer. When such a device is opened, the network printer will start queuing your data to a file and will not actually print anything until the connection is closed. Only then, the print data is considered complete and the printer will start printing banner pages and your data and so on.

IVT is a VT220 emulator. A VT220 has a port on the back that you can connect a physical printer to. When data is sent out the port, it is printed immediately since the printer cannot be shared by multiple terminals.
So, when data has to be printed, IVT opens the printer port and starts sending data. The problem is now: when to close that port? If you want to record the entire session to a printer, closing should not occur until the session itself is terminated.
If you use a program like privt, you want printing to start as soon as the last character is received.

Up until version 12.2a of IVT, closing the printer was solely possible by explicitly typing F3-F (flush printer) or by terminating the session.
New in version 12.2a is the PRTIMEOUT. This sets a default inactivity timeout for all printers in IVT. When a printer is open and no new data is sent to it for the specified timeout period (defaults to 10 seconds), the printer is closed automatically. The PRINTER directive has been enhanced to allow different values for each printer (with a default of the PRTIMEOUT value).
From version 16.4, you can modify this value in setup and the change can be saved in the registry.

Specifying a PRTIMEOUT value of zero will give you the old behavior of an infinite time - you'll have to use the F3-F keys to explicitly force a close.
A neater way to set the timeout value to zero is to use NO_PRTIMEOUT.

When this command is used in a script, it will modify the value for the current printer only.


12.4.15: TIMESTAMP_PRSCREEN (Timestamp print screen output)


TIMESTAMP_PRSCREEN
NO_TIMESTAMP_PRSCREEN

The default is NO_TIMESTAMP_PRSCREEN.
This is a global setting.

When enabled, IVT will add a line to a copy of the screen that states the version of IVT, the current date and time.

Added upon specific request for my dear colleague, John Eskes :-).
This setting can also be changed from this setup screen, and is saved into the registry.


12.5.1: DCE32 (Enable/disable use of DCE32.DLL)


DCE32
NO_DCE32

Default: DCE32.
This is a global setting.

This enables or disables (NO_DCE32) the use of the Gradient DCE32.DLL.
When IVT discovers a DCE32.DLL it will use this when a host offers Kerberos authentication.
If, for whatever reason, you have a DCE32.DLL installed which you do not want to use, specify NO_DCE32 (it can take a significant amount of time to call DCE when it is not configured correctly).
This can also be changed from this setup screen.

It can also be disabled from setup after some sessions have already been established using DCE support - IVT will simply stop using the DCE DLL.


12.5.2: FORWARD_X (Enable/disable X-forwarding)


FORWARD_X OFF
FORWARD_X AUTO [option]
FORWARD_X FORCE [option]


Options:


AUTO_CLOSE
NO_AUTO_CLOSE

Default: AUTO, NO_AUTO_CLOSE.
This is a per-session setting.

Old syntax (still supported):


FORWARD_X  (same as FORCE)
NO_FORWARD_X (same as OFF)

This feature enables or disables X-Windows port forwarding over SSH or Kerberos connections.
This has been enhanced in version 21.1 of IVT with the AUTO setting, which is the default.
OFF (or NO_FORWARD_X) disables X-forwarding.

AUTO means that IVT will check to see if you have an X-server running. If you are, then the session you create while X is running will have X-forwarding enabled. When no X is running when you create a session, that session will not have X forwarded.

FORCE (or FORWARD_X) forces this to ON, so every session will have an X tunnel, even when there is no X-server (resulting in errors when you try to start X programs on the session). You may, however, start the X server later.
On Unix, when FORWARD_X is enabled, you will have a DISPLAY variable.
When disabled, that variable will not exist.

AUTO_CLOSE determines what happens when you log out the normal SSH or telnet session while there are active X-tunnels. The default NO_AUTO_CLOSE means that the session will not close (the tab will not disappear) and the X-programs will continue to function. The original session will be unusable.
When the last X-program quits, IVT will close down the session (causing the tab to disappear).
The AUTO_CLOSE will forcibly shut down all X-traffic, so when you log off the original session, any active X-connection will terminate.

After IVT establishes a secure connection (using Kerberos or SSH), a user can start an X-Windows program on the remote host.

Such an X-program will usually create a new TCP/IP connection back to the PC of the IVT user and talk to the X-Windows server there. Such connections are NOT secure - they bypass the secure channel established by IVT/SSH.
Also, firewalls may prevent such a reverse connection, making X-Windows applications unusable.

X-Windows port forwarding means that the telnet/SSH server on the remote host will create a DISPLAY variable (specifying the address the X-programs will connect to) to point to itself. This means all X-Windows programs will actually talk to the local server instead of a real X-server. The telnet/SSH server sends all data to IVT over a tunneling protocol, which allows IVT to redirect the data to the real (local) X-server. All such traffic is encrypted together with normal session data. Data generated by the X-server is similarly captured by IVT and forwarded to the telnet/SSH server.

The upshot of this is that the X-sessions get the same level of security that the Kerberized/SSH sessions have and that all X-traffic gets sent over the already-established secure connection between IVT and the remote host.

This mechanism can be disabled by specifying NO_FORWARD_X.
There is a setup screen that allows you to view and modify the properties of the X-forwarding protocol. It is reached from the Kerberos setup screen.
The same setting can also be changed from the SSH setup screen.

There are a few things to keep in mind:

See also FORWARD_X_DISPLAY.
See also XAUTH_DELAY.
See this setup-screen to change the setting on the fly.


12.5.3: FORWARD_X_DISPLAY (Specify DISPLAY for X-tunnel protocol)


FORWARD_X_DISPLAY [host]:Disp[.Screen][.rest]

This is a per-session setting.

This is used to specify the address of the X-server when the X-port forwarding protocol is in use. It defaults to "127.0.0.1:0.0", i.e. the default screen on your local PC. The server on Unix will automatically set a DISPLAY variable to something like ":1.0", which implies that local Unix domain sockets will be used to communicate between the X-client on the Unix machine and the telnet or SSH server (also on the Unix machine). Since IVT runs on a Windows machine it has to use TCP/IP style sockets, so it defaults to an efficient local address.

IVT can parse the normal DISPLAY variable syntax, of which only the Disp and Screen portions are used. The first is used to connect to the proper local port (6000 + the specified number), the Screen part is sent to the Unix host when the X-forwarding protocol is negotiated.

Attention: Many X-servers on Windows can be configured to allow incoming connections from certain hosts only. If the tunneling protocol is used, the actual incoming connection is NOT from the Unix host, but from within IVT (most likely on the same PC as the X-server, since the purpose is to prevent session data from being transmitted unencrypted on the network). Make sure that the X-server is configured to allow sessions from "localhost", or "127.0.0.1", which is the reserved IP-address for "localhost".

If you use the free Cygwin X-server, make sure you start it with an extra parameter "-listen tcp". Newer versions of Cygwin only listen on a local Cygwin-style Unix domain socket, and IVT cannot forward traffic to such a socket. The "-listen tcp" makes Cywin listen on a local socket (without allowing the external connections) and IVT has no problem with that.

If you have trouble connecting, try turning "TELNET option negotiation" on in setup, it will display debug output for the tunnels being established and used.
To debug connection problems on SSH connections, use SSH_DEBUG.

The X-forwarding setup screen shows some statistics on data being transferred too, which is intended as a further aid in debugging. It also allows you to enable or disable X-11 port forwarding and to specify the local display.


12.5.4: KRB5 (Enable/Disable Kerberos V5 authentication)


KRB5
NO_KRB5

Default: KRB5.
This is a per-session setting.

When IVT connects to a Kerberos telnet host for the first time, it attempts to find its companion DLL for Kerberos V5 authentication (see KRB5_DLL).
When found, this enables Kerberos authentication in IVT. This implies that if the host sends a telnet "DO AUTH" that IVT will respond with a "WILL AUTH".
At this stage, IVT assumes that authentication can be done using Kerberos V5.
Subsequently, when the host requests authentication and supports Kerberos, IVT will attempt to obtain and send a Kerberos service ticket to the host.
When the host does not support a protocol that IVT understands, IVT will reject the offered protocols, the session will probably not get connected and the Kerberos DLLs end up being unused.

When no specific DLL has been specified using KRB5_DLL, IVT will try to find a default KRB5_32.DLL (it will look in all the standard places).
When found, IVT will inspect it to see if all required routines are available.
When IVT fails in loading the required support from the DLL's, Kerberos support will be disabled (and error messages will be printed on screen).

When Kerberos login fails, the $KRB5_AUTHENTICATE script variable is set to FAILED to communicate to the login system that the "normal" userid/password login must be used. When successful, it is set to the full name of the Kerberos principal.
When some failure occurs, you might be unable to login to the host because it insists on valid Kerberos credentials.

Using the NO_KRB5 directive, IVT will always respond "WONT AUTH", thus claiming to be a TELNET client that does not know about Kerberos at all. This might enable you to log in to a host in the normal fashion when something is wrong with your Kerberos setup. However, when the host is configured securely, it won't allow you to send unencrypted passwords and will disconnect you.

This setting can also be changed from this setup screen.
It is also saved into the registry.
See also Kerberos, DCE32, KRB5_COMERR_DLL and KRB5_LOGINPROG.


12.5.5: KRB5_AUTODECRYPT (automatically start telnet decryption)


KRB5_AUTODECRYPT
NO_KRB5_AUTODECRYPT

Default: KRB5_AUTODECRYPT
This is a per-session setting.

When turned on, IVT will automatically negotiate that the host should turn on encryption of the data stream. This will only work when the authentication was performed using the Kerberos protocol, since the key is taken from the ticket used to gain access to the host.

When IVT fails to negotiate encryption, it might be a sign of an attack, and therefore a blinking error message will be displayed by IVT.

This setting can also be changed from this setup screen.
The current setting is also saved in the registry.


12.5.6: KRB5_AUTOENCRYPT (automatically start telnet encryption)


KRB5_AUTOENCRYPT
NO_KRB5_AUTOENCRYPT

Default: KRB5_AUTOENCRYPT
This is a per-session setting.

When turned on, IVT will automatically negotiate that it will encrypt data sent to the host. This will only work when the authentication was performed using the Kerberos protocol, since the key is taken from the ticket used to gain access to the host.

When IVT fails to negotiate decryption, it might be a sign of an attack, and therefore a blinking error message will be displayed by IVT.

This setting can also be changed from this setup screen.
The current setting is also saved in the registry.


12.5.7: KRB5_COMERR_DLL (path to Kerberos error message DLL)


KRB5_COMERR_DLL pathexpr

This is a global setting.

This keyword is obsolete. You can use multiple KRB5_DLL statements instead.
IVT will scan all specified DLL's (and those only) until it finds all required symbols.


12.5.8: KRB5_CRYPTDEBUG (show debugging for telnet encryption)


KRB5_CRYPTDEBUG
NO_KRB5_CRYPTDEBUG

Default: NO_KRB5_CRYPTDEBUG
This is a per-session setting.

When the Kerberos authentication scheme of IVT is used to establish an authenticated session with a host, IVT will negotiate encryption in both directions by default. This is a complex process, which might fail for a number of reasons. Turning on KRB5_CRYPTDEBUG will generate many detailed messages on the screen to facilitate problem tracking.

This setting can also be changed from this setup screen.
The current setting is also saved in the registry.


12.5.9: KRB5_DLL (specify path of Kerberos V5 DLL files)


KRB5_DLL Pathname-of-KerberosDLL
KRB5_DLL Pathname-of-Kerberos-directory

Default: Taken from MIT install directory.
This is a global setting.

IVT will use dynamic loading with the Kerberos V5 DLL files to prevent error messages from Windows during start-up (DLL not found). When static loading were used, IVT would be unusable in a non-Kerberos environment and I would have to maintain two different builds of IVT.

IVT will use the standard path of the operating system to locate the DLL, and will try a number of common paths and file names.
It will also automatically detect that MIT Kerberos for Windows is installed and use that (download from http://web.mit.edu/Kerberos/dist).

When you get an error message from IVT that it cannot locate or load the required DLL's, there are two things you can do:

Only when symbols remain missing after all specified (or default) files and locations have been tried, will IVT give up and disable Kerberos (with an appropriate error message).

NOTE: The ORDER in which you specify the DLL's is VERY significant!  If IVT first attempts to load KRB5_32.DLL from some alien path, that DLL becomes part of the IVT program. However, that DLL references COMERR32.DLL, and if that DLL is stored in the same alien location, you still end up with an operating system error that it cannot locate COMERR32.DLL. The trick is to load the COMERR32.DLL first, so all the required symbols are already part of IVT by the time it loads the KRB5_32.DLL. When you store all the DLL's in the $IVTDIR installation directory, you will not notice this problem since the current directory is part of the standard operating system search path for DLL's.

When you use Kfw (Kerberos for Windows), integration with IVT is automatic.

See also the (NO_)KRB5 and KRB5_LOGINPROG keywords.
See also the (NO_)DCE32 keyword.
See also the KRB5_ENDLOGIN keyword.


12.5.10: KRB5_ENDLOGIN (terminate Kerberos login program after login)


KRB5_ENDLOGIN
NO_KRB5_ENDLOGIN

Default: KRB5_ENDLOGIN
This is a global setting.

When you use Kerberos, and IVT cannot find user credentials when it requires them, it will (optionally) start a Kerberos login program, see KRB5_LOGINPROG.
When this program succeeds in obtaining credentials (because you type the correct password, use your smart card, or whatever), IVT will detect this and proceed with Kerberized authentication. Usually, this will leave the program used to login running. Because some users view a program such as KRB5.EXE as a popup of IVT, they are surprised that the "popup" does not go away. However, technically speaking, this entirely separate login program is just launched by IVT as a service to the user. IVT does not know or care about the details of the login program.

IVT 19.0 adds the KRB5_ENDLOGIN feature for Kerberized telnet users. When IVT starts this login program and KRB5_ENDLOGIN is in effect, IVT will send a QUIT message to the login program after it obtained credentials successfully.
This only has effect when the login program is a Windows program (a text mode program running in a command window won't quit this way).

The upshot is that the login program really becomes a sort of popup of IVT, it disappears when no longer required.
This works for Kfw (Kerberos for Windows) too.

When you find this behavior undesirable, use NO_KRB5_ENDLOGIN.
The default is KRB5_ENDLOGIN.
There is currently no setup screen for this option, it must be specified in your IVT.RC files.


12.5.11: KRB5_FORWARD (forward credentials to telnet server)


KRB5_FORWARD
KRB5_FORWARD FORWARD
NO_KRB5_FORWARD

Default: NO_KRB5_FORWARD.
This is a per-session setting.

Ticket forwarding will send your local Kerberos credentials to the remote Kerberized telnet daemon. This allows you to use Kerberized client programs on that host that will use your forwarded credentials.
It is turned off by default, because forwarding is not without dangers. Your credentials are stored in a file on the remote system. A super-user on that system can access that file, and so gain access to your credentials, and so to other systems that you have access to!

You can (usually) use the "klist" command on the host to show the tickets it has stored. This will also show the details of the storage location.

When you specify KRB5_FORWARD FORWARD, IVT will mark the forwarded credentials as forwardable, allowing them to be forwarded again (even more dangerous!).
Use NO_KRB5_FORWARD when you get the error:

   Error getting forwarded creds - KDC can't fulfill requested option

from Kerberos software on the host you login to with IVT.
This is because the domain administrator can configure the host to disallow the forwarding of credentials to it (to mitigate the above dangers). There is nothing IVT can do about that; it tries to forward the credentials and gets this error.

This setting can also be changed from this setup screen.
The current setting is also saved in the registry.


12.5.12: KRB5_LOGINPROG (Program to obtain credentials)


KRB5_LOGINPROG "path name"
NO_KRB5_LOGINPROG

Default: Dynamic.
This is a global setting.

When Kerberos is enabled and used, but IVT determines during the login process that your ticket is either expired or missing altogether, it will attempt to start this Kerberos login program. It will poll the credentials cache to see if the missing credentials appear, and continue as soon as this happens.
When the timeout expires, IVT continues without a ticket (probably leading to a fatal error, but some hosts may allow normal password-based logins).

The upshot is that when your ticket expires, you are presented with a login screen, you type the password and IVT immediately continues. This works also when you start many sessions in a group, all Kerberized sessions will block until the missing credentials are supplied. These retries will continue for up to a 90 seconds. If you switch back to IVT without logging in to Kerberos, IVT will give up the retries for the foreground session (background sessions continue to retry).

When you have Kerberos for Windows installed, this value will default to the "MIT Kerberos.exe" program that is part of that package.
When MIT is not installed, or the program cannot be found, it will default to "krb5.exe", and the current PATH is searched to find it.
In an older  Kerberos for Windows (Kfw) environment, you may want to change this into netidmgr.exe in the appropriate Kfw directory.

In a DCE environment, you might want to change it to dce_login.

When you specify an empty string, the feature is disabled. No program will be started and all Kerberized sessions will fail with error messages when no credentials are available when IVT starts up.
The NO_KRB5_LOGINPROG achieves the same: Disables startup of a login program.

See also NO_KRB5 to disable Kerberos.
See also KRB5_ENDLOGIN to make the program quit after successful login.


12.5.13: KRB5_REALM (Change default realm)


KRB5_REALM realmname

Default: Dynamic.
This is a global setting.

This sets a default realm name to be used by IVT. Use only when this differs from the standard global default realm that your computer is in (the standard is to have the Kerberos realm being the upper-case version of your DNS domain name).
The argument must be a string, it may contain IVT variable references.
You can only be part of a single realm.

This can also be changed from the Kerberos setup panel and is saved into the registry.
See also the general discussion on Kerberos.


12.5.14: LICENCE (Point to a licence file)


LICENCE pathname_expr

Default: Dynamic.
This is a global setting.

This statement can be used to point to an IVT licence file. During start-up, IVT will read the licence file and determine its validity. When invalid or not specified, it will attempt to find a licence installed in the registry.
A licence file is more convenient to use when you run a number of copies from a central network disk, individual users will not have to worry about the licence. The central IVT.RC file (or some other configuration file included from it) can simply refer to the central licence file.

When the current licence is obtained from a file, the DELETE and INSTALL buttons in the licence manager are disabled. The licence dialog will also show the name of the licence file that is in use.

IVT will default to a file named "IVT.LIC" in the $IVTDIR directory, or a file called ivtlic.txt there. The first is a binary file (which has problems in the passed when sent trough email), the second is the same data but then in the form of a plain text file.

When not found, it will look in:

The first valid file that is found will become the startup default.

When no licence is found, IVT will by default function for 30 days after installation. An expired or invalid licence will block the use of SSH and Kerberized telnet and will impose restrictions on various other parts of IVT.

See here for the formal, full text of the licence agreement.

When you do not want that IVT shows the details of your licence on screen during startup, use NO_SHOWLICENCE.

An IVT licence is bound to a specific attribute of the PC or network of PC's that IVT is installed on. That can be, in order of preference:

The most common forms are the single PC and DNS domain. These are sold online by the web shop WEBSITE.
For the other types, please send mail to sales@ivtssh.nl.
The same mail address can be used If you need a company license, need a quote, official invoice or want to pay using a different method than available in the web shop.

The required attributes of a PC for a licence can be displayed by running the 'Identify' script that is part of the IVT distribution.
Use Menubar->Scripts and click on the line that says "Identify this PC for licence details".
The script will display all it knows about the current PC and any network it is part of. Please provide a copy of those details when requesting a licence.


12.6.1: Proxy overview

A proxy server is a program that can connect to destinations that you cannot connect to directly yourself. So, instead of a direct connection, IVT contacts the proxy server and asks it to connect to the final destination on its behalf.
When the proxy server confirms the connection, data sent by IVT is forwarded to the real destination, and data returned is sent back to IVT.
To the user, the process is (almost) transparent - it seems as if the remote host can be reached directly.
The address book of IVT can be configured to specify a proxy server for a host, so that when you connect to that host, IVT automatically uses the proxy and the user can pretend the host can be reached directly.

The proxy server can be used to give controlled access to the network behind the proxy server - it can decide to deny access.

Proxy servers come in different flavors (protocols). SOCK-4 and SOCK-5 are common, but some servers are simply a TELNET program that you have to send a standard TELNET "connect" command. Some are transparent (once the connection is established, all data is passed through), others inspect the data for some commands like the ^] character that usually gives a TELNET program a means of escape.

IVT supports various types of proxy server. The topics below show how to configure IVT to use a proxy for all, or only certain types, of connections.

NOTE:
The IVT distribution also comes with the (Unix) source of a SOCKS-4 proxy server program that can work with OpenSSH and IVT. See socks4FW.
This program can also be used to forward TCP and UDP connections.
It was written especially for IVT as a fast and efficient SOCKS server.

See this advanced example to configure proxy servers very flexibly.


12.6.2: PROXY_DEBUG (Turn debug on/off for proxy operations)


PROXY_DEBUG
NO_PROXY_DEBUG

Default: NO_PROXY_DEBUG
This is a per-session setting.

When you use the a proxy to setup your connections, you can turn this on to troubleshoot (or generally keep an eye on) the progress of the proxy connections. The debug messages will appear on-screen and look like:

PROXY: SOCKS5: Connection to proxy.server.com established.

The messages will be about connections, negotiations, problems and successes of getting a connection established through a proxy server.

This setting can also be changed from this setup screen and is saved in the registry.

This setting is per session, so a script can modify if it wants to, using a PRECONNECT or ONCONNECT script.
See also "Proxy setup".


12.6.3: PROXY_DNS (Name resolution when using a proxy)


PROXY_DNS NO
PROXY_DNS AUTO
PROXY_DNS YES

Default: AUTO.
This is a per-session setting.

If you are using a proxy to access a private network, it can make a difference whether DNS name resolution is performed by IVT itself (on the client machine) or performed by the proxy.

The 'DNS lookup at proxy end' configuration option allows you to control this.
If you set it to PROXY_DNS NO, IVT will always do its own DNS, and will try to pass an IP address to the proxy. When the local lookup fails, the original name is passed to the proxy server, so it can have a go at resolving it.
If you set PROXY_DNS YES, IVT will always pass host names straight to the proxy without trying to look them up first.

If you set this option to Auto (the default), IVT will do something it considers appropriate for each type of proxy. Telnet, HTTP, SOCKS5 and Script proxies will have host names passed straight to them; SOCKS4 proxies will not.

Note that if you are doing DNS at the proxy, you should make sure that your proxy exclusion settings (see PROXY_EXCLUDE) do not depend on knowing the IP address of a host. If the name is passed on to the proxy without IVT looking it up, IVT will never know the IP address and cannot check it against your list.

The original SOCKS-4 protocol does not support proxy-side DNS. There is a protocol extension (SOCKS 4A) which does support it, but not all SOCKS 4 servers provide this extension. If you enable proxy DNS and your SOCKS 4 server cannot deal with it, this might be why.
IVT comes with a SOCKS-4A proxy server in the distribution: socks4FW.

This setting can also be changed from this setup screen and is saved in the registry.

This setting is per session, so a script can modify if it wants to, using a PRECONNECT script.
See also "Proxy setup" and socks4FW.


12.6.4: PROXY_EXCLUDE (Which hosts NOT to proxy)


PROXY_EXCLUDE pattern...

Default: Not used.
This is a per-session setting.

Typically you will only need to use a proxy to connect to non-local parts of your network; for example, your proxy might be required for connections outside your company's internal network. In the 'Exclude Hosts/IPs' box you can enter ranges of IP addresses, or ranges of DNS names, for which IVT will avoid using the proxy and make a direct connection instead.

The 'Exclude Hosts/IPs' argument may contain more than one exclusion range, separated by commas. Each range can be an IP address or a DNS name, with a * character allowing wildcards. For example:


   PROXY_EXCLUDE "*.example.com"

This excludes any host with a name ending in .example.com from proxying.


   PROXY_EXCLUDE "192.168.88.*"

This excludes any host with an IP address starting with 192.168.88 from proxying.


   PROXY_EXCLUDE "192.168.88.*,*.example.com"

This excludes both of the above ranges at once. Note that the best way to disable proxying for a particular connection is to set:


PROXY_TYPE NONE

Using a PRECONNECT script, for example.

Connections to the local host (the host name localhost, and any loopback IP address, plus hosts on the same subnet) are never proxied, even if the proxy exclude list does not explicitly contain them. It is very unlikely that this behavior would ever cause problems, but if it does, you can change it by enabling PROXY_LOCAL.

Note that if you are doing DNS at the proxy, you should make sure that your proxy exclusion settings do not depend on knowing the IP address of a host.
If the name is passed on to the proxy without IVT looking it up, it may never know the IP address (it tries, though) and may be unable to check it against your list.

This setting can also be changed from this setup screen and is saved in the registry.

This setting is per session, so a script can modify if it wants to, using a PRECONNECT or ONCONNECT script.
See also "Proxy setup".


12.6.5: PROXY_HOSTNAME (Hostname/port of the proxy server)


PROXY_HOSTNAME "hostname:port"

Default: Not used.
This is a per-session setting.

Use this to specify a machine to use as proxy server.
The "hostname" part must specify the name or IP-address of the server that is running the proxy service.
The "port" part must the number of the port that the server must be accessed on to provide the proper proxying service. IVT supports various proxy protocols, see PROXY_TYPE for details. Some commonly used ports are:

HTTP:   80, 8080 or 3128.
SOCKS5: 1080
TELNET: 23

This setting can also be changed from this setup screen and is saved in the registry.
See also "Proxy setup".


12.6.6: PROXY_TIMEOUT (Maximum time for proxy operations)


PROXY_TIMEOUT seconds

Default: 15 seconds.
This is a per-session setting.

See proxy for a discussion of proxying connections.
The default value for this is 15 seconds, zero sets an infinite timeout.

The value specifies how many seconds IVT will allow to pass for a connection to be established through a proxy server. The time includes connecting to the proxy server, authentication to the server, sending the request to contact the actual host the user wants to talk to and receiving a confirmation or error.

When the limit is exceeded before success or failure is reported, IVT aborts the connection (a diagnostic message will be displayed).

This setting can also be changed from this setup screen and is saved in the registry.
See also "Proxy setup".


12.6.7: PROXY_LOCAL (Use proxy for local addresses yes/no)


PROXY_LOCAL
NO_PROXY_LOCAL

The default is NO_PROXY_LOCAL.
See proxy for a discussion of proxying connections.

Connections to local hosts (the host name localhost, and any loopback IP address, and any host in the same network) are never proxied, even if the proxy exclude list does not explicitly contain them.
It is very unlikely that this behavior would ever cause problems, but if it does you can change it by enabling this setting.

When set, IVT will ALWAYS use the proxy for any connection. This can make a difference when the host you connect to checks the address of the incoming connection, which will normally be the PC IVT runs on, but in this case it will be the address of the proxy server.

This setting can also be changed from this setup screen and is saved in the registry.
See also "Proxy setup".


12.6.8: PROXY_IPV6 (Proxy understands IPv6 addresses)


PROXY_IPV6
NO_PROXY_IPV6

The default is NO_PROXY_IPV6
This is a per-session setting.

See proxy for a discussion of proxying connections.

When IVT resolves host addresses (see PROXY_DNS) and one or more of the addresses are found to be IPv6, normally IVT would send that address to the proxy server so it can make the actual connection.
When the server cannot use such an address, the attempt will fail.
When your proxy server cannot understand IPv6 addresses, set NO_PROXY_IPV6 so IVT knows not to attempt this.

NOTE: This is currently only used for SOCKS-4 proxy servers.
A SOCKS-4 proxy server will receive the IPv6 address as a hostname, which it should be able to use as a valid name. When the system that runs your proxy server has no IPv6 support, it won't be able to make sense of such an address and fail.
Also note that failure for ONE address will not stop IVT from trying to use other addresses for the same host, some of which can be IPv4, until a connection is established or there are no more addresses to try.

This setting can also be changed from the proxy setup screen and the current value is saved in the registry.
See also "Proxy setup".


12.6.9: PROXY_TELNET_CMD (Command string for a TELNET proxy server)


PROXY_TELNET_CMD "string expression"

Default: Not used.
This is a per-session setting.

A TELNET proxy is a very simple type of proxy server. It is usually implemented by actually running the telnet program on the proxy host, and a client sends a "connect HOSTNAME PORT" type of command that will cause the telnet proxy to establish the connection to the actual destination host.

So, the default for this is:

PROXY_TELNET_CMD "connect \$HOSTNAME_ONLY \$HOSTNAME_PORT\n"

See the special variables $HOSTNAME_ONLY and $HOSTNAME_PORT for details, but basically these are the explicit hostname and port number of the connection you are trying to establish. The \n appends a new line to the command.

Make sure you know what you are doing when you change this setting.
Also, note there is a proxy type called IVT-SCRIPT, which allows you to write a sort of chat-script in the IVT scripting language to deal with any sort of proxy that converses in ASCII lines.
See also $IVT_PROXY_USER and $IVT_PROXY_PASSWORD.

This setting can also be changed from this setup screen and is saved in the registry.
See also "Proxy setup".


12.6.10: PROXY_TYPE (Type of proxy server)


PROXY_TYPE NONE
PROXY_TYPE HTTP
PROXY_TYPE SOCKS-4
PROXY_TYPE SOCKS-5
PROXY_TYPE TELNET
PROXY_TYPE IVT-SCRIPT

Default: Not used.
This is a per-session setting.

The 'Proxy type' command allows you to configure what type of proxy you want IVT to use for its network connections. The default setting is 'NONE'; in this mode no proxy is used for any connection. Any other setting also requires that you at least set the PROXY_HOSTNAME.

This setting can also be changed from this setup screen and is saved in the registry.

This setting is per session, so a script can modify if it wants to, using a PRECONNECT script.
See also "Proxy setup".


12.6.11: PROXY_USER/PASSWORD (Login credentials for proxy server)


PROXY_USER username
PROXY_PASSWORD password

Default: Not used.
This is a per-session setting.

If your proxy requires authentication, you can specify a username and a password with these commands.
Note that these commands accept plain text passwords only!

Also note that if you save your session, the proxy password will be saved in plain text, so anyone who can access your IVT configuration data will be able to discover it.

Authentication is not fully supported for all forms of proxy:

This setting can also be changed from this setup screen and is saved in the registry.

This setting is per session, so a script can modify if it wants to, using a PRECONNECT or ONCONNECT script.
See also "Proxy setup".


12.6.12: PROXY_SCRIPT (IVT script to handle proxy)


PROXY_SCRIPT scriptname

Default: Not used.
This is a per-session setting.

See PROXY_TYPE, type IVT-SCRIPT.
The script must be the name of a script you will have to write yourself.
It cannot take any parameters and should handle the interaction with the proxy server. A return code of zero indicates success, anything else is an error.

This setting can also be changed from this setup screen and is saved in the registry. The field is only available when the selected PROXY_TYPE is IVT-SCRIPT.

See the special variables $HOSTNAME_ONLY and $HOSTNAME_PORT for details, and also $IVT_PROXY_USER and $IVT_PROXY_PASSWORD.

This setting is per session, so a script can modify if it wants to, using a PRECONNECT script.
See also "Proxy setup".


12.7.1: TUNNEL overview


TUNNEL LOCAL tunnel-specification
TUNNEL REMOTE tunnel-specification
TUNNEL "CONFIG=path"
TUNNEL "PROGRAM=path"
TUNNEL "EXTRA=parameters"
TUNNEL "DEBUG=path"
TUNNEL MINIMIZE

This is a complex, but powerful feature that allows you to tunnel any sort of network traffic, to and from any sort of system that you can login to (and get a prompt from).

Consider a scenario where you can login to a system using one (or more) intermediate systems as stepping stones (and/or firewalls).
The purpose of those intermediate systems is to prevent you from accessing the target system as if it were part of the local network, so you cannot do file transfer, or use X-tunneling, or port-forwarding, etc.
For example, if you login to a Linux system in AWS (Amazon cloud), you make contact with a gateway system, authenticate using some two-factor system, then choose the actual target system, where you get an actual prompt (and ONLY the prompt). If you try to use port-forwarding to access services on the target network, it will fail because it is blocked by the intermediate system.
The idea here is to limit the type of access that you get to the target system.

The IVT Tunnel program is designed to bypass all of that. If you can get to the prompt of a system and you can compile the "ivttunnel.c" program that is part of the IVT distribution, THEN you can tunnel into and out the network you are connected to, no matter how many stepping stones, firewalls and filters are in between. The trick is that the session you have (SSH, telnet, rlogin or a mix of them) between where you sit typing and the system your "typing at" is actually transmitting data between those two endpoints. And when you can send bytes from one end to the other, it is just a matter of encoding those bytes using a more convenient format: A Tunnel Is Born.

Obviously, this is at least bending the rules. But it can really be extremely handy to have decent file-transfer to such a system, or use a GUI for some database on the remote system where the restrictions on port forwarding frustrate that. So use it, don't abuse it.

The steps, in a little more detail, are:

Time for an example.

Suppose you have an AWS connection to some Linux box on which you have 'root' access. You want to use arbitrary, normal SSH tunnels and X-forwarding, but the system won't let you. The simplest, most generic solution is to create a tunnel from (say) the local port number 2222 on your local PC, to the remote SSH server (port 22) on the remote end. Such a connection will let you use IVT (or any other SSH client) directly from where you are to the AWS network as if all intermediate protection was gone. Also allows use of WinSCP or FileZilla or some such for file transfer to and from the remote system.

To achieve that, add this to your setup (or use the interactive setup screen):


   TUNNEL LOCAL tcp localhost:2222 localhost:22 acceptall

That says: Forward all TCP connections received on the localhost port 2222 (the PC where IVT runs on) to port 22 (SSH) of whatever system you started ivttunnel on at the remote end. If you omit the "acceptall", the tunnel will only accept incoming connections from "localhost" (the PC where IVT runs on). When you add the "acceptall", it will also accept (and forward) connections from other machines in the local network, turning your IVT-running PC into a proxy server for the AWS environment.

Start the "ivttunnel -m" program.

From this moment onward, connections made to port 2222 of your local PC end up on the SSH server port on the remote end, transparently passing through all stepping stones, firewalls and so on.
Start an SSH session (from the same IVT, or from another instance of IVT, or even an instance of another SSH client like PuTTY) to "localhost:2222". The login prompt of the remote end should appear, and you can login normally.
With "acceptall" other PC's can connect to your PC ports 2222 and also end up on the remote network.

That new SSH session is to an SSH server that you can control, so X-forwarding, tunneling all "just work". All traffic that is involved in this is encoded by the ivttunnel program and sent across as plain text. Depending on the speed and types of intermediate steps this may slow things down a little. But in this example case, it is hardly noticeable.
You can have multiple sessions to the localhost:2222 port, even from other PC's (when you use "acceptall"), so other people can use your tunnel to get to the target network.

Note that these sessions are all tunneled through your original session, which you will notice if that session is disconnected, blocked or delayed: All sessions immediately block or die when the ivttunnel traffic stops.
For example, if you go into setup (F3) on the session, that will block all traffic, causing all tunnelled connections to freeze. After a while, that will cause timeouts or other errors in the tunnel clients.
When the ivttunnel program on either end is stopped, or the original session is lost, all tunnel users get an immediate disconnect error.

Also note that traffic can be in both directions. Replace the word "LOCAL" in the above TUNNEL command by "REMOTE" and programs connecting on the remote AWS-end to the ports you specify end up on destinations in the local network.

You can even use "udp" instead of "tcp" and the ivttunnel program will tunnel datagrams between the two points. This can, for example, be used to make name servers on one end available to the other (tunnel udp port 53 for DNS).

Lastly, you can interactively alter the tunnel configuration in setup (F3, protocol, "Configure IVT tunnels". When you click APPLY, the new configuration is sent across to a remote ivttunnel program (if any) and the new tunnels apply.

Typing a "Q" on the session that started ivttunnel (which is the only data key that still has any effect) will quit the ivttunnel program, disconnecting all active tunnels (if any) and return things to normal (the original session will be restored).

These tunnels can also be configured from this setup screen.
Such interactively defined tunnels can also be saved as part of a profile.

See also SSH_FORWARD.
See TUNNEL LOCAL, TUNNEL REMOTE.
See TUNNEL DEBUG, TUNNEL PROGRAM, TUNNEL MINIMIZE.


12.7.2: TUNNEL specification (LOCAL/REMOTE)


TUNNEL LOCAL|REMOTE tcp|udp [sourcehost]:port desthost:port [acceptall]

This configures an IVT tunnel, that can be used to traverse firewalls, stepping stones and so on. A "host" can be specified as a name or (IPv4) dotted- decimal address. Currently, IPv6 is not supported for this type of tunnel.
A "port" can be a decimal number in the range 1 - 65536, or a name that can be translated using the services files.

The details are:

Instead of adding statements to the setup files, you can also use this setup screen to do it interactively. If you change the tunnels while the session is in tunnel mode (you've started ivttunnel -m) the changes will be communicated to the running ivttunnel programs and they will reconfigure the configuration.

The current setup can also be saved in the registry.
See also TUNNEL PROGRAM, TUNNEL DEBUG and TUNNEL MINIMIZE.


12.7.3: TUNNEL PROGRAM (set local tunnel support program)


TUNNEL "PROGRAM=path"


Default: $IVTDIR/bin/ivttunnel.exe

The source of the ivttunnel program is part of the IVT distribution. That program is designed to talk to an identical copy of itself at the other end.
The compiled version of that program (for Windows) is also part of the distribution, the default setting for this option points to that program.

IVT itself knows as little as possible about the actual internal workings of that program, except that it sends the specifications of the tunnels to use (as specified in the IVT setup file or interactive setup) to both ends.
IVT also recognizes a special code sent by the "ivttunnel -m" command to switch into tunneling mode, and sends a "quit" command to both ends when the user types a 'q'.
So the capabilities of the ivttunnel.c program can be extended if you want to, and such a patched ivttunnel can be configured for use by IVT.
The PROGRAM clause can be used to point IVT to such an alternate executable.

See also TUNNEL.
See also TUNNEL DEBUG.

This setting can also be changed from this setup screen, the current setting can be saved in the registry.


12.7.4: TUNNEL DEBUG (Set debug/trace file for the tunnel program)


TUNNEL "DEBUG=path"


Default: None.

The ivttunnel program accepts a "-d" argument for a debug file where the program will log what goes on (accepting sessions, forwarding data, etc).
This can be very handy to solve problems you may have in getting the tunnels to operate properly.
The file is always appended to, so it will keep growing until you either remove or truncate the file manually.
Make this field empty to prevent debugging taking place.

This setting can also be changed from this setup screen, the current setting can be saved in the registry.

See also TUNNEL.


12.7.5: TUNNEL CONFIG (Set extra configuration file)


TUNNEL "CONFIG=path"


Default: None.

The ivttunnel program accepts a "-c" argument for an extra configuration file in which you can specify extra tunnels to be made.
The CONFIG option can be used to specify the path to such a file.
The file can only contain local tunnel specifications, which have the exact same syntax as the TUNNEL LOCAL statements, except that the keywords TUNNEL and LOCAL must be omitted. For example:


   tcp *:ssh somesystem:ssh acceptall

would specify a tunnel listening on local port 22 (ssh) and forwarding to some remote system's SSH port, with other computers in the local network being able to access the tunnel when active.
The file can also contain comments (start with #) and empty lines.

The file is seldom used, it is probably easier to configure your tunnels using the local IVT setup files. The same "-c file" option can also be used when the master tunels program is started, to configure tunnels kon the remote end.

This setting can also be changed from this setup screen, the current setting can be saved in the registry.


12.7.6: TUNNEL MINIMIZE (start ivttunnel program minimized)


TUNNEL MINIMIZE
TUNNEL NO_MINIMIZE


Default: Minimize.

The ivttunnel program is started by IVT to handle the actual tunneling.
This is a normal Windows program that shows a window that will display a little about the ongoing operations.
By default, the program is minimized. When NO_MINIMIZE is used, a normal window will appear when you start the "ivttunnel -m" program on the remote end.

This setting can also be changed from this setup screen, the current setting can be saved in the registry.

This option is handy when you want to debug tunnels and want to keep an eye on things.

See also TUNNEL and TUNNEL DEBUG.


12.8.1: TELNET_KEEPALIVE (Set keep alive interval)


TELNET_KEEPALIVE seconds

Default: 0 (not used).
This is a per-session setting.

This option only applies to TELNET sessions.
You can specify a number of seconds between 0 and 3600. A value of zero turns this feature off (and is the default).
When enabled, IVT will transmit a TELNET NOP (no-operation) command on every TELNET session, every specified number of seconds. This should prevent the session from timing out, if you have a server somewhere that disconnects after a time of inactivity. However, not all hosts and devices seem to honor this.
Also, since the no-operation does not generate any user-data, an application (such as the Unix shell) may still timeout because it sees no user activity.
For such cases, see this keep alive example, which sends SPACE-BACKSPACE every so often, which is meant to be a no-operation.

The setting can also be changed from this setup-screen and is saved in the registry.

See also SSH_KEEPALIVE and TCP_KEEPALIVE.


12.8.2: TELNET_NEWENV (Enable/disable NEWENV RFC 1572)


TELNET_NEWENV
NO_TELNET_NEWENV

Default: NO_TELNET_NEWENV
This is a per-session setting.

The default for this is NO_TELNET_NEWENV, and this will cause IVT to claim ignorance concerning RFC 1572, the "New environment" option of the TELNET protocol. This part of the protocol is a bit of a mess; the first environment implementations had various problems so a replacement option was introduced in RFC 1572. Some hosts still have serious problems when a client starts to use this option, which is why IVT disables it by default. When it is enabled, IVT will answer queries from the host to send the environment with the new format. It will also reply WONT to requests for the old style environment.

Furthermore, the default value can be changed on a per session basis. This allows you to have a PRECONNECT script that changes the value for hosts that cannot handle the default.

It can also be set from this setup screen and is saved in the registry.


12.8.3: TELNET_NUL_AFTER_CR (Enable/disable sending NUL after a CR)


TELNET_NUL_AFTER_CR
NO_TELNET_NUL_AFTER_CR

Default: TELNET_NUL_AFTER_CR
This is a per-session setting.

This option is intended to work around bugs in some telnet servers that do not handle a NUL byte that a telnet client (such as IVT) sends after the user types Carriage Return.
RFC 854 states (see https://tools.ietf.org/html/rfc854) how this should work.
However, some implementations (such as M3) exist that neither send the NUL nor ignore it when received. When this causes a problem, you can try to switch this option off in this setup screen.

This option can be set per session and can be saved as part of a profile.


12.8.4: TELNET_TRACE (Enable/disable telnet trace)


TELNET_TRACE
NO_TELNET_TRACE

Default: NO_TELNET_TRACE
This is a per-session setting.

When you cannot login to a host, or cannot work "normally" with that host, it may be worthwhile to turn TELNET_TRACE on. This will show, on screen, what options the host requests and what IVT responds with. This may be used to gain insight into the TELNET protocol.
All RFC-numbers are named in the trace. You need to know about the TELNET protocol to be able to understand the output.

This option can be toggled (for the next session) from the setup screen.

Furthermore, the default value can be changed on a per session basis. This allows you to have a PRECONNECT script that changes the value for hosts that you want to trace, without getting debug in every new session.


12.8.5: TELNET_NEGOTIATE (Offer extra options to host)


TELNET_NEGOTIATE
NO_TELNET_NEGOTIATE

Default: TELNET_NEGOTIATE.
This is a per-session setting.

When a telnet session is established, the host and IVT usually exchange a flurry of options (WILL this, DO that, WONT do this, DONT do that).
When this option is on (default), IVT will send a bunch of options it would like to see enabled after it sees the first TELNET option of the host (which means that if you TELNET to a non-telnet port you won't get any telnet- specific negotiations). IVT will try:

The idea behind this is that broken implementations of telnet servers might forget to negotiate some options and can be mended this way.
NOTE: IVT used to negotiate these extra settings AFTER the first byte of normal session data was received. In version 17.0d this has changed to be the very FIRST thing after receiving a telnet option from the host. The change was required to support mainframes properly, which simply refuse negotiation of telnet options after the actual session has started. Especially the SGA (Suppress Go Ahead) option caused a problem - when IVT has not negotiated to turn Go Ahead off, it is required to send a GA command (which is slow, and the mainframe does not recognize the telnet command and echoes it, making garbage characters appear).
With NO_TELNET_NEGOTIATE in effect, the SGA option is the only one IVT will try. When the host insists on the exchange of Go Ahead commands, IVT will comply, of course.

This setting can also be changed per session (so you can use it in a script and set it depending on the host you are connecting to).
It can also be changed from this setup screen and is saved into the registry.


12.8.6: TELNET_TTYPE (Set TELNET terminal types)


TELNET_TTYPE name[,name...]

This is a per-session setting.

This TELNET option is described in RFC 1091. A host can request if the TELNET terminal supports this option. IVT will return a "WILL".
The protocol supports a number of different terminal names. If the host does not support a particular name, it will ask for the next name in the list. When the terminal (IVT, in this case) has exhausted the list of names, it repeats itself. The host should detect this and pick the best type.

Some hosts are buggy - if they don't like any of the names, they keep asking over and over again, and IVT replies the same (bad) names over and over again.
To protect against this, IVT will stop this game when the same name is about to be transmitted for the THIRD time. It will send a TELNET_TTYPE WONT once, and then stop responding to this query altogether (for the current session only, of course).

A Unix host will make the selected type the TERM environment variable.
You should set this to ivt whenever possible, but this requires that the host you connect to knows about the IVT terminal type (see terminfo and the ivt.tic file supplied in the distribution).

The default for the TELNET_TTYPE is "ivt,vt220,vt100,vt52".
It can be changed from this setup screen, as well.

When the TELNET_TRACE command is used, the actual string transmitted will be displayed on the screen as well.

In other words, you can use this setting in an attempt to set the TERM environment variable. However, "Your Mileage May Vary" as some hosts perform intricate procedures to try and determine the type of terminal during logon.
Usually, this involves sending enquiry strings to the terminal. Many hosts get this wrong - when you have a TELNET connection and the terminal type is already specified, enquiry commands should be avoided because they are fraught with problems. The TELNET protocol is much more reliable.
If you are stuck with hosts that DO use enquiry commands to figure out the type of the connected terminal, see also the IDENTIFY command that you can use to specify the IVT response to such an enquiry.

You can also change the value for this variable from this setup screen.
Furthermore, the default value can be changed on a per session basis. This allows you to have a PRECONNECT script that changes the value for hosts that cannot handle the default.


12.8.7: TELNET_TSPEED (Set TELNET terminal speed)


TELNET_TSPEED "string expression"

This is a per-session setting.

A telnet host can request the transmit and receive speeds of the terminal according to RFC 1079. IVT implements this RFC.

When this statement is used in an IVT.RC file, IVT will respond with a WILL when the host requests this feature. When the statement is NOT used, the response will be a WONT.
When the host requests the speed, whatever was specified will be transmitted, unless the specified string is too large (90 bytes) in which case it will default to "9600,9600".

According to the RFC, the argument must specify two numbers separated by a single comma. No spaces, leading zeroes or extra characters are allowed.
The first number is the transmit speed, the second the receive speed.
Example:


        TELNET_TSPEED "9600,38400"

What the host will do with this info is up to that host. Low values will probably make the host less verbose.
The RFC states: Many systems will only allow certain discrete terminal speeds.

You can also change the value for this variable from this setup screen.
Furthermore, the default value can be changed on a per session basis. This allows you to have a PRECONNECT script that changes the value for hosts that cannot handle the default.


12.8.8: TELNET_VAR (Set TELNET user variable)


TELNET_VAR name "string expression"

Default: Not used.
This is a per-session setting.

RFC 1408 describes a TELNET option whereby the host can request a number of variables to be transmitted by the remote (IVT) end of the connection.
This can be an environment variable or a user variable.
The host can request ALL variables of a certain type to be sent.
The statement:


        TELNET_VAR NICEVAR "NICE VALUE"

will set the user-defined variable NICEVAR to the value "NICE VALUE".
You can define as many variables as you like.
What the host does with a value is up to the host. Documentation on the possible variable names, their values and their effects should be available from the TELNET documentation of the host you connect to.

It does not seem to be supported by many hosts, though.


12.8.9: TELNET_LOCATION (Set TELNET location)


TELNET_LOCATION "string expression"

Default: Not used.
This is a per-session setting.

This is a sort of specialized TELNET_VAR case. The host can request the location of your terminal using RFC 946. When you have specified a value for the location like:


        TELNET_LOCATION "Room B204, main building"

then IVT will respond "WILL" when the host requests support for this RFC.
When no location is specified, IVT will respond with a "WONT".

What the host does with this information, is up to the host. It could put it in a "Who is logged in" list; use it on banner pages when printing output, etc. Not many hosts seem to either want it or use it, though.

The default value can be changed on a per session basis. This allows you to have a PRECONNECT script that changes the value for hosts that cannot handle the default.


12.8.10: TELNET_XDISPLAY (Pass X-display location)


TELNET_XDISPLAY displayname

This is a global setting.

The TELNET protocol allows you to pass the address of your X-windows server to the remote location. IVT will use the $IVT_NETW_HOST value to initialise this. Normally, this should work, unless the name resolving is not set up properly and the host you telnet into cannot find you by name. In that case, have a look at the TELNET_XDISP_IP option, which will generate an XDISPLAY setting based on the absolute IP-address.
If this does not work for you, consider something along the lines of:


   TELNET_XDISPLAY "$IVT_NETW_IP_ADDR:0"

or


   TELNET_XDISPLAY truenameofmyPC.my.domain:0

or


   TELNET_XDISPLAY 1.2.3.4:0

The host may not support this option.
Note that if your default display is NOT "0", you will HAVE to use a manual TELNET_XDISPLAY to set the proper name of your X-display.
Also note the setting of FORWARD_X: when that is set to AUTO, IVT will see if you have an X-server running. If you don't, no DISPLAY location is transmitted to the host. Use FORWARD_X FORCE in that case.

This global value can also be set from this setup screen.
See also TELNET_XDISP_IP.

NOTE: When you use kerberized telnet, and your kerberized telnet server supports a draft RFC to secure X, see FORWARD_X for a better way of using a local X server. In that case, it is best to use a:


TELNET_XDISPLAY displayname

to force IVT NOT to send a plain DISPLAY value to the host.


12.8.11: TELNET_XDISP_IP (Send display name with IP-address)


TELNET_XDISP_IP
NO_TELNET_XDISP_IP

This is a per-session setting.

IVT will, during start-up, determine the hostname and IP-address of the PC it runs on (see $IVT_NETW_HOST and $IVT_NETW_IP_ADDR). Based on the values it finds there, it will set the value of TELNET_XDISPLAY. This is useful if you telnet into a host and start X-applications there - the DISPLAY variable in the Unix environment is set correctly.

However, environments do exist where the host DNS setup is such that it cannot translate the name of your PC back to the correct IP-address. In that case, you have to set the DISPLAY variable to the absolute, dotted-decimal IP-address of your PC. The TELNET_XDISP_IP directive does this automatically, it will use the value of $IVT_NETW_IP_ADDR or $IVT_NETW_HOST as appropriate.
You can also change this in this setup screen.

Note that when you use this option, any explicitly set value for TELNET_XDISPLAY is lost.


12.9.1: SSH_ACCEPT (What to do with a new host key)


SSH_ACCEPT ASK
SSH_ACCEPT NEVER
SSH_ACCEPT AUTO

This is a dangerous setting!
Default: ASK.
This is a per-session setting.

It makes IVT automatically accept unknown host keys. Modified keys are never accepted without user confirmation!
See also SSH_HOSTKEYS to avoid this problem!

When an SSH session is established, one of the first things that happens is that the host sends its unique host key to IVT. The idea is that this key identifies the actual host. The fingerprint of the key (a relatively short digest of the actual key of at least 1024 bits) is displayed and the user is asked to verify this fingerprint and accept or reject the key. When rejected, the session is aborted. When accepted, the key is stored locally and the session proceeds. When the user later connects to the SAME host, IVT will check whether it is the same key. It could be a sign of a man-in-the-middle attack when the key is not the same as before. Another (and more common) cause is that the server software for SSH was re-installed and a new key was generated. Please note that the ONLY way to make sure that the host you get a session with is the host you think it is, is to manually check the fingerprint of the host. Kerberized telnet does not have this disadvantage.

Now, I have *never* seen *anybody* who actually verified the fingerprint of a host key. The vast majority of users simply detects a large dialog on the screen with lots of text and hexadecimal numbers with an <OK> and a <CANCEL> button. The lower regions of the brain are trained to hit OK before any conscious thought is spent on the matter. What you are supposed to do is to call the system administrator of the machine and read the fingerprint to him or her and have it verified...

The makers of PuTTY refuse to add a feature that automatically accepts new keys, and rightly so. However, in the case of IVT session groups an annoying start-up phase occurs when a new user connects to a whole array of hosts with a single mouse click, only to have to wade through a whole bunch of "Do you accept this host key" dialogs which are going to be OK-ed at face value.

Therefore, the SSH_ACCEPT feature can be set briefly on AUTO to make IVT accept all the initial keys of the hosts. Use with care. The strongest cryptography in the world will only give you a false sense of security if you do not know what you are doing...

This feature can be changed from this setup screen and is saved in the registry (though I strongly advise NOT to set this to ON by default).
See also BATCHMODE, which might be another reason for turning this on.
See also SSH_HOSTKEYS, which is a neat way to avoid the problem (centrally stored repository of SSH host keys).


12.9.2: SSH_AGENT (Enable authentication forwarding)


SSH_AGENT
NO_SSH_AGENT

Default: SSH_AGENT.
This is a per-session setting.

When IVT acts as an SSH agent, it will tell the SSH host that authentication requests required by SSH host based programs (such as SCP or SFTP) can be forwarded to IVT. When Pageant is running locally, IVT will use the private keys held by Pageant to do the authentication transparently. The upshot of this is that if you use a key pair for authentication, and use Pageant (either started automatically by IVT or started manually), you don't have to type passwords or pass phrases again. See SSH_PAGEANT_AUTO for more information.

The default for this setting is SSH_AGENT. There is no harm in this as IVT will automatically reject authentication queries from the host if Pageant has been stopped (or not started at all) or if Pageant does not have access to the proper keys.

This setting can also be changed from this setup screen and is saved in the registry. See also SSH_SHOW_AGENT.


12.9.3: SSH_BUGS (Configure detection of SSH bugs)

Default: Dynamic.
This is a per-session setting.

The first things that an SSH server sends to the client is an identification of the SSH server, identifying the version number of the protocol and the version number and manufacturer of the SSH server. For example:

        SSH-1.99-OpenSSH_3.5p1 FreeBSD-20030201

This identifies the server as being an OpenSSH server version 3.5 patch 1, running on a FreeBSD system. IVT (and Putty) study this string to see if the server has known bugs that it can avoid. By default, the test for all of these bugs is on the "Automatic" setting. When a match is found, IVT will print a message on screen during session initialization that it will assume that a particular bug is present. If that causes wrong results, the detection for that bug can be forced to OFF.
Similarly, when the bug is present in a server that IVT does not know about, the bug can be assumed present by setting it to FORCE. Examples:


SSH_BUG_RSAPAD OFF      # Assume bug is not present
SSH_BUG_RSAPAD FORCE    # Assume bug IS present
SSH_BUG_RSAPAD AUTO     # Inspect version string

Every bug has a global setting and a per-session setting, so if necessary you can use a script to force the issue for a particular bug, host or whatever.

Currently, IVT knows about the following SSH-2 bugs:

All of these settings can be changed in this setup screen. Settings are also saved in the registry.


12.9.4: SSH_CIPHERS (Specify SSH cipher preference)


SSH_CIPHERS AES,CHACHA20,BLOWFISH,3DES,WARN,DES,ARCFOUR


Default: See list.
This is a per-session setting.

During SSH session setup, IVT exchanges a list of ciphers (encryption algorithms) with the host. The cipher chosen to actually encrypt the session data is the first algorithm in common between server and IVT. IVT will inspect the list of available ciphers, the current supported list is the one above. The default is also listed above.

You can change the ORDER, not the NUMBER or TYPE of the ciphers. Thus, if you use this statement, you must specify all of the keywords above.
The WARN keyword is not really a cipher, but IVT will print a warning on screen for every cipher that gets selected past the warning point. The default for this is DES and ARCFOUR, which are considered old and weak.

If you don't want any warnings ever, specify WARN as the last one in the list.
If you specify WARN as the first entry in the list, you will ALWAYS get warnings. Such a warning is given for either client-to-server, server-to-client or both directions. This can be used to see which cipher gets selected.

This setting can also be changed in setup (SSH setup, click on the <Configure SSH ciphers> button in the SSH setup screen).
You can shuffle the order of the cipher algorithms there and the point below which a warning is issued.
This setting is also saved in the registry.


12.9.5: SSH_COMPRESSION (Enable SSH data compression)


SSH_COMPRESSION
NO_SSH_COMPRESSION

Default: NO_SSH_COMPRESSION.
This is a per-session setting.

When IVT establishes an SSH connection, one of the items negotiated between IVT and the host is whether data compression should be enabled.
By specifying NO_SSH_COMPRESSION, this feature is disabled and all data is sent and received without compression. It takes CPU cycles to compress data, but it increases the number of bytes in a single network packet, so it saves on network traffic. If your machines are fast and the network relatively slow, turning this on may be beneficial. When the machines are relatively slow and the network fast, it may actually slow things down. Your Mileage May Vary.

The setting can be changed from this setup screen and is saved in the registry.


12.9.6: SSH_DATA (Send command as data to SSH server)


SSH_DATA "string"
NO_SSH_DATA

Default: NO_SSH_DATA.
This is a per-session setting.

Normally, IVT will request a "shell" after a session to an SSH server is established. However, when this string is not empty for the session, it will send an "exec" command and the contents of this string. This should be a valid command for the operating system. Instead of obtaining an interactive shell, the remote system will start the specified program. Exiting that program will disconnect the session.
Setting string to empty or using NO_SSH_DATA restores the default behavior.

See also SSH_PSEUDO_TERM.
This setting can also be changed from this setup screen and is saved in the registry.


12.9.7: SSH_DEBUG (Enable SSH debugging)


SSH_DEBUG
NO_SSH_DEBUG

Default: NO_SSH_DEBUG.
This is a per-session setting.

When this setting is turned on, IVT will log the progress of SSH sessions to the screen. When packet logging is also enabled, the same logging is written to the IVT.LOG file as well to enable debugging of SSH problems.

The logging shows the progress of the various phases of the SSH connection establishment and the X-forwarding mechanisms.

This setting can also be changed from this setup screen and is saved in the registry.

See also DEBUG_TIMESTAMP.


12.9.8: SSH_DES_CBC (Enable non-standard use of DES in SSH)


SSH_DES_CBC
NO_SSH_DES_CBC

Default: NO_SSH_DES_CBC
This is a per-session setting.

The SSH-2 protocol technically allows encryption of the connection using the deprecated DES algorithm (56 bits cipher). IVT will by default not allow this weak cipher to be used on such connections, but can be forced to allow it using this directive. It does not mean it will actually be chosen - the host and IVT negotiate a protocol and the strongest common cipher will be chosen. Specifying SSH_DES_CBC merely means it will be part of the negotiated list.

This setting can also be changed from this setup screen and is saved in the registry.


12.9.9: SSH_FORWARD (SSH Port forwarding)


SSH_FORWARD LOCAL   [LocalIntf:]LocalPort host:port   [ACCEPTALL|ACCEPTLOCAL]
SSH_FORWARD DYNAMIC [LocalIntf:]LocalPort             [ACCEPTALL|ACCEPTLOCAL]
SSH_FORWARD REMOTE  [RemoteIntf:]RemotePort host:port [ACCEPTALL|ACCEPTLOCAL]

Default: None.
This is a per-session setting.
Forwarding is a technique to send data between the PC that IVT runs on and the remote system using SSH.
This version of IVT also has a tunnel-through-everything option, see TUNNEL for details.

See this setup screen for a description of forwarding, a.k.a. known as tunneling. This has the following possibilities:

1) A LOCAL forwarding accepts sessions on the LocalPort of the PC that IVT is
   running on and forwards the traffic to the SSH server that IVT is connected
   to. It then asks that server to send that traffic to the "host:port"
   specified as the second argument. Return traffic is, of course, routed
   back the same way.
   The LocalIntf part of the address can be used to specify the interface on
   which IVT is going to listen. Default is all interfaces, see below.

2) A REMOTE forwarding makes IVT ask the SSH server that it is connected to,
   to accept sessions on the specified RemotePort and forward that traffic to
   IVT. IVT will then send that traffic to the specified host:port specified
   as the second argument.
   The RemoteIntf part of the address can be used to specify the interface
   that the SSH server is going to listen on. Default is all, see below.

3) A DYNAMIC forwarding turns IVT into a SOCKS-4 proxy server on the given
   port. This means you can specify that address as a proxy server. The
   SOCKS-4 protocol implies that the proxy client will send the actual address
   (host name + port) to the proxy server, which will then connect to that
   address on behalf of that client. After the SOCKS-4 protocol is done, the
   connection is transparent.
   IVT can be a proxy client, too. See PROXY_TYPE for more information.

Example;


SSH_FORWARD LOCAL :telnet      some.host:telnet ACCEPTLOCAL
SSH_FORWARD LOCAL 127.0.0.1:23 some.host:23     ACCEPTLOCAL

The above two are equivalent (telnet is a well-known name for port 23).
When only a port name or number is used, it must be preceded by a colon to make it different from a host name.
This will make IVT listen on local port 23, and when somebody connects to that port, he will end up being connected to the TELNET port of some.host.
So "telnet localhost" is really a telnet to some.host.

This may seem silly, but remember that passwords are transmitted in clear text over the network. Using a tunnel means that the telnet data travels to the SSH server in encrypted form, and then gets sent to the destination. So, if "some.host" is the same host that IVT is connected to using SSH, the old- fashioned TELNET session is now secure. Also, many networks no longer allow port 23 to be used, so this may be the only way to connect to that port.

The ACCEPTLOCAL is used to force that only programs running on the same host as that IVT is running on can use this tunnel. An ACCEPTALL would turn the IVT PC into a proxy for the telnet service of some.host, but remotely connecting clients would then still be sending passwords in plaintext over the network; not a good idea.

As another example:

SSH_FORWARD REMOTE :12345 localhost:12345 ACCEPTALL

This will make the SSH server listen on port 12345, and everything connecting to that port would end up being connected to port 12345 of the PC that IVT is running on. That can be very handy to allow programs running on a host that is behind a firewall to connect to programs on the other side of that wall.
For exactly that reason, many servers will have a setting in their SSH configuration (AllowTcpForwarding) set to no, which makes the SSH server refuse such requests. Only the administrator of that host can change that setting. When the server refuses such a request made by IVT, that will trigger a diagnostic message in IVT.

The setup panels allow you to do the forwarding interactively, and those settings can be saved in the registry.
Forwarding that you set up using SSH_FORWARD are stored in an IVT.RC file, which make them more readable and maintainable (if you don't mind using a text-editor, that is).
And, of course, you can use SSH_FORWARD in a script to set up dynamic configurations.

The setup-panels show which forwarding can be edited and which cannot (since you can have a mix of both types (interactively defined and defined using a file) of forwarding in a single session).

The LocalIntf part of the LOCAL or DYNAMIC address has a special meaning (RFC 4254):

On Windows, you can create MULTIPLE local loopback addresses, so you can do things like:


   SSH_FORWARD LOCAL 127.0.0.10:443 somehostA:443
   SSH_FORWARD LOCAL 127.0.0.11:443 somehostB:443

This will set up separate listeners on two DIFFERENT ports 443 on the LOCAL machine! Port 443 is used for HTTPS, so if you use a browser to connect to https://127.0.0.10 you end up on the Webserver of somehostA, and if you connect to https://127.0.0.11 you end up on the Webserver of somehostB.
This is very convenient if the client software uses fixed, well-known ports (like, in this case, a browser which will use port 443 for HTTPS, always).

Note that the setup PROFILEs allow you to assign a specific set of port forwardings to a particular host, since you probably do not want the same set of port forwardings enabled for every host connection (actually, you can't even do that for local forwardings - they can only be forwarded for one single connection and you will get an error for subsequent sessions that attempt to establish the same forwardings again).

As a real-life example, consider this:


Script WebSmAdd LocalIP RemoteIP Msg
   HIDE
   IF Exists("C:\\Program files\\websm\\bin\\wsm.bat") THEN \
      MENU CALL "Start WebSM for $Msg" WebSm "$LocalIP" "$RemoteIP" "$Msg"
END
Script WebSm (LocalIP,RemoteIP,Msg)
   LOCAL p;
   HIDE

   SSH_FORWARD LOCAL "$LocalIP:9090"  "$RemoteIP:9090"  
   SSH_FORWARD LOCAL "$LocalIP:9443"  "$RemoteIP:9443"  # ASM menu
   SSH_FORWARD LOCAL "$LocalIP:9735"  "$RemoteIP:9735"  # Console terminals
   SSH_FORWARD LOCAL "$LocalIP:9940"  "$RemoteIP:9940"  

   FOR (p = 30000; $p < 30010; p = $p + 1)
      SSH_FORWARD LOCAL "$LocalIP:$p" "$RemoteIP:$p"    # Basic connections
   NEXT

   echo "\r\n~1This Windows PC connects '$LocalIP' to $Msg - "
   ECHO "WebSM being started - PATIENCE PLEASE"
   SEND "\r"

   # Start WebSM. Does not take parameters
   SHELLEXECUTE("open","C:\\Program files\\websm\\bin\\wsm.bat", \
                "","C:\\Program files\\websm\\bin","MINIMIZE");
END

In an AIX virtualization environment, WebSM is used to make remote sessions to the HMC (Hardware Management Console). Some of those HMC's are on networks only accessible through a PROXY connection. So. I have PROJECT file for the machines in the remote networks, and the project contains code like:


Script Startup
   # Add an entry to the "Scripts" menu
   CALL WebSmAdd("127.0.0.5","10.68.255.28", "aphmce2a (apaa2)")
   ...
END

When IVT starts up, the project is loaded, the STARTUP script is executed, and adds an entry to "Scripts" menu bar entry that says:


   Start WebSM for aphmce2a (apaa2)

Multiple projects can add multiple such entries, so the menu fills up with a list of HMC's that manage the various physical systems.
Next, I make a connection to one of those HMC machines using IVT and SSH, where IVT will handle proxies and firewalls and so on. Then, I click the menu entry for the HMC, and IVT will set up a bunch of necessary port forwardings AND start the HMC application. Unfortunately, I can't pass a parameter to WebSM, so I have to type "127.0.0.5" as the hostname to connect to in WebSM.
IVT tunnels the connections made by the local WebSM application and the HMC management screen appears...


12.9.10: SSH_GSSAPI_AUTHENTICATE (Kerberos authentication over SSH)


SSH_GSSAPI_AUTHENTICATE
NO_SSH_GSSAPI_AUTHENTICATE

Default: SSH_GSSAPI_AUTHENTICATE
This is a per-session setting.

This enables or disables the GSSAPI protocol in IVT.
GSSAPI: Secure login without passwords or SSH keypairs!

GSSAPI: Generic Security Services Application Program Interface.
This protocol is available in reasonably recent versions of SSH servers (since about 2010). Support in IVT was added in February 2014.

GSSAPI makes the underlying Kerberos protocol available to services such as SSH. Windows has embraced Kerberos as the underlying security protocol. When you login on a Windows PC in a typical company, the Active Directory machine gives you a token which proves your identity to servers in the domain. GSSAPI provides a way to use that token to authenticate to Unix (or Linux, or whatever other OS supports GSSAPI) so you can login without having to type a password again. Instant single sign-on! A number of things need to be set-up correctly to make this work:

Once the setup is complete, connect to the machine using IVT. Login should be instant and automatic, no password required.
Use SSH_DEBUG to obtain diagnostics in case of trouble.

For environments that do not have Active Directory, and alternative can be arranged using MIT Kerberos on both the client and the server. Google can help you to find more information on this. When you install MIT Kerberos for Windows on a PC, IVT will automatically detect that and attempt to use it.
See SSH_GSSAPI_ORDER for more details.

IVT supports ticket delegation (it will send your Windows credentials to Unix, so you can use Kerberos-aware commands such as SCP and SSH to authenticate actions from the Unix machine to other machines in the network).

See SSH_GSSAPI_DELEGATE, SSH_GSSAPI_ORDER and SSH_GSSAPI_SYSTEMUSER for more details.

This setting can also be changed from this setup screen and the current setting is saved in the registry.


12.9.11: SSH_GSSAPI_DELEGATE (Forward credentials yes/no)


SSH_GSSAPI_DELEGATE
NO_SSH_GSSAPI_DELEGATE

Default: NO_SSH_GSSAPI_DELEGATE
This is a per-session setting.

Delegation is also known as "ticket forwarding" or "Credential forwarding".
When you use GSSAPI to authenticate to a machine, this option will attempt to forward your credentials to the remote host. For example, on a Unix host you can then use the "klist" command to list those credentials. Kerberos enabled commands on Unix will then use your credentials when possible to authenticate file transfers, SSH sessions from the Unix machine to somewhere else and so on.

NOTE:
This delegation is not without dangers: your credentials are stored in a Unix file (though some more recent machines have a "key ring" that stores such data in a location that even the super user cannot read).
When a simple file is used, someone with root-access on that machine can then copy the data in that credentials file and steal your identity.
Those credentials are valid for (usually) 10 hours or so, during which a lot of mischief can happen.
Tickets should therefore not be delegated if you don't really need it.

When you use IVT, there is usually no need: logging in to another host is better achieved by just opening up another IVT tab. File transfer between machines can also be achieved through IVT. Either by using ZMODEM in IVT, or the file transfer available from the menu bar of IVT. Consider that before enabling ticket delegation.

When this option is enabled, IVT will print a message on-screen with the result of the attempted credential forwarding.
The idea is that you are aware of where you credentials are stored when successful, and are aware of the failure in case of problems (see below).

NOTE:
When you find that your tickets are NOT forwarded even when this option is enabled in IVT, the most likely cause is that the machine you SSH into is not "trusted" by the domain controller for delegation. When the machine is joined to the domain, the command "net join -T" should be used to inform AD that the computer you are joining to the domain can be trusted.
An existing machine trust-status can be altered by the domain administrator by checking an option on the "Delegation" tab of the computer-properties in AD. Make sure you delete existing tickets for the computer before retrying, as IVT will use cached tickets when it can (i.e.: log off and back on to the Windows domain before retrying ticket forwarding).

Another cause for failure with MIT Kerberos is that the checkbox "Flag this ticket as forwardable" was not checked when you obtained your TGT.

See also SSH_GSSAPI_AUTHENTICATE and SSH_DEBUG.

This setting can also be changed from this setup screen and the current setting is saved in the registry.


12.9.12: SSH_GSSAPI_ORDER (Use MIT, Windows or private GSSAPI)


SSH_GSSAPI_ORDER option,option,option
Option is one of SSPI, MIT or USER

Default: SSH_GSSAPI_ORDER MIT,SSPI,USER This is a per-session setting.

All three options must be specified, and no more than 3 can be specified.
This command determines the order in which IVT will attempt to use the 3 different supported GSSAPI solutions:

This order is normally sufficient: MIT Kerberos for windows is usually installed and configured on a PC that is not part of an AD domain. If IVT detects such a Kerberos installation, it will assume you did that for a reason and will therefore attempt to use it.

SSPI is the native Kerberos implementation of Windows. When your PC is part of a corporate network, and you logon to the domain when you turn your PC on in the morning, SSPI is the way to use your Windows credentials to log on to other machines. Such a machine will also typically NOT have MIT Kerberos for Windows on it, so there is no conflict.

A USER specified DLL is only used when you are experimenting with various Kerberos implementations, or want to use a Kerberos realm from a PC that is part of an active directory domain, etc.
You should know what you are doing if you put a user DLL first.
Use SSH_GSSAPI_USERDLL to specify the path to that DLL.

Note: IVT can only try a SINGLE one of these mechanisms. Once the connection to an SSH server is established, IVT tries to load support from one of the specified mechanisms, the first one specified in the order above, that is loaded successfully, is used.
The host will not accept a half-baked attempt followed by a retry using a different implementation.
Only change the order from the default setting if IVT selects the wrong mechanism. Use SSH_DEBUG to get diagnostics from the GSSAPI on screen, this will also show the mechanism IVT selects.

This setting can also be changed from this setup screen and the current setting is saved in the registry.


12.9.13: SSH_GSSAPI_PREFERRED (Use GSSAPI when offered)

SSH_GSSAPI_PREFERRED
NO_SSH_GSSAPI_PREFERRED

Default: SSH_GSSAPI_PREFERRED
This is a per-session setting.

When given the choice between SSH authentication using SSH keypairs and GSSAPI, IVT will normally prefer to try GSSAPI first.
This can be swapped by using NO_GSSAPI_PREFERRED, causing IVT to first try keypairs and when that fails to log you in, it will try GSSAPI.

The default is intended to facilitate migration from keypairs to GSSAPI.

See also SSH_GSSAPI_AUTHENTICATE.

This setting can also be changed from this setup screen and the current value is saved in the registry.


12.9.14: SSH_GSSAPI_REVERSELOOKUP (Reverse lookup of hostnames)

SSH_GSSAPI_REVERSELOOKUP
NO_SSH_GSSAPI_REVERSELOOKUP

Default: SSH_GSSAPI_REVERSELOOKUP
This is a per-session setting.

When GSSAPI authentication is enabled and the host offers it as an option, IVT will attempt to obtain a service ticket for the host you are connecting to. Reverse lookup means that IVT will attempt to lookup the IP-address it used to connect to the host in the first place to find the official, primary name of that host and use THAT to obtain the ticket.

When that fails, IVT will automatically fall back to the name of the host as you typed it. In a decent DNS environment, reverse lookup should always work correctly, but this option allows you to turn it off.

This setting can also be changed from this setup screen and the current setting is saved in the registry.


12.9.15: SSH_GSSAPI_SYSTEMUSER (Use Windows account as GSSAPI default)


SSH_GSSAPI_SYSTEMUSER
NO_SSH_GSSAPI_SYSTEMUSER

Default: NO_SSH_GSSAPI_SYSTEMUSER
This is a per-session setting.

Normally, a user name in IVT is supplied using the "Create session" panel, or the address-book, or using a CREATEGROUP or using scripting. All these methods take precedence over SSH_GSSAPI_SYSTEMUSER. When enabled, and a GSSAPI authentication is attempted, and at that point no user name is known, only then will IVT request the login name from Windows and use that when available.

When no name is found, or this option is deselected, IVT will give a "Login:" prompt and you will have to type a user name.

This setting can also be changed from this setup screen and the current setting is saved in the registry.


12.9.16: SSH_GSSAPI_USERDLL (Specify path to private GSSAPI DLL)


SSH_GSSAPI_USERDLL "path to a DLL file"

See SSH_GSSAPI_ORDER for details.
This is a global setting.

The DLL files are program code that implement the GSSAPI protocol. There exist various implementations of this protocol, this statement can be used to make IVT use a non-standard one.

Note: when you specify a special GSSAPI DLL, make sure the DLL is a valid GSSAPI implementation. Also, if the DLL you specify requires other DLL's to function (such as krb5_32.dll and companions), make sure those are found by Windows as well, and that they belong together.
Also note that IVT is either a 64-bit mode or a 32-bit mode program and can only load DLL's that match its architecture.

This setting can also be changed from this setup screen and the current setting is saved in the registry.


12.9.17: SSH_HOSTKEYS (Saved files with SSH host keys)


SSH_HOSTKEYS "filename"

Default: Not used.
This is a global setting.

This statement allows you to specify one or more files (you can have multiple SSH_HOSTKEYS statements) that contain exported SSH host keys. Such export files are created from this setup screen.

Normally, IVT will cache the key that uniquely identifies an SSH host in the registry.  Every time a connection to a host is established, the stored keys are searched to make sure you connect to the same host each time.
Since these registry caches are unique per user, every user has to accept all the SSH keys once. The user is supposed to verify the correctness of the host key fingerprint, but no users I know actually do this.

To minimize the security risks, an administrator can provide a central store in which the known keys of the hosts are stored. IVT will first search such files before looking at the local registry.

This also allows you to carry a removable medium (floppy, USB token) that contains such a file (or files). If you set the SSH_ACCEPT setting to NEVER, it means that the resulting setup will only make SSH connections to pre-authenticated hosts, ruling out a man-in-the-middle attack.

If an exported key becomes outdated (the same host has a new key), IVT will notice this and allow the user to store the updated key in the registry. It will keep complaining about the bad key in the file until you update that, too.

See also SSH.
See also SSH_ACCEPT.


12.9.18: SSH_HOSTKEY_ALGS (configure host key algorithms)


SSH_HOSTKEY_ALGS ED25519,ECDSA,RSA,DSA,WARN

Default: As shown.
This is a per-session setting.

IVT supports a variety of SSH-2 host key types, and allows you to choose which one you prefer to use to identify the server. Configuration is similar to cipher selection.

IVT currently supports the following host key types:

If IVT already has one or more host keys stored for the server, it will prefer to use one of those, even if the server has a key type that is higher in the preference order (to prevent host key acceptance prompts).
However, when the SSH_ACCEPT AUTO setting is used, no prompt will be displayed and in that case IVT will always use the configured preference order.

In all other cases, IVT will choose a key type based purely on the preference order you specify.

If the first key type IVT finds is below the 'warn below here' line, you will see a warning displayed when you make the connection, similar to that for cipher selection.

This setting can also be changed interactively in setup and is stored in the registry.


12.9.19: SSH_INTERACT_PWD (Enable SSH interactive passwords)


SSH_INTERACT_PWD
NO_SSH_INTERACT_PWD

Default: SSH_INTERACT_PWD
This is a per-session setting.

When IVT is establishing an SSH connection, it exchanges a list of protocols for authentication. Currently, IVT recognizes the public key, passwords, GSSAPI and keyboard-interactive protocols. This last protocol can be disabled by specifying NO_SSH_INTERACT_PWD. SSH uses this to transmit a prompt and request an answer from the user (for example RSA-ID authentication, or other token-based authentication protocols).
Disabling this will force the use of either a public key, GSSAPI or the normal password method.

The default setting is SSH_INTERACT_PWD (allow keyboard interactive method).
It can be changed from this SSH setup screen, and is saved in the registry.


12.9.20: SSH_KEEPALIVE (Set keep alive interval)


SSH_KEEPALIVE seconds

Default: 0 (off).
This is a per-session setting.

You can specify a number of seconds between 0 and 3600. A value of zero turns this feature off (and is the default).

When enabled, IVT will transmit an SSH NOP (no-operation) command on every SSH session, every specified number of seconds. This should prevent the session from timing out, if you have a server somewhere that disconnects after a time of inactivity. However, not all hosts and devices seem to honor this.

Also, since the no-operation does not generate any user-data, an application (such as the Unix shell) may still timeout because it sees no user activity.
For such cases, see this keep alive example, which sends SPACE-BACKSPACE every so often, which is meant to be a shell-level no-operation.

Note that keepalives are not always helpful. They help if you have a firewall which drops your connection after an idle period; but if the network between you and the server suffers from breaks in connectivity then keepalives can actually make things worse. If a session is idle, and connectivity is temporarily lost between the endpoints, but the connectivity is restored before either side tries to send anything, then there will be no problem; neither endpoint will notice that anything was wrong. However, if one side does send something during the break, it will repeatedly try to re-send, and eventually give up and abandon the connection. Then when connectivity is restored, the other side will find that the first side doesn't believe there is an open connection any more. Keepalives can make this sort of problem worse, because they increase the probability that IVT will attempt to send data during a break in connectivity. Other types of periodic network activity can cause this behavior; in particular, SSH-2 re-keys can have this effect. See SSH_KEX_MINUTES. Therefore, you might find that keepalives help connection loss, or you might find they make it worse, depending on what kind of network problems you have between you and the server.

The setting can also be changed from this setup-screen and is saved in the registry.
See also TELNET_KEEPALIVE and TCP_KEEPALIVE.


12.9.21: SSH_KEX (Specify SSH key exchange preference)


SSH_KEX ECDH,DHGEX,DHGROUP14,RSA,DHGROUP1,WARN

Default: As shown.
This is a per-session setting.

During SSH session setup, IVT exchanges a list of key exchange algorithms with the host. The algorithm chosen to actually do the key exchange is the first algorithm in common between server and IVT. IVT will inspect the list of available algorithms, the currently supported list is the one above. This is also the default.

You can change the ORDER, not the NUMBER or TYPE of these. Thus, if you use this statement, you must specify all of the keywords above.
The WARN keyword is not really an algorithm, but IVT will print a warning on screen for every one that gets selected past the warning point.
If you don't want any warnings, specify WARN as the last one in the list.
If you specify WARN as the first entry in the list, you will ALWAYS get warnings. This can be used to see which one gets selected.

This setting can also be changed in setup (SSH setup, click on the <Configure SSH Key Exchange> button in the SSH setup screen).
You can shuffle the order of the algorithms there and the point below which a warning is issued.

See also SSH_KEX_MINUTES and SSH_KEX_MBYTES.
This setting is also saved in the registry.


12.9.22: SSH_KEX_MINUTES and SSH_KEX_MBYTES (key-exchange maximums)


SSH_KEX_MINUTES Minutes
SSH_KEX_MBYTES  number-MB

Defaults: SSH_KEX_MINUTES 60 and SSH_KEX_MBYTES 1024.
This is a per-session setting.

If the session key negotiated at connection start-up is used too much or for too long, it may become feasible to mount attacks against the SSH connection. Therefore, the SSH-2 protocol specifies that a new key exchange should take place every so often; this can be initiated by either the client or the server.

These options control how often IVT will initiate a repeat key exchange ('rekey'). You can also force a key exchange at any time from this setup screen.

While this renegotiation is taking place, no data can pass through the SSH connection, so it may appear to 'freeze'. When you enable SSH_DEBUG, you can see the exchange happening on-screen. Usually the same algorithm is used as at the start of the connection, with a similar overhead. When you change the order of preference in the IVT key-exchange setup dialog, the new setting will be used during rekeys.

You might have a need to disable time-based rekeys completely for the same reasons that keep alives aren't always helpful. If you anticipate suffering a network dropout of several hours in the middle of an SSH connection, but were not actually planning to send data down that connection during those hours, then an attempted rekey in the middle of the dropout will probably cause the connection to be abandoned, whereas if rekeys are disabled then the connection should in principle survive (in the absence of interfering firewalls). For these purposes, rekeys have much the same properties as keep alives. (Except that rekeys have cryptographic value in themselves, so you should bear that in mind when deciding whether to turn them off).
Note, however, that the SSH server can still initiate rekeys.

Disabling data-based rekeys entirely is a bad idea. The integrity, and to a lesser extent, confidentiality of the SSH-2 protocol depend in part on rekeys occurring before a 32-bit packet sequence number wraps around. Unlike time-based rekeys, data-based rekeys won't occur when the SSH connection is idle, so they shouldn't cause the same problems.


12.9.23: SSH_KEYFILE (Specify private key file for SSH)


SSH_KEYFILE filename
SSH_KEYFILE CLEAR

Default: %HOMEDRIVE%%HOMEPATH%/sshkey.ppk This is a global setting.

ATTENTION: when "filename" does not exist, it is quietly ignored. This allows you to have a general (network) configuration file that is used by many users, some of which have a key file and some do not (on a personal drive).

ATTENTION: You can have MULTIPLE key files, either by using the SSH_KEYFILE option multiple times (one for each file) or by using a ";" separator when you type the value in the SSH setup screen. When Pageant is started by IVT, all files that IVT knows about are passed to Pageant.

One of the major advantages of SSH-2 is the possibility to authenticate to the remote system using a key pair. Such a key pair has a public half (which does not need to be kept secret) and a private part (which must be guarded carefully). The public part must be stored in a file in the home directory of the user. When a connection is made to an SSH-2 host, IVT will offer public- key authentication when a file name has been specified with the SSH_KEYFILE directive. When the server can find the public key in the home directory of that user, it will result in a prompt for the pass phrase for the private key file (assuming the private key is not stored in plain text, which is a bad idea).

The trick with key pairs is that IVT can prove to the SSH-2 server that it knows the value of the private key without disclosing that key in any way.
Keypairs are unique, and there is no known way to find the private key given the public key, but data encrypted with the private key be decrypted only by the corresponding public key. Data encrypted with the public key can be decrypted only with the private key. The security of SSH is based on this elegant bit of cryptography. The SSH server generates a random session key for a fast secret-key algorithm (since public/private key operations are very slow because they use huge prime numbers). This fast key is encrypted using the public key, and only someone with access to the private key can decrypt this and prove to the SSH server that it was able to do so. The AES, triple-DES or other cipher is then used to encrypt the actual data on the session.

To set this up, you must do the following:

Improvements over Putty:

Summary: When you use a key pair, you get instant access to all the accounts that have your public key as an authorized_key. Authentication agent forwarding even takes care of authenticating Unix-to-Unix commands such as SSH and SCP. When you use these commands between two machines and/or accounts that have your public key listed, you can use the commands without entering passwords or pass phrases for as long as Pageant is running.


12.9.24: SSH_LOGDATA (Log SSH packet data to file)


SSH_LOGDATA
NO_SSH_LOGDATA

Default: NO_SSH_LOGDATA.
This is a per-session setting.

This setting will cause IVT to log all received and transmitted SSH protocol packets to a file named IVT.LOG. IVT will first attempt to create this file in the "Documents" folder of the current user, fall back to the home directory when that fails, then fall back to the current directory.

It will show the exact time, packet type in hexadecimal, decimal and name, length of the packet, the entire (decrypted) contents of packet in both hexadecimal and ASCII representations.
When SSH_DEBUG is also enabled, the messages that appear on-screen to show the progress of the SSH sessions are also written to this file so the data can be related to certain events in the SSH protocol.

Needless to say, turning this on will slow down your SSH connection and can rapidly fill your disk with logging data. Also, if you have multiple SSH sessions in IVT, the data from all of these sessions is written to the same file. IVT will create the file when it does not exist, and will append the data to any existing file. Intended for debugging purposes only.
The file can be closed without exiting IVT by clicking on the <Close log> button in the SSH setup screen.

See also SSH_DEBUG.
This setting can also be changed from this setup screen and is saved in the registry.
It is a Bad Idea to enable this permanently.


12.9.25: SSH_PAGEANT_ALLOW (Allow use of Pageant)


SSH_PAGEANT_ALLOW
NO_SSH_PAGEANT_ALLOW

Default: SSH_PAGEANT_ALLOW
This is a per-session setting.

See here for a description of Pageant, a program to handle private keys.
If you use SSH keypairs (GSSAPI is a superior alternative), it is very convenient to let Pageant handle those keys for you. In exceptional cases, you may not want to use a key stored in Pageant for a particular host (or set of hosts). In such cases, NO_SSH_PAGEANT_ALLOW can be used to prevent IVT from using Pageant when trying to authenticate. It can then fall back to a separate SSH_KEYFILE, or - when all else fails, passwords - to get you logged in.

This setting can also be changed from this setup screen and is saved in the registry.

See also SSH_PAGEANT_AUTO and SSH_PAGEANT_PATH.


12.9.26: SSH_PAGEANT_PATH/AUTO (Start SSH authentication agent)


SSH_PAGEANT_AUTO
NO_SSH_PAGEANT_AUTO
SSH_PAGEANT_PATH "pathname-expr"

Default: Pageant in $IVTDIR or in PATH.
This is a global setting.

Pageant is the PuTTY agent, a service that can also be used by IVT. Pageant runs on the local PC and holds a user's private keys all decoded and ready for use by client programs such as PuTTY and IVT. As long as Pageant is running, the user does not have to re-enter the pass phrases for the keys when a session is started. Moreover, the services of Pageant can be forwarded to the remote (Unix) host. If you start SSH-enabled programs there (such as SSH or SCP), the authentication of the users can be handled by IVT and Pageant in a transparent way (the user does not have to re-enter the pass phrase on Unix). This makes programs such as SSH and SCP a lot more usable. The drawback is the risk that somebody else uses your PC and can access your private key without the need to type the pass phrase. Adequate protection of your PC and locking the screen and keyboard after a period of inactivity is important! See also SSH_SHOW_AGENT.

All of this Pageant business is very powerful and user friendly, yet few users of PuTTY seem to use it. To promote its use, IVT will, during start-up, check if Pageant is running. If not, and the executable is found, it will start Pageant and pass it the name of the users SSH_KEYFILE (if any). This will cause Pageant to ask for the pass phrase (if any), and afterwards the key is ready for use.  Pageant displays a small icon in the system tray and can be controlled via that icon (stop, add keys, remove keys, etc).
Automatic starting of Pageant is done only when:

IVT will even wait for the Pageant "Enter Passphrase" window to disappear before continuing. It will give you up to a minute for this. When IVT regains the focus, it will abort any waits on Pageant starting up. The purpose of this is to allow you to create groups of SSH sessions that all require Pageant.
The first SSH session will wait for Pageant to start, so all sessions can continue without the need for passwords or pass phrases.

The default for this IVT setting is SSH_PAGEANT_AUTO, and SSH_PAGEANT_PATH is set to the empty string. This will cause IVT to look in $IVTDIR and in the PATH environment variable, looking for "pageant.exe". If you want to prevent IVT from trying to start Pageant, use NO_SSH_PAGEANT_AUTO. If IVT cannot find Pageant because it resides in a different directory, use SSH_PAGEANT_PATH to specify the full name of the executable, like:


   SSH_PAGEANT_PATH "c:/Program Files/Putty/pageant.exe"

There is also a button in the SSH setup screen to force a manual start of Pageant, even with a just-modified path of a key file, and a 'browse' button to search for an alternate executable.

Also, the special IvtFunction script function can be used to force Pageant to stop.

The setting can also be changed from this setup screen and is saved in the registry (when not empty).
See also SSH_KEYFILE and SSH_AGENT.
See also SSH_PAGEANT_ALLOW.


12.9.27: SSH_PSEUDO_TERM (Enable allocation of SSH terminal)


SSH_PSEUDO_TERM
NO_SSH_PSEUDO_TERM

Default: SSH_PSEUDO_TERM
This is a per-session setting.

When IVT establishes an SSH session, it usually requests a terminal session with a shell in it. Such a network terminal is called a pseudo terminal or PTY.
When NO_SSH_PSEUDO_TERM is specified the virtual terminal is not created and you end up with a session that has no decent line editing, resizing and so on. This is (probably) only useful in combination with SSH_DATA, which will send a command to the SSH server instead of requesting a shell.
The default is, of course, to allocate a pseudo terminal.

The setting can be changed from this setup screen and is saved in the registry.


12.9.28: SSH_SENDENV (send environment variables on session)


SSH_SENDENV name
SSH_SENDENV name=value
SSH_SENDENV CLEAR

Default: Not used.
This is a per-session setting.

This allows you to set environment variables in the remote SSH session.
Most hosts disallow this, or allow only a specific set of names, see AcceptEnv in the documentation of your SSH server.

IVT will try to send what you specify, and there is no feedback from the server when it accepts or refuses such a request.

The first form (just a name) will request the value from the current environment. When found, it will transmit that value to the host. When the name is not in the environment, it is skipped quietly (unless you have turned SSH_DEBUG on).

When the second form is used (NAME=VALUE), that constant value is used. You can, of course, use a script to generate a statement like this with a non- constant value).

There are two lists of environment names you can set with this statement:
1) The global list (sent first).
2) The per-session list (which is sent next).

When you use SSH_SENDENV in an IVT.RC file, it modifies the global list.
When you use SSH_SENDENV as a statement in a script running for a session, it modifies the per-session list (unless you use the GLOBAL qualifier).

The CLEAR keyword deletes the selected list.

Currently, there is no interactive method to specify SSH_SENDENV, it can only be used in an IVT.RC configuration file or a script.


12.9.29: SSH_SHOW_AGENT (Show authentication agent being used)


SSH_SHOW_AGENT
NO_SSH_SHOW_AGENT

Default: SSH_SHOW_AGENT.
SSH_SHOWAGENT is on older alias for this command.
This is a per-session setting.

Also known as "SSH agent hijack protection".
When IVT has enabled SSH authentication forwarding, this introduces a security problem. What happens is that the host can ask the agent on your PC to authenticate you. All such requests presumable originate from programs you start yourself (such as SCP or SFTP). However, it is technically possible to abuse such a channel when the host you are logging in to has been compromised.
This technique is called "agent hijacking".

In this way, illegal access to your private keys can be obtained. To guard against this (rather unlikely) scenario, IVT will, by default, print a line of output on the screen every time the authentication agent feature is used.
When this happens while you do not expect it, it is best to disconnect immediately and investigate.

This feature can be turned off when you use agent forwarding a lot and dislike the extra output. The default is SSH_SHOW_AGENT.

NOTE: See also VOLATILE, this setting is typically one you do not want to end up being permanently disabled.

See also SSH_AGENT.
This setting can also be changed from this setup screen.
It is also saved in the registry.


12.9.30: SSH_SHOW_DEBUG (Show SSH DEBUG messages on screen)


SSH_SHOW_DEBUG
NO_SSH_SHOW_DEBUG

Default: NO_SSH_SHOW_DEBUG.

The SSH protocol has an option whereby the host can send information to the client (IVT in this case) which may or may not be interesting for the user.
Some hosts send very detailed technical data that the average user really does not care about.
But in case of problems it may be useful to show this information on screen.
This options determines whether such information messages are displayed on screen or not.

The SSH_DEBUG option is similar but separate: It shows ALL the SSH protocol negotiations between IVT and server on-screen.
The SSH_SHOW_DEBUG can be set to false if when SSH_DEBUG is off and you find the host messages distracting or unnecessary.
When SSH_DEBUG is on, these debug messages will always be displayed.
The default is off.

This setting is saved in the registry and can also be changed in this setup screen.


12.9.31: SSH_TRIVIAL_AUTH (SSH allows trivial access)


SSH_TRIVIAL_AUTH DISCONNECT
SSH_TRIVIAL_AUTH POPUP
SSH_TRIVIAL_AUTH DISPLAY
SSH_TRIVIAL_AUTH ALLOW

Default: SSH_TRIVIAL_AUTH DISCONNECT

Suppose that a malicious server lets you log in without any authentication at all, and then started the session by sending text that looked exactly like IVT prompting you for your private key passphrase or password.
If you didn't know for sure that you didn't expect that prompt, the server might trick you into entering that, which should not have been sent to any remote server.
If the server had also acquired a copy of your encrypted key file (which, for example, you might have considered safe to copy around because it was securely encrypted), then this would give it access to your private key.

This is a user-interface weakness rather than the usual kind of software vulnerability, so it requires a user-interface fix.

This setting is saved in the registry and can also be changed in this setup screen.


12.9.32: SSH_TERM (Set terminal type for SSH)


SSH_TERM terminal-type

Default: xterm
This is a per-session setting.

When IVT establishes an SSH session, one of the bits of information required by the remote host is the type of terminal being emulated. For example, PuTTY emulates an "xterm" by default, IVT is a "vt220" emulator. Unix hosts can be given the IVT.TIC (terminfo file) to enable few IVT-specific features, thus in some cases the value for this setting should read "ivt".

For TELNET sessions, it is possible to specify a list of terminal types. The host can reject a type it does not know about (say "ivt") and try the next in the list (say "vt220"). However, it unfortunately does not work this way in SSH. You can only specify a single value, which will (on a Unix host) end up in the TERM environment variable. It is of course possible to write IVT scripts that set this depending on the host you connect to, but it lacks the robustness of the telnet solution. Pity.

The default for this setting is therefore "xterm".
It can be changed from this setup screen and is saved in the registry.


12.9.33: SSH_XAUTH (Set SSH X11 authentication mode)


SSH_XAUTH MIT-1
SSH_XAUTH XDM-1

Default: SSH_XAUTH MIT-1
This is a per-session setting.

This is used when X-forwarding is used on SSH connections. IVT will tunnel X-traffic from the SSH connection to an X-server. Normally, the host itself would do the connection and authenticate itself to the X-server. Since the X-server now talks to IVT, IVT will have to authenticate to the server. There are two such authentication protocols:

1) MIT-MAGIC_COOKIE-1
2) XDM-AUTHORIZATION-1

This setting allows you to force the choice. The setting can be changed from this setup screen and is saved in the registry.

See also XAUTH_DELAY.


12.10: Serial communications

12.10.1: BAUD (Set baud rate for serial connection)


BAUD speed

Default: BAUD 19200
This is a per-session setting.

This sets the speed for a serial connection.
The default baud rate is 19200. Valid values for speed are 110, 300, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 56000, 57600, 112000 and 115200, 128000 and 256000.
If you specify another speed, IVT will try to use that. Results will vary depending in the actual device you use.

This setting can also be changed from setup.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


12.10.2: CARRIERSTATUS (Serial status line indicator on/off)


CARRIERSTATUS
NO_CARRIERSTATUS

For serial connections only.
Default: CARRIERSTATUS.
This is a per-session setting.

Show a red, blinking C in status-line when Carrier Detect is not asserted.
NO_CARRIERSTATUS means that no indicator will be shown when the carrier is missing. On by default. See Carrier Detect for an explanation of this signal.

This signal is very handy to monitor the connection status for modem dialups.
Some modems always leave carrier off, which can make the blinking annoying, which is why you can turn it off.
This setting can also be changed from setup.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


12.10.3: CTSRTS (Turn serial hardware handshake on/off)


CTSRTS
NO_CTSRTS

Serial sessions only.
This is a per-session setting.

Means "Clear to send/Request to send". This is a flow-control protocol.
CTS/RTS protocol ON (CTSRTS) or off (NO_CTSRTS) for serial connections.
When turned on, this will cause hardware flow-control on the serial connection.  This will only work properly if the other end of the serial connection is also set up to use hardware flow control and the physical connection (cable) is correct.

This setting can also be changed from setup.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


12.10.4: DBITS (Set number of data bits for serial lines)


DBITS 7
DBITS 8

Default: 7.
This is a per-session setting.

Set number of data bits to use for a serial connection.
The default number of data bits is 8. Valid values are 7 and 8.

This setting can also be changed from setup.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


PARITY type
Default: Even.
This is a per-session setting.

Parity to use on a serial connection. A parity bit counts the number of 1 bits in a byte, giving a kind of error-check. Why you should want to do this is unclear, since there is no way to correct any transmission error and the overhead involved is significant (1 bit extra for every 8 bits of data is 12.5% overhead). Any transmission error will show up on the screen anyway.
The type can be one of:

None No parity bit set. This is the default. It avoids the overhead.
Odd Force odd parity. Parity-bit is 1 when number of 1-bits is odd.
Even Force even parity. Parity bit is 1 when number of 1-bits is even.
Space Generate a parity bit that is always set to zero.
Mark Generate a parity bit that is always set to 1.

This setting can also be changed from setup.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


12.10.6: RING (Use PC-speaker as phone-ringer for serial lines)


RING
NO_RING

This applies to serial sessions only.
Default: RING.
This is a per-session setting.

Rings PC-bell when modem rings (or not, when NO_RING).
If there is no phone connected to your modem, this allows you to hear an incoming call. Proper operation depends on the cable between your PC and your modem.
The serial signal called 'Ring Indicator' (RI) is monitored for this.

This setting can also be changed from setup.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


12.10.7: SBITS (Set number of stop bits for serial lines)


SBITS 1
SBITS 2

Set number of stop bits to use for a serial connection.
Default: 1.
This is a per-session setting.

The stop bits indicate the length of the pause before the next character is transmitted over a serial line. This gives the host a bit of a breathing space which allows it to process the character. Your host must be pretty awful old if it needs two stop bits.

This setting can also be changed from setup.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


12.10.8: SR_DSR (Serial Data Set Ready control)


SR_DSR   (default)
NO_SR_DSR

Default: SR_DSR
This is a per-session setting.

This command controls what IVT does in response to the raising/lowering of the Data Set Ready signal of a serial device.
The default is SR_DSR, which implies that IVT will not send characters to a device that is apparently turned off (DSR is not asserted).

When you specify NO_SR_DSR, IVT will ignore the current state of the DSR signal and send data to the device regardless. Also, the modem indicator will not show a blinking red M, which normally indicates that the modem is turned off.

This setting can also be changed from this setup screen.
It is also saved in the registry.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


12.10.9: SR_DSR_INPUT (DSR Sensitivity)


SR_DSR_INPUT
NO_SR_DSR_INPUT

Default: NO_SR_DSR_INPUT
This is a per-session setting.

If this member is set to ON, the DSR (data-set-ready) signal is monitored for output flow control. If this member is ON and DSR is turned off, output is suspended until DSR is asserted again.
When NO_SR_DSR_INPUT in in effect, the data-set-ready signal is ignored.

This item can also be changed from this setup screen and is saved in the registry.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


12.10.10: SR_DTR_CTRL (DTR flow control)


SR_DTR_CTRL ENABLE | DISABLE | HANDSHAKE

Default: ENABLE
This is a per-session setting.

DISABLE:
   Disables the DTR line when the device is opened and leaves it disabled.

ENABLE:
   Enables the DTR line when the device is opened and leaves it on.

HANDSHAKE:
   Enables DTR handshaking.

This setting can also be changed from this setup screen.
It is also saved in the registry.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


12.10.11: SR_RTS_CTRL (Serial RTS/CTS flowcontrol)


SR_RTS_CTRL ENABLE | DISABLE | HANDSHAKE | TOGGLE

Default: HANDSHAKE
This is a per-session setting.

DISABLE:
   Disables the RTS line when the device is opened and leaves it disabled.

ENABLE:
   Enables the RTS line when the device is opened and leaves it on.

HANDSHAKE:
   Enables RTS handshaking. The driver raises the RTS line when the
   "type-ahead" (input) buffer is less than one-half full and lowers the RTS
   line when the buffer is more than three-quarters full.

TOGGLE:
   Specifies that the RTS line will be high if bytes are available for
   transmission. After all buffered bytes have been sent, the RTS line will
   be low.

This setting can also be changed from this setup screen.
It is also saved in the registry.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


12.10.12: SR_WRITETIMEOUT (Serial data write timeouts)


SR_WRITETIMEOUT millisecs

Default: 0 (infinite).
This is a per-session setting.

This sets the maximum timeout that IVT will allow for a write operation to complete on a serial connection. Due to handshaking it can be a (very) long time before a write completes normally, and IVT will patiently wait in the background until it completes. Therefore, an infinite timeout is the default and usually this should give no problems.
However, if you use special (experimental) serial devices, it may be necessary to set a timeout to wake things up again.

It can also be set from this setup screen and is saved in the registry.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


12.10.13: SR_XONOFF_OUT/SR_XONOFF_IN (Serial flow control)


SR_XONOFF_IN
NO_SR_XONOFF_IN
SR_XONOFF_OUT
NO_SR_XONOFF_OUT

FLOWREMOTE is an old alias for SR_XONOFF_IN.
FLOWLOCAL is an old alias for SR_XONOFF_OUT.

This is a per-session setting.
This is for serial lines only.

SR_XONOFF_OUT (FLOWLOCAL):
Indicates whether XON/XOFF flow control is used during transmission. If this member is TRUE, transmission stops when the XOFF character is received and starts again when the XON character is received.
When NO_SR_XONOFF_OUT is activated, the XON/XOFF characters are treated as any other character.

SR_XONOFF_IN (FLOWREMOTE):
Indicates whether XON/XOFF flow control is used during reception. If this member is ON, the XOFF character is sent when the input buffer comes within SR_XOFF_LIMIT bytes of being full, and the XON character is sent when the input buffer comes within SR_XON_LIMIT bytes of being empty.

This method of flow control is less reliable than hardware flow control (see CTSRTS) but that requires a serial cable with the proper wires.

This setting can also be changed from setup and is saved in the registry.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


12.10.14: SR_XOFF_LIMIT (XOFF limit)


SR_XOFF_LIMIT number

Default: 128
This is a per-session setting.

The minimum number of free bytes allowed in the input buffer before flow control is activated to inhibit the sender. Note that the sender may transmit characters after the flow control signal has been activated, so this value should never be zero. This assumes that either XON/XOFF, RTS, or DTR input flow control is specified. The maximum number of bytes in use allowed is calculated by subtracting this value from the size, in bytes, of the input buffer.
The read buffer is 2KB in IVT, valid values are forced automatically.

This setting can also be changed from this setup screen.
It is also saved in the registry.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


12.10.15: SR_XON_LIMIT (XON limit)


SR_XON_LIMIT number

Default: 0
This is a per-session setting.

The minimum number of bytes in use allowed in the input buffer before flow control is activated to allow transmission by the sender. This assumes that either XON/XOFF, RTS, or DTR input flow control is specified.

This setting can also be changed from this setup screen.
It is also saved in the registry.

See also BAUD, CARRIERSTATUS, CTSRTS, DBITS, PARITY, SBITS, RING, SR_XONOFF_IN, SR_XONOFF_OUT, SR_DSR SR_DSR_INPUT, SR_WRITETIMEOUT, SR_XON_LIMIT, SR_XOFF_LIMIT, SR_DTR_CTRL and SR_RTS_CTRL for control over all aspects of serial communication.


This is an important feature, others are prev/next


13: The SCRIPT language

13.1: Introduction to the IVT SCRIPT language

See global syntax for a global description of scripts.

Scripts can be defined in IVT.RC files and can be executed either as part of a session CREATE statement (used by -A or -a command line option) or bound to keys using the BIND <keyname> SCRIPT command in an IVT.RC file.
The newer KEYMACRO statement is a more powerful alternative to BIND.

Scripts can be triggered by PRECONNECT and ONCONNECT statements to control how sessions are established.

Scripts can also be called as a result of a mouse action or triggered by a HIGHLIGHT statement.
An ONDISCONNECT script can be used when the session disappears.
See also the SHUTDOWN and DESTROY scripts.

An IVT.RC file can contain STARTUP scripts that are executed before the first session is established.
Lastly, they can be manually invoked from the F4-X screen.

In other words: All major and many minor actions in IVT can trigger scripts.

Scripts are one of the most powerful features of IVT. They can SEND data on sessions, WAIT for particular responses and conditionally execute code through IF statements. The language has functions (with parameters), global variables (accessible by all sessions), normal variables (for the current session only), and local variables (for the current invocation of a function only). It also has hashes and arrays.

Scripts can be recursive, and all sessions can execute scripts independently and simultaneously (even instances of the same script in different sessions).
Scripts can be parts of PACKAGEs to isolate namespaces from each other. Use PUBLIC to declare things globally accessible, or GPSET and LPSET to create variables inside a PACKAGE that are created PUBLIC automatically.

It even supports background processing in the form of THREADs, of which several can execute simultaneously per session. These can be managed with FORK, KILL, TRAP and IGNCHILDREN.

A script can do SLEEPs (seconds) or USLEEPs (milliseconds), can set timers with TIMEOUT, block with PAUSE and take over the keyboard using ONKEY.
It can display things on the screen simply by using ECHO, or more complex (escape sequences) using VTECHO.

A script can also modify almost all IVT.RC settings (either globally using the GLOBAL keyword, or for the current session only). The STARTUP script can only set GLOBAL IVT.RC settings (because there is no session yet).
The VOLATILE keyword can be used to indicate that a modification made by a script should NOT be saved into the registry, even when it modifies the current settings of a session (see also COLOR_VOLATILE).
This allows you to make a distinction between settings altered by a script and settings altered by the user through the setup menu.
The combination of all this allows a very flexible configuration of IVT.

Using a CREATEGROUP statement to combine a set of CREATE statements, you can automatically create a whole bunch of sessions when IVT starts up. Each CREATE statement can specify the name of a SCRIPT (including parameters) which can be used to perform automatic login to all hosts that you connect to.

See this simple script example as a way to get started.

Below you see a complete list of all keywords available in the SCRIPT language.
Click on one to get more detail, or read through the examples, each keyword there is a hyperlink to the appropriate chapter in this manual.
See global syntax for a global description of scripts.

These are all the valid keywords in a script:


BATCHMODE     DRAWBOX       IGNORE_ESCAPE SCOPE         UNTIL
BEEP          ECHO_LIT      KEYBOARD      SCRIPTDEBUG   USLEEP
BREAK         ECHO          KILL          SECRET        VOLATILE
CALL          ENDSESSION    LABEL         SEND_KEYB     VTECHO
CANCEL        EXIT          LOCAL         SEND          WAIT
CAPTURE       FOR           LPSET         SENDNULL      WAITCARRIER
CLS           FORALL        LSET          SETDTR        WAITIDLE
COMMENTIGNORE FOREVER       MENU          SETPOS        WHILE
CONTINUE      GLOBAL        MENUTAB       SHAREMODE     WIN_MAXIMIZE
CSET          GOTO_OPT      NEXT          SLEEP         WIN_MINIMIZE
DELAY_APPLY   GOTO          ONKEY         STATUSHOST    WIN_SHOW
DELSCRIPT     GPSET         ONSEND        STATUSTXT     WINDOW
DESCR         GSET          PAUSE         STATUSTXTFIX  YIELD
DETACH        HELP          POPUP         SWITCHTO      
DIALOG        HIDE          PUSHBACK      TIMEOUT       
DISPLAY       IF            RETURN        TRAP          
DO            IGNCHILDREN   RUBOUT        UNSET         

There are a number of built-in functions (see table below). IVT supports 2 different ways of using the built-in functions. The old syntax used a very simple parser that only had a simple sequence of words, no nesting, and no complex expressions. Also the LSET keyword was required for every assign.
Example:


   LSET x SUBSTR "$var" 0 1     # Take first character
   LSET x UPPER $x              # Make it upper case
   LSET y SUBSTR $var 1 -1      # Takes rest of string
   LSET y LOWER $y              # make lower case
   LSET x "$x$y"                # Combine the 2 parts

Would be required to get a version of $var into $x with the first character in upper case and the rest in lower case.
The new language allows a rewrite like:


   x = Concat(Upper(Substr($var,0,1)),Lower(Substr($var,1,-1)));

I.e. nested expressions, '=' for assign, a new CONCAT function to concatenate strings, semi-colon (optional) to terminate an expression and so on.
The manual uses the new (more powerful) syntax in all examples, but the older syntax remains supported so existing scripts continue to function as before.
You are, however, urged to update your scripts to the new syntax. For example, the new syntax uses 64-bit integer arithmetic, the old one is limited to 32-bit numbers, among the numerous other advantages...

Having said that, the list of existing functions is:


ABS              FINDFILES        NAMEOF           SCREENATTR
BROWSEFILE       FINDPATH         NLS              SCREENTXT
BROWSEFOLDER     FLASHWINDOW      NRSESSIONS       SCROLLBACKLINES
CALL             FORK             OPEN             SETICON
CALLEDBY         FROMASCII        PCLOSE           SETPAGERPOSITION
CHDIR            FULLSCR          PLAYSOUND        SETTABCOLORS
CHOOSECOLOR      GETCLIPBOARD     POP              SETTABICON
CLOSE            GETCURDIR        POPEN            SETTABTEXT
COLORATTRIBUTE   GETFILESIZE      POPEN2           SHELLEXECUTE
COMMANDOUTPUT    GETFULLNAME      PROMPT           SNDMSG
COMPUTE          GETLONGNAME      PUSH             SOPEN
CONCAT           GETPAGERPOSITION PUTENV           SPLIT
COPYFILE         GETSHORTNAME     QUERYSCRIPT      SPRINTF
COPYHASH         GETTABTEXT       QUERYSETTING     SQRT
COUNTCHARS       GETUSERNAME      RAND             SRAND
CREAT            GETVALUE         READBYTE         STAT
CRYPTFL          HOLDSESSION      READHASH         STRICMP
CRYPTFLPWD       HUMANSIZE        READLN           STRPTIME
CRYPTSTRING      IDENTIFIERAS     READRC           STRSTR
CURSOR_COL       IGNOREACTIVITY   REGCREATEKEY     SUBSTITUTE
CURSOR_ROW       INSTR            REGDELETEKEY     SUBSTR
DECRYPTFL        ISDIR            REGDELETEVALUE   SYSTEM
DECRYPTSTRING    IVTEVAL          REGMATCH         THREAD
DEFINED          IVTFUNCTION      REGQUERYDWORD    TIME
DELHASH          JOIN             REGQUERYENUM     TOASCII
DIALOGADDEVENT   KRB5_ENCRYPT     REGQUERYSTR      TOTRAY
DIALOGEND        LEFT             REGSETVALUEDWORD TRIM
DIALOGEVENT      LEFTSTR          REGSETVALUESTR   TYPEOF
DIALOGQUERY      LENGTH           REMOVE           UNLINK
DIALOGSORTCOLUMN LOWER            RENAME           UPPER
DISPLAYLENGTH    LSEEK            REPLACE          VARDEF
ERROR            LTRIM            RESOLVENAME_EX   VLINES
EXISTS           MATCH            RESOLVENAME      WAIT_ONCONNECT
EXPAND           MKDIR            RIGHT            WAITTHREAD
FFLUSH           MYERRORCOUNT     RIGHTSTR         WINDOW_ATTR
FGSESSID         MYPACKAGE        RMDIR            WINEXISTS
FILE_RECEIVE     MYSESSID         RTRIM            WRITE
FILE_SEND        MYSESSNR         SAVEHASH         

From a script, most IVT.RC commands can be invoked which will only change the setting for the current session. There are a few exceptions, which are related to initial start-up and things that cannot be changed without severe repercussions. When you try to use one of those, you will therefore get an error message.


13.2: Global syntax of a script

A script is defined (in an IVT.RC file) with the following syntax:


   SCRIPT[_REDEFINE] name [signature]
      statement
      statement
      ...
   END

Signature is optional, and can be one of two styles:

1) Old-style. A simple list of parameter names, separated by spaces. This was
   the only style for many years. A call to the script simply provides values
   for all parameter names.
   If you specify old-style parameters, each invocation of this script
   is expected to pass actual values for these parameters.
   When too few parameters are passed, the others will be the empty string.
   When too many are passed, the extra ones are ignored.
   Parameter values behave as LOCAL variables (so all parameters are
   treated as pass-by-value!).

2) New-style. These scripts can have parameters that are call-by-value or
   call-by-reference and can accept a variable number of arguments.
   Such a signature starts with a '(' and ends with ')'.
   It separates the parameters with a comma rather than a space.

Example of an old-style definition:


   Script MyScript a b c


And the new style can look like:


   Script MyScript(a, b, c)
   or:
   Script MyScript(BYVALUE a, BYREFERENCE b, VARARGS c)

The BYVALUE is the old default: When a CALL is made to such a script and the script modifies the parameter (a, b or c in the above example) then the change is NOT visible to the caller (the caller just passes a VALUE of the parameter).

The BYREFERENCE means that a change to the parameter in the script IS visible to the caller, which allows the script to have multiple return values.
If nothing is specified, BYVALUE is assumed.
Note that a CALL can also use the Perl style "\" operator to indicate a by reference call. A script can force a BYREFERENCE type of parameter by using it in the script definition. When the script definition does not specify an explicit mechanism, the one used by the caller is used (so one call to a script can pass a parameter by value and another call to the same script can pass the parameter by reference).

The VARARGS means that if multiple parameters are passed in a CALL, that the VARARGS parameter becomes an array of zero to N values, where $c[0] is the first parameter, $c[1] the second one and so on. This allows a variable number of arguments for scripts, something older versions of IVT did not support.
VARARGS implies BYVALUE.
VARARGS can only be specified for the LAST parameter (it eats up all remaining parameters that are passed in a CALL).

The normal SCRIPT defines a script, and will cause a fatal error when a script by that name already exists. The SCRIPT_REDEFINE silently deletes any previous definition of the script and replaces it with the current version.

There can be only ONE statement per logical line. By ending a line in a \, you can have line continuation.
Keywords are case-insensitive. Variable-names ARE case-sensitive, however!

The END keyword marks the end of the SCRIPT. Definitions of scripts cannot be nested.

Any line that starts with a # as the first non-blank is treated as comment.
Also, any line may end in a comment (everything after the first # is ignored, except, of course, when that # is part of a statement).

See here for a list of valid statements.


13.3: Using strings and numbers in scripts

Strings can be take on the following forms in IVT scripts:

See the examples section for numerous examples of strings.

Numbers can also be used in expressions in various formats. Internally, IVT uses 64-bit signed integers for all numeric values. Supported formats are:

All numeric formats can be preceded by an optional minus sign to indicate a negative value.


13.4: Using expressions in scripts

The LSET and GSET statements accept more complex expressions than simple strings - IVT has many built-in function calls. These can be used to manipulate strings in a number of ways, to perform calculations etc.
Also, an expression can use parentheses, logical AND (&&), logical OR (||) and so on. Older versions of IVT did not have a very powerful syntax for expressions and built-in functions. Version 21 and later supports complex, nested expressions and built-in functions with a different syntax.

One of the most powerful possibilities is the ability to CALL other functions and assign the result of a RETURN statement.
Parameters to scripts can be passed BYREFERENCE or BYVALUE.

IVT supports fairly simple data types:

There are no structures (use multi-dimensional hashes instead). There are no floating point numbers.

Indirect assignment is also supported, where the name of an assigned variable (in CSET, LSET and GSET) may be a reference to another variable and there is the EXPAND function to indirectly reference variables.

The scope of a variable can be:

See also GPSET and LPSET to manipulate PACKAGE variables. An example of indirect variables:


        i = 1;                          # Assign 1 to $i
        nm = "Name_$i";                 # Assign Name_1 to $nm
        $nm = "Test";                   # Assign "Test" to $Name_1
        ...
        nm = "Name_$i";                 # Build name again
        val = expand("\$$nm");  # Assign "Test" to $val

By changing the value of $i in the example above (in a loop), you can build arrays of values, indexed by $i. By using several index values (Name_$i_$j) you could even build multi-dimensional arrays this way.
The newer real arrays and hashes make this type of application a lot easier.

Creation and destruction of the variables is handled automatically by IVT.
The UNSET statement can be used to delete variables explicitly.
The DELHASH function can be used to delete parts of a hash.
See variables explained for further details.

The TYPE of variables is implicit. Normally, everything is a string, except when IF does a compare. When both strings represent decimal numbers, they are compared numerically. Otherwise, a string compare is performed.
When you do arithmetic to variables, the numerical value is used.

There is also an explicit case insensitive string compare function.
See here for an alphabetical list of functions.

Example of a script:


Script MyTestScript ()
   Test = "Testing 1 2 3";
   Offset = 0;
   WHILE (X = SUBSTR($Test,$Offset,1)) != ""
      Echo "Part $Offset of string is $X\n"
      Offset++;
   NEXT
   Child = FORK("ND3995")       # Create session to host
   IF $Child != 0 THEN Echo "I am parent session\n" : RETURN

   Echo "\t\tI am newly born\n\n"
   WAIT CASE_INSENSITIVE "login:"
END

The complete list of operators that can be used in an expression are:

Expressions can be freely combined and grouped to arbitrarily complex things.


13.5: The STARTUP script

This is one very special kind of script. Whenever IVT finds a script in an IVT.RC file called STARTUP (case insensitive) it will call it (no parameters) as soon as the END statement is read. Subsequently, the script is DISCARDED so you can never CALL it explicitly from another script.
This means that you can have several scripts called STARTUP, so if you have a complex setup with an IVT.RC file per user, each user can have a personal STARTUP script (see INCLUDE_OPT).

Like with PRECONNECT, IVT cannot proceed until the STARTUP script terminates.
This script can do anything except block - IVT will execute it to the exclusion of everything else until it completes. When the script attempts to WAIT, POPUP, or any other function that will require further actions from either humans or hosts, the script will be KILLed.
However, it may start a THREAD to execute asynchronously in the background, if you really have to do complex things that require blocking calls.
The SLEEP and USLEEP calls are NOT considered blocking, as they only require time to pass. However, using long sleeps will cause IVT to seemingly hang...
Also, these scripts are called before the first session is established, so there is nothing to send or wait on, yet.

When you use IVT.RC statements in a script (to conditionally set certain global IVT characteristics) there is a final exception: all such statements are automatically preceded by an implied GLOBAL statement (since it is pointless to change local session characteristics without a session).
See also VOLATILE and COLOR_VOLATILE..

You can use these STARTUP scripts to set global variables and overrule the default values of the special variables.

Note: Since the STARTUP script is executed as soon as the END statement is seen, everything you CALL in the STARTUP script must have been defined prior to the STARTUP script. All other scripts are called only after all files have been read completely, and then the order in which scripts have been defined does not matter. If you attempt to CALL a script defined after the STARTUP, you'll get a "Script not found" error!


13.6: SHUTDOWN and DESTROY scripts

Like STARTUP, a script called SHUTDOWN or DESTROY is called automatically by IVT.
The DESTROY script is called when a session is about to be terminated. The session may or may not be still usable, that depends on what side disconnected first (if you use ALT+F4 to terminate a session, DESTROY is called before the network connection is terminated, if the host disconnects, the session is gone already). All variables still exist, the script can use these.

The SHUTDOWN script is called when IVT is about to exit. No sessions exist.

The names of the script MUST be in upper case. The script cannot do a blocking action (it must return quickly) and will be KILLed if it tries.
See also ONDISCONNECT, ONCONNECT and WAIT_ONCONNECT.

You would typically use this in combination with SNDMSG to send notifications of stopping/starting IVT and/or sessions.


13.7: Using variables in scripts

IVT has 3 basic types of variables:
1) Strings;
2) Arrays (also known as lists);
3) Hashes (also known as associative arrays).

For many years, IVT only had plain strings.
In version 25.0 (October 2015) arrays and hashes (as inspired by Perl) were added. For those unfamiliar with those concepts, an array is an unordered list of items, a hash associates an arbitrary key with a value.
IVT supports hashes that have an array of values, but it is far less powerful than Perl. For more details, see arrays and hashes.
See also SCOPE for new declaration commands.

The rest of this chapter deals with plain strings.

Using the LSET (for variables local to a session) and GSET (for globals) statements, you can define your own string variables. These values can be used inside strings for ECHO, IF, SEND etc. statements.
See "Using strings in scripts".
A variable is referenced inside a string by prefixing the name with a $-sign.
Variables come in several flavors. Whenever a variable value is needed, the list of existing variables is searched in the following order:

Note that the new SCOPE command can be used to declare an explicit scope for any type of object.

Some variables are predefined by IVT. Most are for reference only (you are not supposed to assign values to them). Exceptions are noted on the relevant page.
The current list is shown below (click on any one for more information):


$ANYCHAR_HEX          $IVT_GROUP_COUNT      $KRB5_AUTHENTICATE
$ANYCHAR              $IVT_GROUP_NAME       $KRB5_USER
$AUTOLOGIN            $IVT_INFO             $MOUSE_BUTTON
$COLS                 $IVT_IP_ADDR          $MOUSE_COL
$DFLT_USER            $IVT_IP_CANON         $MOUSE_ROW
$DFLTPROTOCOL         $IVT_IP_FQN           $MOUSE_WHEEL_DELTA
$ERRNO                $IVT_LIC              $ONKEYN1
$FORALLTYPE           $IVT_NETW_DOMAIN      $ONKEYN2
$HIGHMATCH            $IVT_NETW_HOST        $ONKEYS1
$HOSTLIST_DESCR       $IVT_NETW_IP_ADDR     $ONKEYS2
$HOSTLIST_EXTRA       $IVT_NETW             $ONSEND_DATA
$HOSTLIST_SHORTNAME   $IVT_PROXY_PASSWORD   $ORIGINAL_HOSTNAME
$HOSTNAME_ONLY        $IVT_PROXY_USER       $ORIGINAL_USER
$HOSTNAME_PORT        $IVT_REGISTRY_BASE    $PID
$HOSTNAME             $IVT_REPEATNR         $PPID
$HOSTPROMPT           $IVT_SCREENCLASS      $PROTOCOL_SESSION
$IVT_APPDATA          $IVT_SERIAL_PORTS     $PROTOCOL
$IVT_AUTOLOG_MODIFIED $IVT_SESSION_TABTEXT  $ROWS
$IVT_CLONE_OF         $IVT_SM               $SSH_FURTHER_AUTH_REQ
$IVT_CREATE_SESSION   $IVT_STATUS_DATETIME  $SSH_GSSAPI_SERVER
$IVT_DIALOGS          $IVT_STATUSHOST       $SSH_GSSAPI_USER
$IVT_DROP_0           $IVT_TUNNEL_ACTIVE    $SSH_LOGIN_ACCEPT
$IVT_DROP_COUNT       $IVT_URL_STARTUP      $SSH_PAGEANT_ACCEPT
$IVT_DROP_N           $IVT_USER_COMMENT     $SSH_PROTOCOL_LEVEL
$IVT_ERR_LEVEL        $IVTDIR               $STATUSTXT
$IVT_ERR_LINE         $IVTDOWNLOAD          $URLUSER
$IVT_ERR_NR           $IVTPID               $USER
$IVT_ERR_PACKAGE      $IvtPwdCfgLearn       $WAIT_IN
$IVT_ERR_SCRIPT       $IvtPwdCustomLogin    $WAIT_VARIABLE
$IVT_ERR_STR          $IvtPwdCustomPasswd   $WAITPID
$IVT_FTP_DELAY        $IVTTMPDIR            $ZMODEM_AUTO
$IVT_FUNC_ERRNO       $IVTUPLOAD            


13.7.1: Hashes (associative arrays) and plain arrays

Hashes (also known as associative arrays) and arrays (also known as lists) are a fairly late addition to IVT (version 25, autumn 2015).
Until that time, IVT had only simple, plain variables that can hold a simple string or number. It was possible to fake more complex data structures by dynamically creating variables like so:


   Nm = "Data_${i}_${j}";
   $Nm = "Some value";

That will build a name and then assign a value to that dynamic name.
The curly brackets are a necessity to make sure "i" is the variable name and not "i_". The dynamic value can be retrieved using the EXPAND function:


   Value = EXPAND("\$Data_${i}_${j}");

That will build the name of the variable again and give you its value.
This is a little tricky and (fairly) ugly but sufficient for many applications.
A problem is that the "Nm" must be a valid identifier, so only alphabetical characters and numbers can be part of the name. No spaces or special characters are allowed in a variable name. This puts restrictions on the values you can use as a "key" in the associative "array".
If the "i" and "j" variables contain underscores, unexpected things can happen.

Version 25 of IVT has hashes and arrays inspired by Perl. If you don't know Perl, just follow the rules below. If you DO know Perl, please be advised that the power of Perl is far beyond what IVT can offer. The limitations are:

So how do you create a hash? By simply assigning values to it, like so:


   MyHash{"Sample key"} = "One value"
   MyHash{"Other key"} = "Other value"

This should look somewhat familiar to Perl users.
Hashes can be multi-dimensional (no limit on the number of dimensions):


   MyHash{$x}{$y} = $Whatever;

Accessing the value of an entry is also straightforward:


  Value = $MyHash{$x}{$y}

Note that IVT also recognizes a reference to a hash inside a string. So:


  Value = "Value is $MyHash{$x}{$y}"

is valid (as of version 26.7 of IVT, earlier versions did not support this).
you can use a normal variable.
Copying (parts of) hashes is also straightforward:


  HashCopy = $MyHash;             # Copy an entire hash
  HashPart{$i}{$j} = $MyHash{$x}; # Copy part of MyHash into part of HashPart
  Push(0,MyArray,1,2,4);
  HashPart{$i}{$k} = $MyArray;    # Copy entire array into part of HashPart
  HashPart{$i}{$l} = $MyArray[0]; # Copy Single value

If you want to loop through all (current) values stored in a hash, see the FORALL KEYS statement.
If you want to know how many members a certain part of a hash contains, use the $# operator. For example:


   echo "MyHash contains $#MyHash members\n"
   echo "MyHash{$x} contains $#MyHash{$x} members\n"

The first ECHO will show the number of entries at the main level of the hash. The second will show how many entries exist below the key with value $x.
If a key (or hash) does not exist, a count of zero will be returned.

Use TYPEOF to find the type of variable or part of a hash, it will return either "HASH", "ARRAY" or "SCALAR".
For non-existing members, "UNKNOWN" will be returned, which is how you can find out if a hash contains a given key.

Use the FORALL KEYS statement to iterate through all members of a hash.
Use the FORALL VALUES statement to iterate through all members of an array.

See also:


13.7.2: Arrays (lists)

An ARRAY is a simple list of values, referenced by their ordinal number in the list. Arrays can only be assigned values using the PUSH function, and are referenced using square brackets.
So you cannot simply assign values to an array position! For example:


  Push(0,MyArray,"Value 1", "Value 2", "Something else")

Like a hash, this should look (slightly) familiar to Perl users.
The PUSH function pushes values into the array. In this case, the array called MyArray gets 3 new members. This is, incidentally, the ONLY function in IVT that accepts a list of values (as many as you need).
If MyArray did not exist before, this will result in:

The first parameter of PUSH is a boolean named "front". When it evaluates to true, the values are not added to the END of the array, but at the FRONT.
Note that this will reverse the order, so:


  Push(1,MyArray,"Value 1", "Value 2", "Something else")

Results in:

Hashes and arrays can be combined, so it is valid to PUSH into a hash:


  Push(0,MyComplex{$x}{$y},"Something");

That value can be referred to as $MyComplex{$x}{$y}[0].
As mentioned before, only the LAST level of a hash can be an array.
To count the number of members in an array, use the $# operator:


  $#MyArray
  $#MyComplex{$x}{$y}

returns the number of members in the array.
The TYPEOF function can be used to obtain the type of an entry in the hash.
The FORALL VALUES can be used to loop through all members of an array:


  Push(0,MyArray,1, 2*2, 3*3, "Last")
  FORALL (VALUES x MyArray)
     echo "Array value: $x\n"
  NEXT

Will output:


   Array value: 1
   Array value: 4
   Array value: 9
   Array value: Last

The FORALL VALUES normally iterates over the array from first to last.
It also supports sorting and filtering (see FORALL VALUES).
Of course, a simple FOR loop also works:


   FOR (i = 0; $i < $#MyArray; i++)
       ECHO "Array index $i has value: $MyArray[$i]\n"
   NEXT


Produces:


   Array index 0 has value: 1
   Array index 1 has value: 4
   Array index 2 has value: 9
   Array index 3 has value: Last

Note: You can make a copy of an array using a simple assign, but also see CopyHash (an array is really the simplest form of a hash).

See also SCOPE declaration.


13.8: List of all IVT defined SCRIPT variables

13.8.1: Variable AUTOLOGIN: User wants auto-login yes/no

$AUTOLOGIN

Indicates that the session should attempt to log the user in automatically.

Set to 1 when session is created from the command line and -n option not used.
Set to 0 when session is created from the command line and -n option is used.
Set to 1 when session is created with Ctrl+PgDown.
Set to 0 when session is created with Ctrl+PgUp.
Set to 1 when session is created with a CREATE statement.
Set to 0 when session is reconnected.
Set to the value indicated by the "Automatic login" checkbox.

IVT knows many ways to automate the creation of sessions and logging in to the host (see session management, $HOSTNAME, $USER, PRECONNECT and ONCONNECT, CREATEGROUP and CREATE).

Sometimes, the user does not want to have an automatic login, but wants to connect to a host that has PRECONNECT and/or ONCONNECT scripts defined.

As the power of IVT grew, I found myself using ONCONNECT statements for all sorts of tricks after initial login (setting up proper environment). I also normally have a setup with LogMeIn to perform automatic login under most users and hosts that I normally use.

However, once in a while I want all these scripts turned off for a single session. In that case, I create a session with Ctrl+PgUp rather than the normal Ctrl+PgDown. The ONLY difference is that the AUTOLOGIN variable is set to FALSE (0). The ONCONNECT script tests for this and allows me to logon manually. IVT itself does nothing special, it is all up to the scripts.
Even when you use Ctrl-PgUp, you can still check the "Automatic login" checkbox and the result will be the same as Ctrl+PgDown.

The variable is also set for the first session. Its value depends on the use of the -n command line flag.

For CREATE statements, the AUTOLOGIN value is set to 1.

When the NO_RECONNECT statement is used, and a session is lost, IVT will automatically reconnect to the same host. In this case, $AUTOLOGIN will also be set to zero to allow you to log on as a different user.


13.8.2: Variable ANYCHAR: Character found by WAIT ANYCHAR


$ANYCHAR

This local variable is created by the WAIT ANYCHAR statement. This WAIT will match any character, and if the script wants to know the value of the character it can use this variable.

Example:


   FOREVER
      WAIT ANYCHAR
      IF $ANYCHAR >= "0" && $ANYCHAR < "9" \
      THEN ... Decimal digit received ...
   NEXT

See also $ANYCHAR_HEX, if you want to test for NULL and/or control characters. See also FROMASCII.


13.8.3: Variable ANYCHAR_HEX: Character found by WAIT ANYCHAR


$ANYCHAR_HEX

This local variable is created by the WAIT ANYCHAR statement. This WAIT will match any character, and if the script wants to know the value of the character it can use this variable. The $ANYCHAR variable holds the STRING form of the received character, the ANYCHAR_HEX variable holds the hexadecimal representation of the same character. This variable is for the special case of NULL characters, since the $ANYCHAR variable will be the empty string in this case. Also, it is a convenient way to test for special control characters.

See also FROMASCII and TOASCII.


13.8.4: Variable COLS: Number of columns on the current session


$COLS

This local variable identifies the number of columns of the current session.
It is automatically updated whenever the window size is changed, either by using this setup-screen or by the host sending an escape sequence that changes the width of the screen, or by the user changing the window size.

A VT220 terminal can also change between 80 and 132 columns when the host sends these escape sequences.

See also WINDOW_SIZE, and the $ROWS variable.
See also ONRESIZE.


13.8.5: Variable DFLTPROTOCOL: Default protocol.


$DFLTPROTOCOL

This GLOBAL variable is set upon start-up of IVT. All compiled-in protocols are tested to see if they are available at runtime. IVT will try to pick the "best" protocol to use by default. The $DFLTPROTOCOL will contain a string like the one you can specify in the PROTOCOL statement.
The list of built-in protocols depends on the version of IVT you use. Some versions of IVT do not have SSH and Kerberos.

A STARTUP script might be used to overrule this, but you can also use an OPTIONS statement or (best) a PROTOCOL statement.

After initial start-up, the first session will be established using the default protocol. Afterwards, you can use the setup screen to change the default.
Of course, you can also choose a different protocol using the command line.

See also the $PROTOCOL variable, which gives the current protocol.
See also the $PROTOCOL_SESSION variable, which gives the current session protocol.


13.8.6: Variable DFLT_USER: Default user


$DFLT_USER

This global value holds whatever the user has typed in the "User name:" text field in the initial session creation dialog. This can be extremely handy in a situation where you want to define a CREATE statement for a variable user:


   CREATE "myhost $DFLT_USER" R=3

means the user can (must) choose the user-id used for the 3 sessions.
See also $USER, which is a per-session (local) variable.


13.8.7: Variable ERRNO: Operating system error number


$ERRNO

This local variable is set after calling functions like CREAT or OPEN, and all other IVT function that directly or indirectly call some Windows operating system function.

When these functions indicate failure, the reason for the failure can be found in $ERRNO. Meanings for the values van be found on MSDN.

See also ONERROR, which allows trapping of errors in IVT.
See also MYERRORCOUNT.


13.8.8: Variable FORALLTYPE: Type of current variable


$FORALLTYPE

A FORALL statement loops through variables, giving the name of matching variables. The TYPE of the current variable is stored in $FORALLTYPE and is:

See also "Variables explained".
For an example of using this, see FORALL.


13.8.9: Hash XXXMATCH (details of a HIGHLIGHT/WAIT/REGMATCH match)

IVT supports regular expression matching in various places. An example is the HIGHLIGHT statement, which allows you to match certain patterns (such as error messages displayed by your host program) and highlight them on screen.
When the user clicks on such a highlighted text, IVT can start a script for you that can somehow process the highlighted string (like starting an editor on a file that causes an error message when you compile a program).

That script must somehow access the details of the match (to be able to extract file names and line numbers and so on). That is what this XXXMATCH hash is for.

Similarly, when you use a WAIT REGEXP command, the script needs to know the same detailed information about the match.

IVT stores that information in a hash (the default name of the hash is HIGHMATCH for a highlight statement, WAITMATCH for a WAIT statement and if you use REGMATCH you must  specify the name yourself).
All these hashes have the same structure, but not all details are present for all types of match. The names below are for a HIGHLIGHT match (the most complex one), substitute the actual name depending on your application:

As an example, consider a compiler like GCC that emits messages such as:


SomeFile.cpp:136: error: returning a value from a constructor

I want to highlight such messages on the screen and when the user clicks on a highlighted error I want to start the editor on the given file and given line.
Such a feature saves lot of typing (or manually selecting of file names and so on).

First, we need a pattern that describes GCC error messages:


   (^.+\.(c|cpp|h)):([ \d]+): error:.*

That says: From the start of a line (^), any sequence of characters (.+), followed by a dot (\.), followed by either c, cpp or h). That part is in parentheses and so matches the file name (SomeFile.cpp in the example).
The pattern continues with a colon (:) the spaces and digits followed by yet another colon, followed by the word "error:" followed by anything.
The line number part is in parentheses again.
The result is a regexp that matches GCC error messages and picks out the file name and line number. Also, every error is ACTUALLY highlighted, which makes it more likely you are going to notice them.

Now we can write a HIGHLIGHT statement like this:


HIGHLIGHT PATTERN="(^.+\.(c|cpp|h)):([ \d]+): error:.*"         \
          TRIM                                                  \
          FG="255 255 255" BG="255 0 0"                         \
          CALL_BUTTON1=ClickError                               \
          COMMENT="GCC errors: Start editor when clicked"       \
          TIP="Click to edit this line"

And GCC errors will be bright-white on bright-red (the FG and BG colors), the TRIM will make sure that the ".*" in the pattern does NOT highlight trailing spaces after the error message. When the user hovers the mouse over the error, a tool-tip with "Click to edit this line" will show briefly. The COMMENT will appear in the interactive HIGHLIGHT editor. When the user clicks on the example line, the script ClickError is called. It can use the information about the match provided by IVT as follows:


Script ClickError
   LOCAL Fl, Ln;

   Fl = $HIGHMATCH{'MATCH'}{1}{'TEXT'}; # First sub-expr: The file name
   Ln = $HIGHMATCH{'MATCH'}{2}{'TEXT'}; # Second sub-expr: The line number
   SEND "vi +$Ln '$Fl'\r"
END

This starts the "VI" editor on the proper file and line number.
This 'ClickError' script (with a few extra features) is part of the standard distribution of IVT, see the file 'highlight.ivt' in the IVT package.

It is pretty straightforward to extend this scheme with many other patterns of errors and warnings, plus associated actions to handle those errors and warnings.

Under the covers, IVT will match all specified regular expressions against all text on the screen every time the contents of that screen changes.
Considerable effort has gone into making this as efficient as possible, but it is possible to slow down scrolling of text considerably when you have lots and lots of complex regular expressions active.

Note that they can be temporarily disabled in the interactive highlight editor, should you experience performance problems.


13.8.10: Variable HOSTNAME: Name of the host


$HOSTNAME

This is the name of the host IVT is going to connect to (or is connected to).
This variable can be used in various ways.

When IVT wants to create a session to a host it will initially set this variable to the name of that host. It will then check for a matching PRECONNECT statement in effect for THAT host. When either an explicit match is found or a "PRECONNECT *" is in effect, IVT will call the specified script before an attempt is made to contact the host. The PRECONNECT script can ALTER the HOSTNAME if it wants to. This allows you to have nicknames, shorthand names, redirections, etc.
The original name can come from the "Create session" panel, from the command line, from a CREATEGROUP, form a FORK and so on...

Mind the port number: HOSTNAME will be of form name:port when the port is NOT the default port for the connection you are trying to establish.
See $HOSTNAME_ONLY and $HOSTNAME_PORT for variables that contain the respective parts.

For example, I use this in an environment where there is no DNS server, the HOSTS file on my WinNT PC is not writable for me, and thus all host are reachable only via their numeric IP addresses. Most hosts I want to use are all on the same subnet and I don't want to type things like "10.8.60.28" all the time, so I use:


   Script STARTUP
      GSET HOSTPROMPT = "The 10.8.60 subnet is added automatically!\n"
   END

   PRECONNECT * DoSubNet
   SCRIPT DoSubNet
      IF Length($HOSTNAME) > 3 || !Match("[0-9]*",$HOSTNAME) THEN RETURN
      STATUSTXTFIX "Aplabu$HOSTNAME"
      HOSTNAME = "10.8.60.$HOSTNAME"
   END

When I type a short name (max 3 digits, the last part of the IP-address) this will be prepended automatically with the default subnet. The actual name of the host is also displayed on the status line (an alternative would have been to write my own HOSTS file and use a RESOLVE statement to refer to it).

After any PRECONNECT script has been called, IVT will actually connect to the host. If that succeeds, it will start all ONCONNECT scripts that have been defined. This script can reference the $HOSTNAME variable to find out what host it is being called for. The ONCONNECT can do automatic logon if it wants to. For this, it can reference the $USER and $AUTOLOGIN variables.
Note: Multiple ONCONNECT scripts run simultaneously! You can synchronize between them using various techniques if necessary: Session variables, KILL and the WAIT_ONCONNECT functions are common.

The bit with the STARTUP script causes the prompt for a new session to be changed. When the $HOSTPROMPT variable exists, it is displayed whenever the user is prompted for a hostname. This should tell the user what features are available. The variable can use the same escapes as described in the ECHO statement, so "~1" for reverse video and so on. Blinking is not supported.

Note: When you alter the value of $HOSTNAME (and/or $USER), IVT will check to see if the old value of that variable is displayed in the status bar host name fields, comment field and session tab. If so, they are updated automatically.
Also, when an AUTOLOG is in effect that contains the name of the $HOSTNAME, IVT will switch to a new log file automatically when you change the name of the host. This behavior can be suppressed, see AUTOLOG for details.

See also $ORIGINAL_HOSTNAME.
See also $HOSTNAME_ONLY and $HOSTNAME_PORT.
See also $IVT_IP_FQN.
See also DOMAIN.


13.8.11: Variable HOSTNAME_ONLY: Hostname without the port number


$HOSTNAME_ONLY

The variable $HOSTNAME contains the complete hostname when IVT is trying to establish a connection. When you connect to the default port for the protocol you are trying to use (23 for telnet or 22 for SSH), the hostname will be just the name. When you connect to a non-standard port, the hostname will be of the form name:port. Example:


   rohan.snipweg.wxs.nl:2323

when a connection is made to the telnet server on host rohan.snipweg.wxs.nl on port 2323.
In this case the $HOSTNAME_ONLY will contain just the hostname part (rohan.snipweg.wxs.nl), the $HOSTNAME_PORT will contain the port part (2323).

This can be convenient in scripts, and is necessary for the telnet proxy type.
Of course, you also use string manipulation routines such as StrStr and Concat to change one into the other.

Important: A PRECONNECT script can change the value of HOSTNAME (as typed by the user, or resulting from a CREATE statement, etc.) and the result will be that IVT will connect to the host indicated by the new value! This allows you to do all sorts of clever things, like shown in the HOP example.
The same goes for $USER.

When you change the value of $HOSTNAME after the session has been established, IVT will automatically update the value of the session tab (when it is configured to show the host name) and an active AUTOLOG is automatically re-evaluated (so it switches to a new log file) when that is configured to contain the value of HOSTNAME as part of the log file name.
The status line is also updated automatically if it contains $USER or $HOSTNAME.

See also $ORIGINAL_HOSTNAME.


13.8.12: Variable HOSTNAME_PORT: Port number part of the hostname


$HOSTNAME_PORT

This is the port number of the current connection. Only valid for TCP/IP connections. Usually this will be 22 for SSH and 23 TELNET, but when you connect to different ports this will be the port actually used for the connection.

See $HOSTNAME_ONLY for further details.
See also $ORIGINAL_HOSTNAME.


13.8.13: Variable HOSTPROMPT: Display when asking for new connection


$HOSTPROMPT
GSET HOSTPROMPT = "Friendly text goes here"

Whenever IVT prompts you for the name of a host (and user), it checks to see if the $HOSTPROMPT variable is defined. If it is, it will be displayed as part of the create session dialog box.
The string can use special characters to get bold, reverse etc. video, see ECHO for a description. Colour is supported, blinking is not.

The purpose is to clarify to the user what extra possibilities are implemented with clever ONCONNECT and/or PRECONNECT statements. See here for an example.


13.8.14: Variable HOSTLIST_DESCR (description from HOSTLIST)


$HOSTLIST_DESCR

When you use the HOSTLIST feature to provide the user a list of hosts to choose from, you can specify a description for each of those hosts.
When a selection is made from that list, the description is copied to this HOSTLIST_DESCR variable to be used (for example) as part of an ONCONNECT or PRECONNECT script to set the session comment or session title bar.
The standard login script that comes with IVT uses this to set a comment in the status bar.

See also the $HOSTLIST_EXTRA variable, especially the list there of places where this variable is set.
See also the $HOSTNAME and $DFLT_USER variables.

The standard script "Edit local address book" on the "Scripts" menu of IVT allows you to create a host list without using a text editor.


13.8.15: Variable HOSTLIST_EXTRA (hidden info from HOSTLIST)


$HOSTLIST_EXTRA

When you use the EXTRA="string" option of the HOSTLIST command, it allows you to specify extra data associated for the host or connection. It can contain any data of any length. When the user selects the host entry, the data is copied to this variable to be used by PRECONNECT or ONCONNECT scripts in any way you want. Good purposes for this would be a modem dialer to dial the number of a host on a modem, or an AUTOLOG statement to use it to generate the name of the proper log file. Or to set a PROXY connection for this host.
IVT itself attaches no special meaning to the data or the variable, scripts will have to define the meaning.

This variable is set even when you do not use the address book to select the host to connect to. For example:

In other words, the EXTRA data is considered to "belong" to the host, and every time IVT connects to that host, it sets the associated data.
However, see also the MATCH=USER option of the HOSTLIST command to subtly alter that behavior.
See this advanced example that makes use of that property.

See also $HOSTLIST_DESCR.


13.8.16: Variable HOSTLIST_SHORTNAME (short name used to create session)


$HOSTLIST_SHORTNAME

If you use the IVT address book and fill it with HOSTLIST entries, one of the options is to assign one or more "short names" to the host.
The actual value used to create a session (if any) is stored in this variable.
That allows you to have an ONCONNECT script that starts actions on the session depending on the value of this variable.


13.8.17: Variable IVT_DROP_COUNT: Number of dropped files.


$IVT_DROP_COUNT - Number of dropped files
$IVT_DROP_0     - Name of the first dropped file.
$IVT_DROP_N     - Name of the last dropped file ($IVT_DROP_COUNT - 1).

These variables are valid only when used in a script called as result of an ONDROPFILES statement. When the user drags & drops files on the main IVT window, the script is called in the context of the current foreground session.

The IVT_DROP_COUNT variable holds the number of objects dropped on the window.
The first object is named in IVT_DROP_0, the next in IVT_DROP_1, etc.

By default, IVT does not use an ONDROPFILES, so it is invalid to drop files or directories on IVT. However, the script in the standard DISTRIBUTIONS of IVT wil attempt to ZMODEM the file to the current host, and even copy whole directory structures across when you drop a directory on IVT.

See the ONDROPFILES documentation for details and examples.


13.8.18: Variable IVT_FTP_DELAY: Delay after script FTP


$IVT_FTP_DELAY

This variable can be used to prevent the delay of 5 seconds after a file transfer. Normally, when a transfer ends, an OK button is shown when the transfer ends and the user must acknowledge this.
When the transfer was initiated by a script, an automatic 5 second countdown is used. However, when a script wants to transfer several files, it is an annoyance when there is a repeated 5-second delay.

When either a global or session variable $IVT_FTP_DELAY is set to anything but the value "0", the 5 delay and acknowledgement is avoided and the transfer ends immediately.

See FTP and DOWNLOAD.


13.8.19: Variable IVT_GROUP_COUNT: Number of sessions in a group


$IVT_GROUP_COUNT

When a CREATEGROUP is used to create a group of sessions in one go, there can be an optional script associated with the group. Before that script is started, the $IVT_GROUP_COUNT is set to the total number of sessions in the group about to be created. This takes repeat-factors (R=x) in every CREATE statement into account. It can be used by the script to arrange special settings for the next $IVT_GROUP_COUNT sessions.

NOTE: When a broken group is fixed, this variable will contain the number of sessions that is missing and needs to be recreated.

See also $IVT_GROUP_NAME.
See also CREATEGROUP, CREATE and CREATEPROT.
See also MERCY_MODE.


13.8.20: Variable IVT_GROUP_NAME: Name of group being created


$IVT_GROUP_NAME

When a CREATEGROUP is used to create a group of sessions in one go, every session being created gets this local variable, with the name of the group.

When the default group is being created, this variable is empty (the default group is the first, unnamed group in an IVT.RC file, started with the -A command line option).

When a session is created that is NOT part of a group, this variable does not exist (see VARDEF to test the difference).

See also $IVT_GROUP_COUNT.
See also CREATEGROUP, CREATE and CREATEPROT.


13.8.21: Variable IVT_IP_ADDR: IP address of session


$IVT_IP_ADDR

When IVT establishes a TCP/IP session, the name resolver will translate any given hostname to a numeric IP address (see also RESOLVE and RESOLVE_TRACE).
As soon as the address is known, IVT sets the session variable IVT_IP_ADDR to the dotted-decimal string (like 193.79.171.60).
When the connection is using IPv6, this variable will contain the hexadecimal IPv6 address (like 2001:610:600:7d7::4).
It can be used in ONCONNECT scripts and so on, or perhaps you want to show it in the status line using STATUSTXT, or in the TITLEBAR.

NOTE: This variable cannot be used in PRECONNECT scripts, since those can be used to overrule the $HOSTNAME variable to redirect connections. So, the IP address is determined AFTER all PRECONNECT scripts have finished and BEFORE the ONCONNECT scripts start.

See also $IVT_NETW_HOST and $IVT_NETW.
See also $IVT_IP_FQN.


13.8.22: Variable IVT_IP_CANON: Canonical name of host


$IVT_IP_CANON

When IVT resolves a name into an IPv4 or IPv6 address, Windows may return a "Canonical name" for the given host. When such a name is given, it is stored in this $IVT_IP_CANON variable.

See also $IVT_IP_FQN, $IVT_IP_ADDR, $IVT_NETW_HOST and $IVT_NETW


13.8.23: Variable IVT_IP_FQN: Host name after resolving


$IVT_IP_FQN

When IVT establishes a TCP/IP session, the name resolver will translate any given hostname to a numeric IP address (see also RESOLVE and RESOLVE_TRACE).
When the DOMAIN statement is used, it will also try each name as typed with each domain name appended. When any attempt to translate a name is successful, IVT will set this variable to the Fully Qualified Name (FQN) of the host.
So, this variable can be empty when no domain is known.

Scripts can use this variable to determine the domain of the destination, or to show it to the user using STATUSTXT or TITLEBAR (or just ECHO it to the screen).

See also $IVT_NETW_HOST, $IVT_NETW_IP_ADDR and $IVT_IP_CANON.
See also $HOSTNAME, $HOSTNAME_ONLY and $HOSTNAME_PORT.
See also $IVT_NETW.


13.8.24: Hash IVT_LIC: Licence info

This used to be a list of individual variables. Version 26.7 of IVT moved these to a hash. For example, $IVT_LIC_RECIPIENT is now $IVT_LIC{'RECIPIENT'}.


RECIPIENT
EMAIL
COPIES
ID
VALID

This build of IVT contains licensed code (SSH and/or Kerberos).
When you have a licence installed, the most important fields from the licence are copied to this global hash. They are for reference only, IVT does not use the values in any way.

The RECIPIENT is the full name of the owner of the licence.
The EMAIL is the full email address as quoted in the licence.
COPIES gives the number of copies the licence is valid for.
ID is the unique identification of the licence.
VALID is the number of days the licence is still valid for, -1 means forever.

This information is also visible in the Help->Licence dialog.

A script might want to use this information in a DIALOG or show it on the screen.
Note: These variables are determined AFTER startup is complete, since there are several places a licence can come from (default ivt.lic, LICENCE directive, registry). So during a STARTUP script, the variables do not exist yet.

See also SHOWLICENCE.
See also hash.


13.8.25: Variable IVT_NETW: Network configuration information.


$IVT_NETW{'ADAPTER'}{X}{'NAME'}
$IVT_NETW{'ADAPTER'}{X}{'IP'}
$IVT_NETW{'ADAPTER'}{X}{'MAC'}
$IVT_NETW{'ADAPTER'}{X}{'NETMASK'}
$IVT_NETW{'DNS_DOMAIN'}{x}
$IVT_NETW{'HOST'}
$IVT_NETW{'IP_ADDR'}
$IVT_NETW{'LOGON_DOMAIN'}
$IVT_NETW{'WORKGROUP'}
$IVT_NETW{'PCID'}

In the above, X is a sequence number ranging from 0 - N, where N is the number of network adapters in the PC that IVT runs on (minus 1).
During startup, IVT queries the network configuration of the PC in a number of different ways. What it discovers is stored in the IVT_NETW hash.
Also, when a configuration change is detected, the hash is updated (like when you connect to a VPN).

Older versions of IVT had a long list of different variables for this, version 26.7 moved this to a hash.

For every adapter, the IP address, MAC address, description and netmask are stored. This information can be used by the licensing scheme of IVT.

The 'Identify' script that is part of the IVT distribution will print the values of all these variables (and some more).

Note that an adapter does not necessarily have an IP address and netmask. When the adapter is not in use (WiFi not connected, for example), these variables can be missing. NAME and MAC will always be available.

While it is at it, IVT also scans the various "DNS specific suffixes" of the adapters. When found, it creates the IVT_NETW{DNS_DOMAIN}{X} keys. The number of these can differ from the number of adapters since the DNS can be assigned dynamically through DHCP, can be empty, adapters can be offline, etc.

For good measure, there is also the HOST key (full name of the PC IVT runs on), 'IP_ADDR' is the IPv4 address of that name, LOGON_DOMAIN and WORKGROUP can be used for license purposes, so can the PCID.

The 'Identify' script also prints all these values, when found.

See also $IVT_NETW_HOST, $IVT_NETW_DOMAIN and so on.
See also LICENCE.


13.8.26: Variable IVT_NETW_HOST: PC hostname


$IVT_NETW_HOST

When IVT starts up it determines the name of the machine it runs on (using the gethostname() function). The result of that query is stored in this variable.
Normally, this is the name of your PC as known to the outside world.
It is the plain host name, no domain attached. See $IVT_NETW_DOMAIN.
Also, it is used to initialise the value of TELNET_XDISPLAY, so X-applications started in a TELNET session should work automatically.

A script might want to use this variable to arrange things differently depending on the host IVT runs on.

See also $IVT_NETW_IP_ADDR and $IVT_IP_CANON.


13.8.27: Variable IVT_NETW_IP_ADDR: PC IP-address


$IVT_NETW_IP_ADDR

After the value of $IVT_NETW_HOST has been determined, IVT uses the standard call gethostbyname() to find the IP-address of the host IVT runs on. The result of that query is used to set this variable to the dotted-decimal address (so this is the IP address of the PC that IVT runs on).

You might use to initialise the TELNET_XDISPLAY to an absolute address rather than a name (when the hosts you telnet into cannot lookup the proper name for the IP-address of your PC).

See also the $IVT_NETW hash.


13.8.28: Variable IVT_NETW_DOMAIN: Name of the domain of the IVT PC


$IVT_NETW_DOMAIN

During start-up, IVT will attempt to find the name of the DNS domain to which the PC belongs. This is taken from the registry and does not seem to be 100% reliable. Differences between Windows versions (anything from Win95 to Win11) make this very hard. Anything after WinNT seems to work fine, though.

See also $IVT_NETW_IP_ADDR;
See also the $IVT_NETW hash.


13.8.29: Variable IVT_PROXY_PASSWORD: Proxy password


$IVT_PROXY_USER
$IVT_PROXY_PASSWORD

Whenever you change the proxy configuration, IVT updates these two variables.
They are meant to be used in either a proxy of type TELNET or IVT-SCRIPT.
When these proxy-servers require authentication, you can use these variables to send the username and/or password.

There is a global variable set by IVT when you change the global proxy configuration, and a local one set when you change the configuration for the current session only. The upshot of that is that you can have one proxy for one (type of) connection and another for others without worrying about the resulting mix of configurations.

Do not assign these variables directly, use the PROXY_USER and PROXY_PASSWORD statements.


13.8.30: Variable IVT_PROXY_USER: Proxy username


$IVT_PROXY_USER

See also $PROXY_PASSWORD.
Set by using the PROXY_USER statement or using the proxy setup panel.


13.8.31: Variable IVT_REPEATNR: Sequence number


$IVT_REPEATNR

When multiple sessions are created in a single operation, each of the sessions will have its own instance of this variable, set to the sequence number for that particular session (1 - N).
The auto-login system uses this variable to generate a unique session comment for every session.

Your own ONCONNECT and PRECONNECT scripts might want to refer to this variable to determine they are part of a repeat group.


13.8.32: Variable IVT_SCREENCLASS: Registered name of IVT

This variable has to be set on the command line of IVT to have any effect.
It specifies the name under which the IVT instance registers itself in Windows.
When you want to send messages to an IVT instance from outside (like what happens when you send an URL to IVT to open sessions), the message is sent to the default name (IVT_SCREEN). But if you have multiple IVT instances running for different purposes, a way to distinguish between them can be to use the name set on the command line.

This can be used both when starting an IVT that you are going to use for normal sessions and for one with which you use the "-u" command line option to send an URL to.

For example, you could start two IVT instances like so:


IVT -B2 IVT_SCREENCLASS=ivt_ssh
IVT -BS IVT_SCREENCLASS=ivt_ser

One would be an instance that has SSH as the default protocol, the other has a default of serial.
To start a session from outside, invoke an IVT like so:


IVT -u ivt://somehost IVT_SCREENCLASS=ivt_ssh

And this would ask the IVT instance registered as ivt_ssh to open a session.
See URL for further details.


13.8.33: Variable IVT_SERIAL_PORTS: Detected serial hardware


$IVT_SERIAL_PORTS{n}{'PORT'}
$IVT_SERIAL_PORTS{n}{'ID'}

This is a GLOBAL hash.

When IVT starts up and whenever it detects a change in hardware (when you plug in or remove USB devices, for example), it will try to detect serial hardware.
An example is an USB serial dongle that allows you to use RS232 devices using the serial protocol support in IVT.

A serial port has a name like COM1: or COM9:. This is the name you type in the "Port name" box in the "Create Session" dialog of IVT when the serial protocol is selected. It can be tricky to find the right name, which is why IVT scans the registry looking for serial hardware. The resulting hash looks like:


   IVT_SERIAL_PORTS = {
       "1" =>
       {
           "ID" => "\Device\ProlificSerial0",
           "PORT" => "COM5",
       }
       "2" => { data on port 2 }
       ...
   }

The primary key is 1 - N (the number of detected ports). Currently, only the key under which the port is detected and the port name are added. In future versions of IVT it may contain more information (hardware, friendly names and so on). When there is no serial hardware, the hash does not exist. Use VARDEF to find out whether serial hardware has been detected to begin with.

An non-existent hash does not necessarily mean that you have no serial hardware. This is Windows, and every release seems to have new ways of handling this.

When the hardware is plugged in or out, this variable is altered automatically.


13.8.34: Variable IVT_SESSION_TABTEXT: Text in tab of CREATE statement


$IVT_SESSION_TABTEXT

When a session is created using a CREATE or CREATEPROT statement, one of the options you can specify is the text to appear in the tab of the session.
When specified and used, this session variable will contain the text that was specified. Scripts can use this to prevent overriding the user-specified text with some automatically generated text.

See also SetTabText() and GetTabText().
See also TABSBAR.
See also the AutoPrompt example


13.8.35: Variable IVT_STATUS_DATETIME: Format of status line clock


$IVT_STATUS_DATETIME

NOTE: This variable is intended to be set by you.

Upon special request an extra DATETIME format was added to the status line clock. This does not only display the time, but also the date. The default for that date and time is the (European) YYYY/MM/DD HH:MM:SS format. If you dislike that, this special $IVT_STATUS_DATETIME global variable can be set to specify a DATE format string to display arbitrary (date/time related) data in the status line. For example:


GSET IVT_STATUS_DATETIME = "%m-%d-%Y day %j"

Will produce something like:


01-24-2010 day 23

in the status line when STATMIDDLE DATETIME is used.
See also TIME (the date option there).
See also STATMIDDLE.


13.8.36: Variable IVT_STATUSHOST: Contents of HOST field in the status bar


$IVT_STATUSHOST

The STATUSHOST command can be used by scripts to alter the contents of the HOST field in the status bar. This variable is updated automatically when such a command is used. Use it to query the current value of the field.
When this variable does not exist or is empty, then the STATHOST command has not been used and the session has the default value for this field ($HOSTNAME).
So, the following snippet will give you the value of the text on the status line:


   Txt = $IVT_STATUSHOST == "" ? $HOSTNAME : $IVT_STATUSHOST;

That says: Take the value of HOSTNAME when IVT_STATUSHOST is empty, otherwise take the value of IVT_STATUSHOST (a conditional expression).

See also STATUSHOST.
See also STATUSTXT.
See also QuerySetting.



$IVT_TUNNEL_ACTIVE

When a session switches into TUNNEL mode, this session variable is created and set to 1. When the tunnel program is terminated, the variable is set to 0.
When a session has never done any tunneling (or IVT is built without this feature), the variable dos not exist.
Scripts can use this to check if the session is currently usable for non-tunnel activities,

See also TUNNEL.



$IVT_USER_COMMENT

In the "Create session panel", the user can type a session-comment that will show up in the status bar for that session (normally speaking).
However, scripts such as PWDLEARN try to set the comment in the status to something clever from either the address book or a "user@host" type of thing.

Such scripts can use this variable to find out if the user actually typed something into the comment box manually. If so, the text typed is the stored in this variable. In all other cases, this variable does not exist.

See also STATUSTXT.


13.8.39: Variable IVT_URL_STARTUP: IVT started from a URL


$IVT_URL_STARTUP

IVT can be started from an URL, which will open a new (tabbed) session if an instance of IVT is already running, and will start a new instance of IVT if no existing instance can be found.
In the latter case, the $IVT_URL_STARTUP global variable is set to the full URL text that caused IVT to start. This can be used by the rest of the startup procedure to determine the required configuration to support that URL.

See also URL and $URLUSER.


13.8.40: Variable IVTDOWN/UP/LOAD: IVT file transfer directory


$IVTDOWNLOAD
$IVTUPLOAD

These GLOBAL variables denote the exchange directories used by the file transfer module of IVT. See the DOWNLOAD command. The default for this variable is ".", for the current directory. It is pointless to GSET this variable; use the DOWNLOAD command instead. It is meant to be used in scripts that do transfers using the FILE_RECEIVE and FILE_SEND commands.

The $IVTUPLOAD variable is set only when an UPLOAD directory is specified.


13.8.41: Variable IVTDIR: IVT installation directory


$IVTDIR

This GLOBAL variable is set during start-up. IVT will determine the full pathname of the directory it finds itself in. It will examine its own name and the PATH environment variable if it has to.
These HELP pages are actually stored inside the executable, so IVT.EXE has to be found and opened, or IVT will not function properly.
$IVTDIR is set to the full pathname of the directory IVT lives in.

It is very convenient to use the value of $IVTDIR as a base name for INCLUDE and/or INCLUDE_OPT statements. This allows you to move your configuration files around without having to change their contents.


13.8.42: Hash IVT_INFO (Generic information about the IVT environment)

AS IVT grew, more and more special variables were created that held all sorts of bits and pieces of information about the environment of IVT.
Hashes were added to IVT in version 26.5, these are much more convenient to store such information. So version 26.7 of IVT moves a lot of those to new hashes like this one, You can use the new "ShowAllVars" script to dump all known variables to the screen so you can see what is available.

The IVT_INFO contains the following:

Subject to change without notice.


13.8.43: Hash IVT_SM (Windows System Metrics)

These values are queried from Windows when IVT starts up and are made available to scripts. They can be used to know a little more about the environment IVT runs in, to customize things like fonts and sizes and so on.
The list below is a more or less random selection from what Windows has on offer, if you require more, please mail to support@ivtssh.nl.
The documentation below is copied from the MSDN information. This used to be a longish list  of variables, version 26.7 moved this to a $IVT_SM hash.

For example, $IVT_SM_CLEANBOOT is now $IVT_SM{'CLEANBOOT'}.


CLEANBOOT

Value that specifies how the system was started: 0 Normal boot.
1 Fail-safe boot.
2 Fail-safe with network boot.

Fail-safe boot (also called SafeBoot) bypasses the user's start-up files.


CXFULLSCREEN
CYFULLSCREEN

Width and height of the client area for a full-screen window on the primary display monitor.


CXSCREEN
CYSCREEN

Width and height, in pixels, of the screen of the primary display monitor.


NETWORK

The least significant bit is set if a network is present; otherwise, it is cleared. The other bits are reserved for future use.


MOUSEPRESENT

TRUE (non-zero) if a mouse is installed; FALSE (zero) otherwise.


SECURE

TRUE (1) if security is present; FALSE (0) otherwise.


13.8.44: Variable IVTPID (PID of IVT itself)


$IVTPID

This global variable holds the process-id of IVT as given by Windows.
Typically used in combination with SNDMSG, it identifies the running process uniquely on the PC IVT runs on.


13.8.45: Variable IVT_AUTOLOG_MODIFIED (user altered AUTOLOG)


$IVT_AUTOLOG_MODIFIED

This session variable is set when a user uses setup to alter the AUTOLOG settings for the next (or current) session.
It is common to have a PRECONNECT script to enable AUTOLOG to make sure all sessions are logged according to some chosen policy.
If the user wants to deviate from that standard scheme for some reason, such scripts should honor those chosen settings and not overrule them.

This variable is set to 1 when the user alters the settings and then applies those settings. In all other cases the variable does not exist.


13.8.46: Variable IVT_CLONE_OF: Current session is a clone


$IVT_CLONE_OF

This session variable is only set when the current session is the result of the cloning of another session.

Its value is the value of the MYSESSID() function of the original session.
Use this in scripts that want to inherit complex stuff from a cloned session.
A "giving" session can use a ONSWITCHFROM script to publish information which can be picked up by a new, cloned session (but only when the new session is a clone, tested by looking at $IVT_CLONE_OF.


13.8.47: Variable IVT_CREATE_SESSION: Create Session is active


$IVT_CREATE_SESSION

This global variable is set to 1 when the "Create Session" panel is active.
It is empty or 0 when there is no such panel active.
It can be used by scripts that require a current, active session that are for example started from the custom "Scripts" menu bar entry (scripts that try to use SEND and WAIT will fail when there is no host connection).

See also $IVT_DIALOGS.


13.8.48: Variable IVT_DIALOGS: Number of active dialogs


$IVT_DIALOGS

This global variable is only set when there are panels (dialogs) on the session screen. When the user is typing data into these dialogs, a script that is monitoring the keyboard may want to know whether the keys are intended for the host or not. When IVT_DIALOGS is non-empty, it will be a number indicating the number of such panels (setup creates multiple dialogs).

Scripts may have other reasons to want to know the current state of IVT.
See also QUERYSETTING.


13.8.49: Variable IVTTMPDIR: Work directory


$IVTTMPDIR

As one of the very first things during start-up, IVT will determine what directory should be used for temporary files (screen dumps, file printers, other IVT temporary files).

It makes this value available to scripts as well.
The algorithm is:

If the Windows environment variable SystemDrive does not exist, it defaults to "C:".
If you want to, you can overrule the value of this variable in a STARTUP script.


13.8.50: Variables for Kerberos authentication


$KRB5_AUTHENTICATE
$KRB5_USER

These two variables are managed by IVT as part of the Kerberos authentication protocol.

The KRB5.DLL (and optionally, DCE32.DLL) are loaded and initialised only when a host requests authentication. The outcome of this initialization process is not known until it has been tried, the KRB5_AUTHENTICATE variable will indicate this by saying WAITING.

When a host requests authentication, and IVT finds it can successfully load and use Kerberos, the variable will say WILL, and negotiations will proceed.
When errors occur, the variable will change to WONT, indicating that normal login will have to be used.

Once a session is established, it takes a while to determine the outcome of the Kerberos authentication process. The variable will change to one of:

IVT will use the contents of the $USER variable (when set) to tell the host the name of the Unix account to use.
After a successful login, the $KRB5_USER variable contains the short name of the user (the name that was used in the KRB5.EXE program to login into the Kerberos realm).

The "password learning & automatic login" system uses this.
Note also that a session logged in using Kerberos cannot be reconnected.
That part looks as follows (taken straight from the real script source):


########################################################################
Script IvtLogMeIn (Host,LoginNm,DidSendUser)
   Hidden                               # So it cannot be called from F4/X
   LOCAL  x, nm, BaseCm, SndUser, LoginOK, OnPrompt, LocEcho, IlLogic;
   LOCAL  SentUser, UseMeta, DoLearn, SSHChangePwdStatus;
   LOCAL  Did232Retry;
   RUBOUT pwd, y;

   IF $IvtPwdCfgAutoLogin   == -1 THEN RETURN 0 # Uninstall state
   IF QuerySetting("DEBUG") != 0  THEN RETURN 0 # WAIT does not work
   IF $PROTOCOL == "Dummy"        THEN RETURN 0
   IF $PROTOCOL == "RS232 Serial" && $IvtPwdLoginRS232 != 1 THEN RETURN 0

   OnPrompt = SentUser = IlLogic = UseMeta = 0;

   # When parameter passed, do NOT expect a "login:" prompt for a username
   IF $DidSendUser != "" || \
      $PROTOCOL_SESSION == "RLOGIN" || \
      $PROTOCOL == "IVTmux" THEN SentUser = 1

   CALL IvtPwdKeybONOFF("OFF")
   GSET PwdActiveLogins = $PwdActiveLogins + 1

   # Force a minimum or password can be echoed
   IF $IvtPwdDelay < 100 THEN IvtPwdDelay = 100;

   # Support nested calls to IvtLogMe in. This can happen when the
   # login script calls LogMeIn again, for example to hop from to another
   # machine and that other machine needs a password.
   IF TypeOf(IvtLogMeInBusy) == "UNKNOWN" THEN {
      IvtLogMeInBusy = 1;
   } ELSE {
      IvtLogMeInBusy++;
      GOTO NoKerb5
   }

   IF ($PROTOCOL == "IVTmux") THEN GOTO NoKerb5;

   IF $PROTOCOL_SESSION   == "SSH" &&   \
      $SSH_PROTOCOL_LEVEL == 2     &&   \
      $IvtLogMeInBusy     == 1          THEN {
      IvtPwdSshMode = 2;
      GOTO NoKerb5;
   }

   # This is TELNET (or RLOGIN)
   # The first time, IVT must wait for authentication proposal. The first
   # time a host proposes Kerberos, it will initialise the DLL's. Until then
   # we must wait for the outcome.
   x = $KRB5_AUTHENTICATE;
   IF $x == "WAITING" WtChange

   # When WONT or empty, IVT does not support kerberos...
   # Guard against a race by first copying into X, THEN test
   IF $x != "WILL" NoKerb5

LABEL WtChange
   # When WILL, the variable will change to the outcome of the negotiation
   WHILE $KRB5_AUTHENTICATE == $x
      WAIT VARIABLE_ASSIGN KRB5_AUTHENTICATE
   NEXT

   # Kerberos enabled, but host does normal unauthenticated logins.
   # We MAY have seen the first char of a "Login:" prompt. Push it back.
   IF $KRB5_AUTHENTICATE == "WONT" THEN PUSHBACK $ANYCHAR : GOTO NoKerb5

   # Kerberos enabled, host knows, but failure in obtaining ticket.
   IF $KRB5_AUTHENTICATE == "FAILED" THEN LoginOK = 0 : GOTO KrbDone

   # Kerberos was used. Result is principal name or REJECT.
   IF $KRB5_AUTHENTICATE == "REJECT" KrbDone

   # When invalid username was requested, telnetd might give login:
   # When otherlogin sees that, push back and try again
   x = CALL IvtOtherLogin()
   IF $x == 3 THEN x = 0
   IF $x != 0 THEN {
      LoginOK = 0
      CALL WinTxt(NLS("P023","Credentials not acceptable for $USER"),1)
      CALL WinTxt("Creds: $KRB5_AUTHENTICATE",1)
      CALL WinTxt(NLS("P024","Session IS secure - trying password"),1)
      PUSHBACK "login:"
      OnPrompt = 1
      GOTO NoKerb5
   }

   IF $x == 0 THEN LoginOK = 1
   IF $USER == "" THEN USER = $KRB5_USER
   LoginNm = $USER;

LABEL KrbDone
   CALL WinTxt(NLS("P025","Kerberos authentication:\n$KRB5_AUTHENTICATE."),0)
   GOTO TheEnd

LABEL NoKerb5
   # Rest of the normal login process...

   # Get global defaults when none passed
   IF $Host    == "" THEN Host    = $HOSTNAME
   IF $LoginNm == "" THEN LoginNm = $USER

   # Configure.ivt can do this...
   IF $IvtPwdCfgAutoLogin == -1 THEN GOTO ChkLearn3

   IF $IvtPwdCfgAutoLogin == 0 THEN {
      CALL WinTxt(NLS("P026", \
           "Auto login system disabled.\nUse SETUP to change."),1)
      GOTO TheEnd                       # Disabled in configuration
   }

   IF Exists($IvtPasswdFile) == 0 && $IvtPwdNoDiskLrn == 0 \
   THEN GOTO UnKnown

   IF DEFINED("IvtProcPwds") == 0 THEN {
      CALL WinTxt(NLS("P027", \
           "Auto login unusable, password file not read"),1)
      GOTO TheEnd
   }

   # Try and find, for insert/update message
   pwd = CALL IvtFindPwd($Host,$LoginNm)

   # No Autologin, might learn a password
   IF $AUTOLOGIN == 0 THEN {
      Call IvtPwdDebug("AutoLogin is off");
      OnPrompt = 0
      GOTO ChkLearn
   }

   IF $pwd != "\1B" TmLoop                      # User explicitly found
   IF $LoginNm != "" THEN GOTO TryMetaSystem    # Asked, not found

   # When no default user is found, no password is known
   IF $IvtDefaultLoginNm == "" THEN GOTO TryMetaUser # No default user known

   LoginNm = $IvtDefaultLoginNm                 # Use default user
   pwd     = $IvtDefaultPwd
   USER    = $LoginNm                           # Updates TAB bar!
   UNSET IvtDefaultPwd                          # Destroy copy
   CALL WinTxt(NLS("P028","Using default user $LoginNm"),1)
   GOTO TmLoop

LABEL TryMetaUser
   # When this IvtPwdSkipMetaSearch is set, skip the meta-system!
   # Used by the SecretServer plugin, for example.
   IF GetValue("IvtPwdSkipMetaSearch") != "" THEN GOTO UnKnown
   IF GetValue("IvtPwdForbidden") != 0 THEN GOTO UnKnown

   IF $IvtPwdMetaUser == "" THEN {
      CALL WinTxt(NLS("P029","No meta-user name given"),1)
      GOTO UnKnown
   }

   LoginNm = $IvtPwdMetaUser;
   USER    = $LoginNm;                          # Updates TAB bar

LABEL TryMetaSystem
   IF GetValue("IvtPwdSkipMetaSearch") != "" THEN GOTO UnKnown

   IF TypeOf(IvtPwdForbidden) == "SCALAR" && \
      $IvtPwdForbidden != 0 THEN GOTO UnKnown

   IF $IvtPwdMetaSystem == "" THEN {
      CALL WinTxt(NLS("P030","No meta-system name set"),1)
      GOTO UnKnown
   }

   pwd = CALL IvtFindPwd($IvtPwdMetaSystem,$LoginNm)
   IF $pwd != "\1B" THEN {
      UseMeta = 1;
      GOTO TmLoop
   }

   CALL WinTxt(NLS("P031", \
         "Meta-password for $LoginNm on $IvtPwdMetaSystem not set"),1)

   IF $IvtPwdToDisk == 0 THEN \
      CALL WinTxt(NLS("P032", \
           "Save-to-disk is OFF, use F6\nto set meta-password"),1)

   GOTO UnKnown

LABEL TmLoop
   IvtLogMeInWait = 1;          # For signalling threads...
   FOREVER
      Timeout 15000 MissedIt

      WAIT CASE_INSENSITIVE                                     \
           VARIABLE_ASSIGN "SSH_PAGEANT_ACCEPT",SshPageant      \
           VARIABLE_ASSIGN "SSH_GSSAPI_USER",SshGssapi          \
           VARIABLE_ASSIGN "SSH_LOGIN_ACCEPT",SshTheEnd         \
           VARIABLE_ASSIGN "SSH_FURTHER_AUTH_REQ",SshComplex    \
           VARIABLE_ASSIGN "SSH_CHANGE_PWD",SshChangePwd        \
           "login"                                              \
           "username"                                           \
           "Userid"                                             \
           "Principal Name"                                     \
           "$IvtPwdCustomLogin"                                 \
           "$IvtPwdCustomPasswd",SndPwd                         \
           "password for $LoginNm",SndPwd                       \
           "kennwort von ",SndPwd                               \
           "password:",SndPwd                                   \
           "password :",SndPwd                                  \
           "Passphrase for key",SshPassphrase                   \
           "Access granted!",SshTheEnd                          \
           IN_UNIQUE "$IvtPwdPromptChars",SeenPrompt

      # Seen something that requires a username...
      x = CALL IvtPwdRealPrompt()
      IF !$x THEN CONTINUE      # Not a real prompt

      # Been here before in illogic mode? Give up
      IF $IlLogic == 2 TheEnd2
      USLEEP $IvtPwdDelay       # Wait a bit, some hosts choke...
      Send "$LoginNm\r"
      SentUser = 1
      OnPrompt = 0
      IF $IlLogic == 1 THEN IlLogic = 2;
      IF $pwd == "" AfterPwd    # Password is empty - skip it
      CONTINUE                  # Try the next prompt

LABEL SeenPrompt
      x = CALL IvtPwdRealPrompt()
      IF !$x THEN CONTINUE      # Not a real prompt
      Call IvtPwdDebug("Seen a real prompt")

      # Seen a question, not for any recognized situation.
      # Some hosts ask questions BEFORE a username. Must answer manually.
      IF $SentUser != 1 THEN {
         KEYBOARD "AUTHENTICATE_ON"
         CONTINUE
      }

      # We assume it is a shell prompt WITHOUT password required
      IF $pwd == "\1B" THEN \
         CALL WinTxt(NLS("P012","Account does not seem to have a password"),1)

      LoginOK = 1;
      GOTO TheEnd

LABEL SndPwd
      x = CALL IvtPwdRealPrompt()
      IF !$x THEN CONTINUE      # Not a real prompt

      # Some form of prompt for a password seen
      # When AlwaysSendUser results in password, quit.
      IF $IlLogic != 0 THEN {
         LoginOK = 0
         Call IvtPwdDebug("Login failure: Reason 1/$IlLogic")
         GOTO TheEnd2
      }

      Timeout 0

      IF $UseMeta == 1 THEN {
         CALL WinTxt(NLS("P034", \
               "Using meta-password of $LoginNm\nfor $Host"),1)
         USER = $LoginNm
      }

      # Tricky - password shows when echo is turned on...
      LocEcho = QUERYSETTING("LOCAL_ECHO");
      IF $LocEcho == 1 THEN {
         VTECHO "\1B[12h"
         WAITIDLE
      }

      USLEEP $IvtPwdDelay        # Wait a bit, some hosts choke...
      SEND $pwd                 # no expand, in case it has backslash
      SEND "\r"

      # Restore that mode when it was on
      IF $LocEcho == 1 THEN WAITIDLE : VTECHO "\1B[12l"

LABEL AfterPwd
      # If the password is incorrect, we get another login
      # When $x == 0 we have a successful login!
      LoginOK = 0;
      x = CALL IvtOtherLogin
      IF $x == 0 THEN {
         LoginOK = 1;
         GOTO TheEnd
      }

      IF $x == 2 THEN {
         CALL WinTxt(NLS("P035","All sessions are in use"),1)
         LoginOK = 0
         GOTO TheEnd
      }

      # First check mode 3 and the hook variable.
      IF $x == 3 && $IvtPwdNoShellQuiet == "" THEN {
         CALL WinTxt(NLS("P036","Logged in, No shell!"),1)
         LoginOK = 1
         GOTO TheEnd
      }

      # Then, when NoShellQuiet is set, handle...
      IF $x == 3 THEN {
         LoginOK = 1;
         GOTO TheEnd
      }

      IF ($x == 5) SshChangePwd

      # When Looking at a password prompt, and IlLogic in
      # use, we are done.
      IF ($x == 4 && $IlLogic != 0) THEN {
         Call IvtPwdDebug("Login failure: Reason 2/$IlLogic")
         GOTO TheEnd
      }

      # Must be 1
      CALL WinTxt(NLS("P038","Stored password seems to be incorrect."),1)
      KEYBOARD "AUTHENTICATE_ON"
      OnPrompt = 1;
      GOTO ChkLearn

LABEL MissedIt
      Call IvtPwdDebug("Timed out waiting for prompt");
      KEYBOARD "AUTHENTICATE_ON"

      # Can only miss a serial prompt... Send a CR. All other protocols
      # should send something eventually, or user starts typing
      IF $PROTOCOL == "RS232 Serial" THEN {
         IF $Did232Retry == 1 THEN {
            ECHO "~2Giving up on serial 'login' prompt...\n"
            GOTO TheEnd
         } ELSE {
            ECHO "\n~2That takes too long - sending a RETURN (once)...\n"
            Did232Retry = 1
            Send "\r"
         }
      }
   NEXT

LABEL UnKnown
   # When we end up here and no login name is found, AND gssapi is
   # enabled AND systemuser is enabled (the latter is OFF by default),
   # THEN try to use the OS user to authenticate.
   IF $LoginNm == ""                            && \
      QuerySetting("SSH_GSSAPI_AUTHENTICATE")   && \
      QuerySetting("SSH_GSSAPI_SYSTEMUSER")        \
   THEN LoginNm = GetUserName();

   # When no pwd is found, and Find routines were given, try those
   # Use an ARRAY to have an easy way to manage a list.
   # Start with a copy of the list, because in the case of a nested login,
   # the FIND must work in all nested cases. Was bug.
   # Use GetValue so STRICT_CHECK VARIABLES does not throw error
   LOCAL CopyPwdFindScript;
   IF GetValue($#PwdFindScript) > 0 THEN {
      CopyPwdFindScript = $PwdFindScript;       # Copy hash
   }

   y = ""
   WHILE $#CopyPwdFindScript > 0 && $y == ""
      x = POP(1,CopyPwdFindScript);
      # Silently skip bad/invalid script names
      IF $x == "" || !Defined($x) THEN CONTINUE

      # If the script returns a password, great! Use it
      # First try specific host, then meta-host
      Call IvtPwdDebug("Call $x to find a password for $Host/$LoginNm");
      y = CALL $x($Host,$LoginNm)
      IF $y == "" && $IvtPwdMetaSystem != "" THEN {
         Call IvtPwdDebug("Call $x to find a meta-password for $LoginNm");
         y = CALL $x($IvtPwdMetaSystem,$LoginNm)
      }

      # Scripts exist that can figure out a new hostname or username.
      IF ($Host    != $HOSTNAME) THEN Host    = $HOSTNAME;
      IF ($LoginNm != $USER    ) THEN LoginNm = $USER;
   NEXT

   # When that resulted in a password, use it to log in!
   IF $y != "" THEN {
      pwd = $y
      # SecretServer plugin sets this when successful. Requested
      # by Richard Westerik.
      x = GetValue("IvtPwdFindSource");
      IF ($x != "") THEN {
         CALL WinTxt($x,1);
      } ELSE {
         CALL WinTxt(NLS("P039", \
            "Found password for $LoginNm using custom FIND"),1)
      }
      GOTO TmLoop
   }

   IF $LoginNm == "" ChkLearn           # No name specified
   CALL WinTxt(NLS("P040","Don't know a password for\n$LoginNm on $Host"),1)

   # At least prevent having to type the name again, when
   # AlwaysSendUser is set.

LABEL ChkLearn
   DoLearn = 1
   x = "Click 'Setup', 'Password learning' to change";
   IF $IvtPwdCfgLearn == 0 THEN {
      Call IvtPwdDebug("Password learning is disabled");
      CALL WinTxt(NLS("P041","All password learning disabled.\n$x"),0)
      DoLearn = 0
      GOTO ChkLearn2
   }

   # Special: Passed from create dialog
   IF $IvtPwdCfgLearn == 2 THEN {
      CALL WinTxt(NLS("P042", \
           "Password learning disabled for\nthis session."),0)
      DoLearn = 0
      GOTO ChkLearn2
   }

   IF TypeOf(IvtPwdForbidden) == "SCALAR" && \
      $IvtPwdForbidden == 1 THEN {
      CALL WinTxt(NLS("P043", \
           "Password learning disabled for\n${Host}.\n$x"),0)
      DoLearn = 0
   }

LABEL ChkLearn2
   IF $PROTOCOL == "RS232 Serial" THEN GOTO TheEnd

   # Call this even when we do NOT actually learn passwords. IF the
   # user gets logged in due to Pageant, password-less accounts or
   # other means, we STILL can call the PwdAddLoginScript scripts...
   # The exception is when EVERYTHING is disabled (Andries Venter).
   IF (TypeOf(PwdLoginScript) == "UNKNOWN" || $#PwdLoginScript == 0) && \
      $DoLearn == 0 && $AUTOLOGIN == 0 \
   THEN GOTO TheEnd

LABEL ChkLearn3
   LoginOK = 0;         # Assume failure
   LoginNm = CALL IvtLearnLogin($OnPrompt,$LoginNm,$DoLearn,$SentUser,$LoginOK)
   IF $LoginNm != "" THEN SentUser = 1;

LABEL TheEnd
   TIMEOUT 0

   # Build status string, then see if we actually want to set it...
   x = ""
   BaseCm = $STATUSTXT                  # Preserve current comment
   IF $BaseCm == "" THEN {
      # Default to host description from addressbook (if any)
      BaseCm = $HOSTLIST_DESCR
   }

   # Do not prepend a LoginNm TWICE (nested logins).
   IF (y = StrStr("@",$BaseCm)) > 0 THEN \
      BaseCm = SUBSTR($BaseCm,$y + 1,-1);

   BaseCm = trim($BaseCm)

   # When the user typed a comment manually, do NOT overrule that
   IF $IVT_USER_COMMENT != ""  \
   THEN x = $IVT_USER_COMMENT  \
   ELSE x = $BaseCm

   IF $x != "" && StrStr("@",$x) < 0 \
   THEN x = "${LoginNm}@${BaseCm}"

   # When no user-comment, AND no HOSTLIST_DESCR, make up a comment
   IF $x == "" \
   THEN x = "${LoginNm}@${HOSTNAME}"

   # Append repeat number (also for manually typed comment)
   IF $IVT_REPEATNR != "" THEN x = "$x ($IVT_REPEATNR)"

   # When a group is created, and IT sets a title, KEEP that.
   # That even overrules a manually typed comment
   IF VarDef("IVT_GROUP_NAME") && $STATUSTXT != "" THEN x = ""

   # Serial connections? Leave comment alone
   IF $PROTOCOL == "RS232 Serial" THEN x = ""

   # Use the result when it still applies. A COMMENTIGNORE can
   # be used to prevent this...
   IF $x != "" THEN STATUSTXTFIX "$x"

   # Visible or not, the window will die after the timeout
   IF WinExists("HW") THEN WINDOW HW TIMEOUT $IvtPwdPopWait

   # Nested login, one level is done.
   IF $IvtLogMeInBusy > 1 THEN {
      IvtLogMeInBusy--;
      KEYBOARD "AUTHENTICATE_OFF";
      CALL IvtPwdKeybONOFF("ON");
      Call IvtPwdDebug("Nested login returns status $LoginOK");
      RETURN $LoginOK
   }

   IF TypeOf(PwdLoginScript) != "ARRAY" THEN GOTO TheEnd2

   # When login is successful, and PwdLoginScripts are specified, call them.
   # This is an array of scripts
   WHILE $LoginOK == 1 && $#PwdLoginScript > 0
      x = POP(1,PwdLoginScript);

      # If the script returns FAIL, the login is considered failed
      y = ""
      IF $x != "" THEN y = CALL $x      # Indirect call
      IF $y == "FAIL" THEN {
         Call IvtPwdDebug("PwdLoginScript $x returns failure")
         LoginOK = 0;
         IlLogic = 1
      }
   NEXT

LABEL TheEnd2
   # An IvtWaitLoggedIn that is started too late, would not be
   # signalled. So set this session flag.
   IvtWaitLoggedInReady = ($LoginOK == 1) ? 1 : 0;

   # When another thread is waiting for successful login, signal it
   FORALL (KEYS nm $IvtWaitPids)
      # KILL 1 is success, 2 is failure
      IF $LoginOK == 1 \
      THEN KILL $x 1   \
      ELSE KILL $nm 2
   NEXT

   DelHash($IvtWaitPids);

   IF $SSHChangePwdStatus          THEN GOTO TheEnd4
   IF $IlLogic == 1                || \
      $IvtPwdAlwaysSendUser != 1   || \
      $SentUser == 1               || \
      $LoginOK == 1                THEN GOTO TheEnd4

   IF $KRB5_AUTHENTICATE == "WONT" THEN GOTO TheEnd3
   IF $KRB5_AUTHENTICATE != ""     THEN GOTO TheEnd4
LABEL TheEnd3
   IF $SSHChangePwdStatus          THEN GOTO TheEnd4
   IF $LoginNm == ""               THEN GOTO TheEnd4

   # We HAVE a username, AlwaysSendUser is ON, we're not logged in yet,
   # so we're gonna send the username. This may result in a successful
   # login when the account HAS no password, when Kerberos is used, or
   # when SSH with keypairs is used. Wait for the response, since a
   # successful SSH login is common and WaitLoggedIn scripts should see
   # the success.
   KEYBOARD "AUTHENTICATE_ON"
   IlLogic = 1
   GOTO TmLoop

LABEL TheEnd4
   KEYBOARD "AUTHENTICATE_OFF"
   CALL IvtPwdKeybONOFF("ON")
   TIMEOUT 0
   # Remove some stuff that might be found with a FORALL
   CALL IvtPwdKillVars()
   GSET PwdActiveLogins = $PwdActiveLogins - 1
   RETURN $LoginOK

LABEL SshPassphrase
   TIMEOUT 0
   IF $IvtSshNotDone == "" THEN \
      CALL WinTxt(NLS("P019","Learning a passphrase is 'not done'..."),2)

   KEYBOARD "AUTHENTICATE_ON"
   IvtSshNotDone = 1;
   GOTO TmLoop

LABEL SshTheEnd
   TIMEOUT 0
   IF $SSH_LOGIN_ACCEPT == "" THEN GOTO TmLoop

   LoginNm = $SSH_LOGIN_ACCEPT;
   LoginOK = 1;
   CALL WinTxt(NLS("P020","SSH login succeeded as $SSH_LOGIN_ACCEPT"),3)
   CALL IvtOtherLogin           # Wait for session to start
   GOTO TheEnd

LABEL SshPageant
   TIMEOUT 0
   LoginOK = 1;
   LoginNm = $SSH_PAGEANT_ACCEPT;
   CALL WinTxt(NLS("P021","SSH login succeeded as $LoginNm using Pageant"),3)
   CALL IvtOtherLogin           # Wait for session to start
   GOTO TheEnd

LABEL SshComplex
   CALL WinTxt(NLS("P045","Manual mode (further authentication detected)"),3)
   GOTO TheEnd

LABEL SshChangePwd
   SSHChangePwdStatus = 1;
   LoginOK = 0;
   GOTO TheEnd

LABEL SshGssapi
   TIMEOUT 0
   LoginOK = 1;
   LoginNm = $SSH_LOGIN_ACCEPT;
   CALL WinTxt(NLS("P022", \
         "SSH GSSAPI login succeeded as $LoginNm as\n$SSH_GSSAPI_USER"),3)

   CALL IvtOtherLogin           # Wait for session to start
   GOTO TheEnd
END


13.8.51: Variables for MOUSE_KEY actions


$MOUSE_COL
$MOUSE_ROW
$MOUSE_BUTTON
$MOUSE_WHEEL_DELTA

When a MOUSE_KEY statement is used, the mouse can be programmed to CALL a script. This script can use these variables to determine the state of the mouse. These variables only contain valid values while such a MOUSE_KEY CALL is being processed.
The $MOUSE_COL and $MOUSE_ROW identify the position of the mouse.

The $MOUSE_BUTTON is either 1 or 2 to indicate the left and right buttons.
It is set to 100 for the mouse WHEEL, in which case the MOUSE_WHEEL_DELTA holds the distance the wheel has moved.

A script can use this to make the mouse do things on the host.


13.8.52: Variable ONKEY?1/ONKEY?2: Code of keys during ONKEY


$ONKEYN1
$ONKEYN2
$ONKEYS1
$ONKEYS2

These variables identify the key intercepted by an ONKEY statement.
The N1 and N2 variables hold the NUMERIC representations of these keys, the S1 and S2 the STRING values.
ONKEYS1 is the UTF-8 encoded unicode character of the key (so for foreign characters this can be up to 5 bytes long).

Every key on a PC keyboard is identified by 2 bytes. Alphanumeric keys are identified by the first byte (range 0 - 255), the second byte is zero for those keys.
Function keys, ALT keys and combinations thereof are identified by the second byte (the FIRST byte is zero in this case).

If you want to know the codes for a specific key, the easiest way is to use the keyboard debug feature of IVT (see this setup screen). When enabled, the screen will show the codes for every key you type.


13.8.53: Variable ONSEND_DATA: Data from ONSEND


$ONSEND_DATA

This variable identifies the data intercepted by an ONSEND statement. Every time the user causes data to be sent to the host, the trap is executed. This variable contains a single byte for simple keys and multiple bytes for cursor keys, function keys and so on. It is the actual byte-sequence destined for the host.

You cannot modify the data, but you can prevent the data from being actually sent by not doing a PASS_SEND, and doing your own SEND instead.

The key broadcast script uses ONSEND to repeat data to all sessions.


13.8.54: Variable ORIGINAL_HOSTNAME: Initial hostname and user


$ORIGINAL_HOSTNAME
$ORIGINAL_USER

These variables contain the original hostname and user of a session when it was created. The $HOSTNAME and $USER variables usually contain the same information, but a PRECONNECT script can change these to something else.
The originals contain the name of the host as the user types them, and can be useful for displaying in a status bar or comment field.

Usually, these variables will contain the name of the host as the user thinks of it, where $HOSTNAME will contain the translated, full technical name of the host. In simple environments, these are identical. In complex environments, it can be very handy to use these original values.


13.8.55: Variable ORIGINAL_USER: Initial user name


$ORIGINAL_USER

See $ORIGINAL_HOSTNAME


13.8.56: Variable PID: Process-ID of the current script or thread


$PID

Every time a new script is started, IVT identifies it with a unique process ID.
When several sessions are started with the same script, the PID is what identifies one instance from another.
The THREAD and FORK functions return the PID of the created thread.
The WAITTHREAD can be used to wait on particular scripts; the KILL function can be used to terminate them.

A script can use this to generate unique file names, for example.

See also $PPID.


13.8.57: Variable PPID: Parent process-ID


$PPID

When a script starts another script in the background (with THREAD or FORK) the calling script becomes the parent of the created thread.
When IVT itself creates processes, it assigns -1 to the $PPID variable.
A parent can be notified of the death of its children, see IGNCHILDREN.
See also $PID, THREAD, FORK and KILL.


13.8.58: Variable PROTOCOL: Protocol used for the current session


$PROTOCOL

This gives the transport protocol used for the current session. It can have the following values:

"WinSock" Windows sockets (TCP/IP)
"RS232 Serial" Serial connection.
"NetBios" NetBios connections.
"IVT Multiplex" Proprietary IVT multiplexing protocol.
"Dummy" Internal IVT protocol.

You can use this in STARTUP scripts to prevent errors when a certain type of protocol is not currently available. See also PROTOCOL.
See also $PROTOCOL_SESSION, for the session level protocol.
See also ONERROR, which allows you to trap any kind of error.


13.8.59: Variable PROTOCOL_SESSION: Session level protocol


$PROTOCOL_SESSION

The $PROTOCOL variable identifies the transport (low-level) protocol.
This variable identifies the protocol running on top of that, called the session protocol. Values can be:

The NONE is common in combination with the SERIAL transport, TELNET, RLOGIN and SSH will usually run on top of WINSOCK and VTP on top of NetBios.
You can set the protocol using a PROTOCOL statement.

This can be used in scripts to decide which actions are necessary. For example, the password learning system uses this to distinguish between TELNET and SSH, which handle passwords fundamentally different.

See also $PROTOCOL.


13.8.60: Variable ROWS: Number of rows of current session


$ROWS

This variable gives the number of lines on the current session.
The value of this variable is updated automatically whenever the Window size changes. See also $COLS.


13.8.61: Variable SSH_GSSAPI_SERVER: Server principal name


$SSH_GSSAPI_SERVER

When authentication on an SSH session is achieved by means of GSSAPI, this variable will be set to the full principal name of the host you are logging in to. It can be used by a script to show this in the status line or title bar or some such place.

See also $SSH_GSSAPI_USER.
See also SSH_GSSAPI_AUTHENTICATE.


13.8.62: Variable SSH_GSSAPI_USER: User principal name


$SSH_GSSAPI_USER

When authentication on an SSH session is achieved by means of GSSAPI, this variable will be set to the full principal name of the user you are logging in as. It is used by the password learning system to display it when you log in successfully.

See also $SSH_GSSAPI_USER.
See also SSH_GSSAPI_AUTHENTICATE.


13.8.63: Variable SSH_FURTHER_AUTH_REQ: Special login detected


$SSH_FURTHER_AUTH_REQ

The standard scripts that come with IVT try to get you logged in to a variety of hosts using a variety of protocols to get you to where you want to be with a minimum of keystrokes and hassle.
In some cases, that conflicts with what hosts are doing. One example is an SSH session that uses multiple steps to authenticate you (for example a password or key, followed by some form of 2-factor authentication).
In such cases, the standard scripting may be confused: Since the host accepts a password or key, it expects a shell prompt and wants to start to program the prompt, execute commands and so on.

The SSH engine of IVT will print a message: SSH: Further authentication required
when the hosts has a more complex authentication procedure then normal.
In such cases it will also set the $SSH_FURTHER_AUTH_REQ variable to 1.

Your custom login scripts can use this to stay away from such sessions so they do not disturb whatever the "further authentication" requires from the user.

See also $SSH_GSSAPI_SERVER, $SSH_GSSAPI_USER, $SSH_LOGIN_ACCEPT, $SSH_PAGEANT_ACCEPT and $SSH_PROTOCOL_LEVEL.


13.8.64: Variable SSH_LOGIN_ACCEPT: SSH login name


$SSH_LOGIN_ACCEPT

This variable gets assigned when SSH authentication is successful by whatever means. The value is the user name that was used to authenticate.
A script can use this to monitor whether login is successful.
Note that SSH can authenticate through many means, and the resulting identity is not always easy to determine.

A script that wants to provide automatic login must keep in mind that SSH authentication can succeed through other means as well. For example, IVT will remember a typed passphrase and try to re-use if for subsequent sessions. Also, pageant may be running and provide access to a private key. An account may have no password at all. In such cases, SSH_LOGIN_ACCEPT will get a value all of a sudden...


13.8.65: Variable SSH_PAGEANT_ACCEPT: Pageant was used


$SSH_PAGEANT_ACCEPT

Whenever the SSH authentication agent (Pageant) is used to successfully authenticate something, this variable is set to 1. This can be used in a WAIT statement (using VARIABLE_ASSIGN) to monitor authentication.
Note that IVT does not know what the authentication is for, or which user is involved. For example, when some Unix session executes:


scp somefile someuser@somehost:/tmp

then SCP can use Pageant to authenticate as "someuser@somehost", and that will succeed when one of the keys in Pageant is listed in the authorized_keys file of someuser at somehost.

See also Pageant.
See also $SSH_LOGIN_ACCEPT.


13.8.66: Variable SSH_PROTOCOL_LEVEL: SSH2 or SSH1


$SSH_PROTOCOL_LEVEL

This variable is set to 2 when the current session is established using the SSH-2 protocol. Since IVT does currently not support SSH-1, this is the only value this variable can have (it does not exist for non-SSH sessions).

See also PROTOCOL and $PROTOCOL_SESSION.


13.8.67: Variable STATUSTXT: Status line comment


$STATUSTXT

This variable contains the current value of the status line comment field.
This value is set by a CREATE statement, STATUSTXT command, STATUSTXTFIX command or manually from the F4-S screen.
You cannot assign a value to this variable (will have no effect), use one of the commands above for this.

See also COMMENTIGNORE.


13.8.68: Variable URLUSER: Default user for passed URL sessions


GSET URLUSER = "username"

This version of IVT can create sessions by passing an URL from an external source, which can be one of:

All of these methods try to extract some form of host name from the data that is passed to it, and create a session (or a whole bunch of sessions) to such hosts. However, it is often easier to select a bunch of hosts than it is to set the proper user name to use when logging in to those hosts.
When no special action is taken, the user name for such sessions will be empty and the login system of IVT will select the default user (which can come from the address book, or using the default account for the specific host).

When that ends up using the wrong name, the global URLUSER variable can be set to a specific user name to use. This value is used only when the provided data has not resulted in a name. For example:


ivt -u "ivt://somehost someuser/"
ivt -u "ivt://somehost/USER=someuser"

These are two valid ways to explicitly pass a specific user name, so URLUSER would not be used. But when the someuser part is omitted, URLUSER will be used to provide the user name.

It should be set in one of your general setup files in a startup script.
Note: The value is used after the last PRECONNECT script has been executed for the session. This allows you to write your own logic to determine the user name to use. The URLUSER value is used only when all other means of getting a value have been tried.

See also $USER.


13.8.69: Variable USER: User name to use for login


$USER

The $USER variable is set at the same time as the $HOSTNAME variable (when a session is about to be created).
Its value is the word typed on the "User:" line of the create session dialog.
When you use a CREATE statement, you can also use a CREATE "HOSTNAME USER" format.
Lastly, when you invoke IVT from the command line, you can use:


   IVT [options] hostname user

It is up to the PRECONNECT and ONCONNECT scripts to use (or alter) this variable. Its purpose is to allow the user to specify a username on the host and to perform automatic login as that user.
See automatic login example.

Note: When a TABSBAR is in use, the tab for the session can (optionally, but by default) contain the contents of the $USER variable. When the value is altered, the tab is automatically updated (see here for options).

Also, and an active AUTOLOG is automatically re-evaluated (so it switches to a new log file) when that is configured to contain the value of $USER as part of the log file name.

See also $HOSTNAME.
See also $URLUSER.


13.8.70: Variable WAIT_IN: Matched character after a WAIT IN


$WAIT_IN

When you use a WAIT IN "string", and a received character matched any of characters in the specified string, the WAIT terminates and stores the matching character in this LOCAL variable (see CSET).

Example:


   WAIT IN "#>:\$%"     # Possible prompt characters
   ECHO "Seen a prompt character: $WAIT_IN\n"

See also $ANYCHAR.
See also the IN_UNIQUE clause of the WAIT statement.


13.8.71: Variable WAITPID: PID of terminated thread


$WAITPID

When you use a WAITTHREAD function to wait for the termination of a thread, that function returns the exit status of the process (thread) that terminated.
The $WAITPID variable will hold the PID of the terminated process (since WAITTHREAD can wait on several threads simultaneously).

Example:


   Script ThreadExa para1
      echo "I am thread $PID, parameter is $para1\n"
      RETURN 5
   END

   Script Example
      LOCAL a, b;

      a = THREAD ThreadExa("Parameter one")
      b = THREAD ThreadExa("Parameter two")
      ECHO "Started threads $a and $b\n"
      FOREVER
         x = WaitThread()
         IF $x == -1 THEN BREAK

         ECHO "Thread $WAITPID returned $x\n"
      NEXT
   END

This starts 2 threads (2 instances of the ThreadExa script). These threads run in parallel. Each thread prints its single parameter and exits.
The main program prints the PIDs of both threads (a and b), then waits for all threads to exit (WAITTHREAD returns -1 in that case).
A syntax like "WHILE ((x = WAITTHREAD()) >= 0)" would have been nicer here, but IVT does not allow a blocking statement (the WAITTHREAD function) to be used in a complex expression, hence the FOREVER and a test with a BREAK.

See also this example for a use of these functions and variables.


13.8.72: Variable WAIT_VARIABLE: Name of assigned variable in WAIT


$WAIT_VARIABLE

When you use the VARIABLE_ASSIGN clause in a WAIT statement, the WAIT will terminate when some script or thread assigns a value to the given variable.
Since you can have multiple VARIABLE_ASSIGN clauses in a single WAIT statement, IVT assigns the name of the variable that actually causes the WAIT to terminate to this special variable, so your script can easily determine why the wait ended. Of course, you can also use a separate label for each VARIABLE_ASSIGN wait clause, so the WAIT will jump to different spots depending on which variable was assigned.


13.8.73: Variable ZMODEM_AUTO: Current state of ZMODEM_AUTO flag


$ZMODEM_AUTO

This flag is 0 when automatic ZMODEM recognition is off and 1 otherwise.
It is automatically updated by the ZMODEM_AUTO statement.
It is meant to be used by scripts using the FILE_RECEIVE and FILE_SEND commands to do file transfer.


13.9: SCRIPT statements

13.9.1: BATCHMODE (non-interactive session indicator)


BATCHMODE on|off

When a session is created under script control, interacts with a host, and disconnects automatically, the session is non-interactive (batch mode).
Normally, IVT will issue an error when a session dies within 8 seconds without any user input (to allow you to read any error messages before the session disappears). When you use BATCHMODE on, this error is suppressed.

Also, interactive popups (from various error conditions) will not appear, because they require user interaction and the assumption is that no human operator will be present. Various other popups are suppressed and a default action is taken instead.

See also command line variable-assigns to pass information into IVT from other programs.
See also WIN_MINIMIZE, to make such runs of IVT less obtrusive.
See also GUI_ONTOP , to make such runs of IVT more obtrusive.
See also NO_EXPLICIT_EXIT, to exit from IVT automatically.
See also GUI_CLOSE to prevent users from terminating sessions.
See also ENDSESSION and EXIT.
See also SSH_ACCEPT, which is NOT set to AUTO in batch mode!

In the future, other subtle differences may be governed by this statement.
See also ONERROR, which allows you to trap any kind of error.


13.9.2: BEEP (Perform the BELL function)


BEEP

This performs the 'bell' function. When called by a script running in the background, this will cause a muffled beep to sound and the activity indicator to light up with a red background.
For a foreground session it will cause a normal BELL.
However, the BELL configuration option can be used to reprogram the action taken by IVT when a bell-character is received. In that case, the BEEP statement will perform whatever is configured.

Beeps produced by a script are subject to the BELL_ABUSE setting.
See also FLASH.


13.9.3: BREAK (Break from a loop)


BREAK [n]

This can be used to break from a FOR, FORALL, FOREVER or WHILE loop.
The optional number n can be used to specify the number of nested loops that should be broken out of (defaults to 1).
The n HAS TO BE a fixed number, not an expression!

It is a syntactical error to use BREAK outside of a loop, and it is also an error to specify an n that is too high.

See also CONTINUE and NEXT.
Example:


   FOR (i = 0; $i < 10; i++)
      FOR (j = 0; $j < 10; j++)
         IF $i == 5 && $j == 5 THEN BREAK 2
      NEXT
   NEXT

   ECHO "i is $i and j is $j\n"

This rather silly example breaks out of BOTH loops when the work is half-way done. It will print: "i is 5 and j is 5".


This is an important feature, others are prev/next


13.9.4: CALL Script [params] (Function call to a script)


CALL Script [params]

Invokes a script. Script must be the name of a defined SCRIPT, and CAN BE a string expression, which allows calling functions indirectly!

The params are optional. Usually you have to pass an actual value for every defined parameter, but you may specify too few (will be empty strings) or too many (will be ignored).
MIND: There are two different ways to pass parameters, new and old.
The new syntax is like any other programming language:


Call ScriptNm(expr1, expr2, ...)

So parentheses, any number of complex expressions separated by commas.
The old syntax is:


Call ScriptNm arg1 arg2 ...

So, NO parentheses, and every argument is a simple word, like a string or number, and arguments separated by spaces or tabs. These arguments cannot use functions and calculations, often requiring many intermediate variables.
Needless to say, the new syntax is the preferred one.

The invoked script will execute, which in its turn may CALL other scripts (or even itself, recursion is allowed in IVT scripting).

The function call will eventually RETURN, either with a value or without.
In a normal CALL, any returned value is lost. When you use a CALL from an assign statement, the returned value can be assigned to a variable.

If you do not RETURN a value from such an invocation, the result will be an empty string. If you return a value, but the call is not from an assign statement, the returned value is discarded.

See also HIDDEN, DESCRIBE and LOCAL.

This is, of course, a very powerful feature of IVT. There are several examples in this manual that allow you to study how scripts are written, see:

Script to log on to a host automatically.
Script to dial out through modems.
Script to read line from keyboard.
Waiting for any sort of prompt.

Special case: indirect calls.
A CALL can also be written as:


indiri = "myproc \"arg 1\" arg2"
retval = Call($indiri,"arg3")

This will cause a call to "myproc" with 3 parameters:

What happens is that the name of the function being called is always evaluated as a string expression. The first word is interpreted as the name of the function, any remaining words are passed as parameters (use quotes to protect spaces as usual). Any parameters in the normal place (arg3 in the example) are passed as well. This allows indirect calls to procedures with different numbers of parameters.

See also THREAD, for asynchronous execution of scripts.
See also CANCEL, KILL, TRAP, DETACH and HIDE.


13.9.5: CANCEL (Allow script to be cancelled yes/no)


CANCEL on|off

The F3-R or F3-C sequences can be used to reset an entire session to a known state. One effect of this is that all running scripts and threads are cancelled (killed).
As the power of the IVT script language grew and scripts like ESCESC came into being, it became necessary to have a mechanism that allows a script to protect itself against such an event.

CANCEL specifies OFF or ON. When OFF, the script itself and its descendants (scripts CALLed by this script) will not be terminated by F3-R.
When ON (default), the script can be cancelled at any time.
KILL will always work though.

See also DETACH, which allows a script to disassociate itself from the session it is started from.
See also CALL and THREAD.


13.9.6: CAPTURE (capture received characters into variable)


CAPTURE variable [maxbytes label]
CAPTURE off [variable]

This is one of the more powerful commands in the IVT script language.
All data that is received on the session is also stored in the given variable until a CAPTURE off command is given. All data, including ESCape sequences, is stored.
The only exception is NULL bytes, which are silently discarded, see the discussion at WAIT ANYCHAR for a way to catch NULL bytes.

An optional maxbytes expression and a label can be specified. Whenever the captured number of bytes exceeds the specified maxbytes, the CAPTURE is cancelled and the script performs a GOTO to the specified label.
When the OFF option is used, capturing to the named variable is stopped.

When no name is given with OFF, ALL captures for the current session are stopped (use with care). Multiple scripts and threads can capture data to multiple variables if they so desire, even on the same session.

The resulting string can be manipulated with (for example) STRSTR, MATCH and SUBSTR. As an example, consider this part of a login script:


   CAPTURE LogInStuff
   CALL IvtWaitLoggedIn
   CAPTURE off LogInStuff
   IF MATCH("[Yy]ou have mail",$LogInStuff) THEN SEND "elm\r"

This will capture the login-sequence into an IVT variable. If the resulting string contains, somewhere, the string "You have mail" or "you have mail" it starts up the ELM (electronic mail) program of Unix.

The buffer used for the variable is automatically extended when the received characters do not fit in the allocated buffer. If there is no maxbytes given, there IS no maximum size for the resulting buffer, so make sure a CAPTURE statement is not in effect for too long, or all available memory will be used and IVT will exit with a fatal message (modern machines may have a huge amount of virtual memory, so you might not even notice this error).

The maxbytes option should be used to guard against this problem.

Please note that some hosts insert explicit cursor-positioning commands into the data stream in unexpected places, and other formatting (like colors and video modes) which can cause a match to fail because what you see on-screen does not match the actual contents of the buffer. If you have problems, write the contents of the variable to a file (use OPEN/WRITE/CLOSE) for an easier way to inspect the current contents of the variable.

If you want to capture data to a file, an easier way might be to use the AUTOLOG command.
If you want to examine the current contents of the screen, see SCREENTXT.

NOTE: A variable that is used in an active CAPTURE statement must not be modified by other statements. Any attempt to do so will result in an error message on-screen and will cancel the CAPTURE.

If an existing variable is used in a CAPTURE statement, any existing contents is cleared and the variable is re-used (so you can use a LOCAL variable).
Any existing active CAPTURE on the same variable is also silently terminated.

When the variable does NOT exist, it is created as a session variable (global to all scripts that run on behalf of the session but invisible to other sessions). If you use a LOCAL variable and the procedure ends (or RETURNs), the CAPTURE is silently aborted and the variable deleted.

When a scripts starts a CAPTURE with a maximum, and ends without stopping the capture, the jump to the label is silently ignored when the maximum amount of data is captured, and the capture ends.

NOTE: Experience has taught a few lessons here. The texttransfer.ivt package (part of the distribution, see the IVT\texttransfer.ivt file) talks to Unix to receive or send files using UUENCODE or PERL and some fairly advanced trickery.
At one point it has to check whether a file on Unix already exists (and skip the transfer when it does when overwriting is disabled).
My first try was like this:


      SEND "if [ -f \"$BaseNm\" ]; then echo BAD; else echo OK; fi\r"
      WAIT "\r"
      CAPTURE Cpt
      WAIT "\r"
      CAPTURE OFF Cpt
      Cpt = Replace($Cpt,"\n","")
      Cpt = Replace($Cpt,"\r","")
      IF $Cpt == "BAD" \
      THEN ECHO "File $BaseNm exists - skipping!\n" : CONTINUE

And that seemed to work fine. It sends a command, waits for the ECHO of that command (the first wait on a \r), then starts the capture, waits for another \r (supposedly a line with either BAD or OK on it), strips off any caught newlines or CR characters and then assumes that leaves the word "OK" or "BAD".

However, when the code was run on a narrow screen using long filenames, it failed! This was due to the shell that does command line editing: when the command as "typed" by the SEND command is wider than the command line, extra CR characters are sent to create a sort of window that shows the part of the command that can be displayed in the available space.
These extra CR characters caused a problem. I then tried inspecting the string just for the "BAD" or "OK" strings, but since the command is ECHOED, it is hard to distinguish between the BAD being echoed as part of the command being typed, or as part of the actual action.
So, the code was rewritten to:


      CAPTURE Cpt
      SEND "if [ -f \"$BaseNm\" ]; then echo 'B''AD'; else echo 'O''K'; fi\r"
      WAIT "BAD" "OK"
      CAPTURE OFF Cpt
      IF StrStr("BAD",$Cpt) >= 0 \
      THEN ECHO "File '$BaseNm' exists - skipping!\n" : CONTINUE

Now the CAPTURE is started before the command is sent, so I am sure I capture the relevant stuff. The command is sent in such a way that the BAD and OK are not echoed as such (with a few extra quotes). The WAIT is not for an implied \r, but for the EXPLICIT "BAD" and "OK" strings, ONE of which is guaranteed to be received. As soon as that happens, the capture is turned off and the resulting string is simply inspected for the "BAD".

This way the code is much more robust and works better in practice.


13.9.7: CLS (Clear the screen)


CLS

Clears the screen and homes the cursor for the current session.
See also VTECHO, ECHO and SETPOS.


13.9.8: COMMENTIGNORE (Ignore N attempts to set comment)


COMMENTIGNORE n

The status line comment is used to identify the purpose of a session.
It can be set by STATUSTXT and STATUSTXTFIX, by the host and manually (by clicking on it).
It can also be specified as part of CREATE statement. When some of these methods are combined, it can be that the comment sent by a host or set by your own login scripts overrule the one you used in a CREATE statement.
When you don't want this, you can use COMMENTIGNORE to specify the number of attempts to set a session comment that must be ignored. This includes all forms of attempts.

Use COMMENTIGNORE 0 to make sure the next attempt to set a comment is accepted.

See also STATUSHOST.
See also $STATUSTXT, an special variable that contains the current status text.

NOTE: This is a fairly ugly hack. If you want to make sure a comments ends up a certain way, it is best to have your scripts in order so they always work predictable, or use global variables to communicate between various scripts and threads so they know what to do.


13.9.9: CONTINUE (Start a new iteration of a loop)


CONTINUE [n]

This can be used to start the next iteration of an enclosing FOR, FORALL, FOREVER or WHILE loop.
The optional number n can be used to specify the number of nested loops that should be CONTINUEd (defaults to 1).
The n has to be a fixed number, not an expression.
For an example, see BREAK.

It is a syntactical error to use CONTINUE outside of a loop, and it is also an error to specify an n that is too high.

See also BREAK and NEXT.


13.9.10: CSET (Create LOCAL variable dynamically)


CSET name = expr [;]

Where expr can be any complex combination of numbers, strings, operators and built-in functions.

See "variables explained" for a discussion of the various types of variables.
CSET is used rarely, its purpose is to dynamically create LOCAL variables.
Normally, you would use a LOCAL statement to declare variables as local before you use them. However, in some cases, you create indirect variables with names you do not know beforehand, so you cannot use LOCAL (it only accepts names, not expressions). So, to create a local array of 100 variables:


   FOR (i = 0; i < 100; i++)
      CSET MyVar_$i = SomeExpression...;
   NEXT

Would create MyVar_0 to MyVar_99 as local variables, so they are automatically deleted as soon as the script that created them returns.

Note: The newer hashes and arrays are a much cleaner way to achieve the same!


13.9.11: DELSCRIPT (Delete a script from memory)


DELSCRIPT ScriptnameExpr

ScriptnameExpr is a string expression that should result in the name of an existing IVT script. The definition of this script is then deleted from memory.
This is like UNSET for variables.

This can be used, for example, by a script that generates a (new version of) another script, which has to be read (by READRC). To prevent a duplicate script definition warning, you have to use DELSCRIPT.
A newer (and better) way is to use SCRIPT_REDEFINE to redefine a script.

IVT does not keep track of objects created by a script, so if a script has created lots of variables (local or global), these are left intact by DELSCRIPT. This can create surprises if the script keeps track of state in such variables. Use UNSET in combination with DELSCRIPT to prevent this.


13.9.12: DESCRIBE (Describe purpose of the script)


DESCRIPTION string
DESCRIBE string
DESCR string

Describes purpose of script. This string will be shown on the F4-X screen (script execution) for all scripts that are not HIDDEN.

Use it to describe what the script is for. The F4-X screen allows you to manually execute scripts, and the user should know what to expect from this string.
The different spellings of the keyword are just there because I could never quite remember the right spelling :-)  They all do the same.


13.9.13: DELAY_APPLY (delay before applying configuration changes)


DELAY_APPLY ON|OFF

This is a seldom used statement.
When you have a script that modifies many configuration options (like an IVT theme that changes all the color settings), IVT will normally apply the change as soon as the script alters a setting. A theme typically alters about 20 color-related settings, and each of those will result in a full-screen redraw of the session, causing lots of flicker which can be very annoying, especially when the user switches between the options, trying to choose a nice theme.

The DELAY_APPLY ON takes a snapshot of the current settings and then stops updating the session screen when a configuration change is made.
DELAY_APPLY OFF then processes all of the changes in one operation.
This setting only affects configuration settings that modify what the screen looks like - other settings are always processed immediately.

It is an error to do a DELAY_APPLY OFF without an earlier DELAY_APPLY ON.
When a script forgets to execute a DELAY_APPLY OFF, it is performed automatically when that script returns.


13.9.14: DETACH (Detach a process from a terminal session)


DETACH [RUN_ALWAYS|ON|OFF]

This statement detaches an instance of a script from the session. This means that this script, and any scripts it might CALL, will not be terminated when the session that started them terminates. Instead, they will be inherited by another session. Thus, a detached script will die only when IVT terminates. This is useful for THREADs that perform some (endless) task not related to a particular session.
For technical reasons, a script MUST have the context of a session to run in, since very many statements query or alter "the session".

The "ON" means the script will be inherited by another session if the current one terminates, but will run normally.

When RUN_ALWAYS is specified, the script will run even when other types of script are prevented from running (such as when the history pager is in use, the session is in an error state, etc.).

The OFF directive turns the detachment off. All protections no longer apply.

A detached script still needs to protect itself from a RESET (F3-R) or a cancel (F3-C). Also, it needs to think about a KILL (TRAP).
See the CANCEL statement for this.

Also, when the session that the script started in terminates, all variables belonging to that session will be destroyed, so a RUN_ALWAYS script should use LOCAL variables or GSET variables only, or be able to handle variables that suddenly disappear.

See also SECRET and HIDE.


13.9.15: DIALOG (GUI dialogs in scripts)

This allows IVT scripts to create and manage GUI dialogs, which improve the look and feel of those scripts tremendously.
The password learning and autologin system uses this feature.

Also, the installation wizard of IVT uses many GUI dialogs. Since the source of the wizard is part of the IVT package, if you want to program dialogs, you are encouraged very much to carefully study config.ivt! You can find it in folder "ivt" in the main IVT installation directory.

If you have previously used the WINDOW statement to create interactive scripts, you are encouraged to upgrade to DIALOGs.
See the topic on dialog alignment to make attractive displays.

An IVT script dialog can create the following controls (a "control" is an item such as a button, option, list box, text box, etc):

Each control is identified by a TAG. The control can be manipulated after initial creation using the tag, and events generated by the control (for example a user clicking a button) use the tag to identify the control.

After a dialog is created, it can be displayed using DIALOG SHOW.
Actions performed by the user are reported using DialogEvent.
The current state of the controls can be inspected using DialogQuery.
Dialogs can be temporarily hidden using HIDE/UNHIDE.

A DIALOG is created by using a single statement with just a name. This creates a handle that is used in subsequent statements and functions to manipulate the dialog. A dialog is destroyed using the DESTROY command. For example:


   DIALOG CFG DESTROY
   DIALOG CFG

This makes sure that any old instance of a dialog is destroyed before creating a new one.
All options and commands can be expressed as string-expressions. See the examples for various useful combinations. Irrespective of the current setting of IdentifierAs, plain strings are seen as strings and not as variable references (this saves a lot of quotes in DIALOG statements).

NOTE: The list of options after all these commands are IVT expressions. That means all sorts of options can be the result of calculations and built-in functions (which is great) but it also means that an expression like:


   HEIGHT=10


is seen as an assignment to the variable "$HEIGHT" and the VALUE of that expression is 10!  So the effect is the same as writing "10", and the option is not recognized. So the rule is to quote such expressions that contain an equals sign:


   "HEIGHT=10"


works much better.

Below you find the full list of commands, controls and their options:

Alignment of controls in a dialog.
All standard dialogs of IVT itself use a few basic tricks to align items in dialogs:

Color specification for labels and contents. Version 25.3 allows advanced coloring of label texts, and in some cases, the content of GUI dialog items (using LABEL_COLOR and CONTENT_COLOR options).
Such an option allows maximum freedom in specifying the foreground and background colors. There are 3 basic formats:

A color specification is a combination of the two colors. The first is the foreground color, the 2nd is the background color. Examples:


COLOR_LABEL=brightred default"          # Foreground bright red
COLOR_LABEL=brightred brightwhite"      # Very red on very white
COLOR_LABEL=250 0 0 blue"               # Foreground red, background blue
COLOR_LABEL=pink 60 60 60"              # Pink on light grey
COLOR_LABEL=180 170 160  60 50 40"      # Creative combination

Careful use of color can aid in easy-to-use dialogs.
Excessive use of this in a dialog can make things very ugly.

Automatic assignment of shortcut keys.
Before version 24.1 of IVT, writing scripts to create GUI dialogs also involved the painstaking assignment of unique shortcut keys by adding an '&' character in the appropriate place in the labels of items and texts of buttons.
If you are unfamiliar with keyboard shortcuts: when you press ALT in a Windows dialog, some characters will become underlined. Typing ALT plus the appropriate character is a quick way to access that field, button, option or whatever.
In a complex dialog, it implied picking unique characters from each item to act as an appropriate shortcut.
When a DIALOG was altered at a later time, it was easy to forget about those characters, and end up with duplicates or items without a keyboard shortcut.
Even worse were translations to other national languages: picking unique sets was a pain.

So IVT 24.1 introduces auto-shortcuts. Basically, it means you can forget about them, everything is handled automatically.

The feature works as follows:

In practice, it ends up with a nice, intuitive shortcut for all items. If it fails to work as desired for a particular item, you can use an '&' in that one item to force IVT to assign it (and assign all others automatically).

If you use AUTOSHORTCUT_OFF, IVT will not assign shortcuts and you must revert to manually assigning them.


13.9.16: DISPLAY (Enable display of receive characters yes/no)


DISPLAY ON|OFF

Display received characters yes (ON) or no (OFF).

When you use DISPLAY OFF, characters received on the session from the host are not displayed on the screen, and escape-sequences are not interpreted.
All input is, however, processed by WAIT statements (if you have those), so you can use this to hide a noisy or lengthy interaction with a host from the user. A SCRIPT will have to execute a DISPLAY ON at some time to enable display of characters again.
Scripts can nest calls to DISPLAY - for every OFF you will have to call ON to re-enable the display. When ON is called too many times, it is silently adjusted.

An F3-R (User initiated RESET) will also turn display on again.

There is one 'but': Since escape-sequences are not interpreted, queries from the host (using escape-sequences) are not answered either. This can frustrate login-sequences (where the host tries to determine the connected terminal type by sending an enquiry), which is unanswered when DISPLAY OFF is active.
In this case, you will have to set up a THREAD that WAITs for such sequences and answers them (with SEND).

See also IGNORE_ESCAPE.


13.9.17: DISPLAYLENGTH (Count number of UTF-characters in string)


DISPLAYLENGTH(string)

Returns the number of display positions that will be used by the given string when displayed on the IVT session screen. The function is most useful if the string is encoded in UTF-8 (such as returned by the ScreenTxt function) and contains complex Unicode characters (can be double-width) and/or combining characters (which can be zero-width).
The function takes the various settings that IVT has for these display functions into account.
The simpler LENGTH function simply counts the number of bytes, this function counts how many positions the cursor would advance when the string is displayed.


13.9.18: DO/UNTIL loop.


DO
... statements ...
UNTIL expression

Like the WHILE, FOR and FOREVER, the DO/UNTIL is a loop. In this case, the statements will always be executed at least ONCE. The loop continues to run until the expression evaluates to TRUE.
Note: there is NO do/while in the IVT script language.

CONTINUE and BREAK work normally inside a DO/UNTIL.


13.9.19: DRAWBOX (Draw a box on the screen)


DRAWBOX x1 y1  x2 y2

Draws box, x1:y1 specify the coordinates of the upper left corner of the box, x2:y2 specify the coordinates of the lower right corner of the box.

This function draws a double-lined box on the screen, to prettify interactions from complex scripts (such as the dialer example).

This command is very old: complex interactions are much better dealt with using a DIALOG instead of the old way of abusing the session screen with ECHO statements and reading the keyboard using ONKEY.


13.9.20: ECHO (Display a string on the session screen).


ECHO     expression
ECHO_LIT expression

Display the expression result on the screen of the current session.

ECHO gives access to the internal routine of IVT that is used to display these manual pages and all other IVT-internal screens. Because I did not want to use the VT220 escape-sequences to do highlight, underlines and so forth (too complex and verbose), I have created my own very simple system of codes to manage these display attributes. The 'Escape Character' for these is a ~ (tilde). The following combinations are valid:

~1 Turn on reverse video.
~2 Turn on highlighted (a.k.a bold) video.
~3 Turn on blinking video.
~4 Turn on underlined video.
~u Ends underline, leaves other modes untouched.
~0 Return to normal video.
~AXX - Color code as created by ColorAttribute.
~- Solid horizontal line (--).
~_ Solid double horizontal line (__).
~~ Display a single ~.

With this, it is very simple to build nice screens with attractive formatting.
If, however, you need the full power of VT220 escape sequences you can always use the VTECHO command, which treats its arguments as if it were data received from a host.
Expression can be a complex expression, like in ECHO 2 * 2.

The ECHO_LIT can be used to do a literal echo. Use that to inspect the contents of a string that may contain tilde characters. ECHO_LIT does not interpret the string at all. However, when you write:


ECHO_LIT "This string contains a tilde (~) character\n"

This will NOT display \n on screen, but will do a newline action! This is because the \n in the string constant is translated into a new line character when the source of script is read, so ECHO_LIT does not see the backslash, it sees a single new line character...
Similar things hold for \r, \t and so on. Use a double backslash to display a backslash:


ECHO_LIT "This displays a backslash-n: \\n"

See also SPRINTF and VTECHO.


13.9.21: ENDSESSION (Abort current session)


ENDSESSION

Aborts the current session (same as ALT+F4) and closes the session (window, running scripts, variables etc).

However, see also GUI_CLOSE, which can disallow the user from forcing sessions closed, leaving only this ENDSESSION statement as a means to kill a single session.

This statement never returns - when the session is ended, the currently executing script is destroyed together with all other attributes of that session. Use it when you know for sure that the session serves no further purpose. Also see (NO)RECONNECT, since this setting will determine whether IVT will try to re-establish a new session when the current one is lost. If you want to make sure, then


   NO_RECONNECT
   ENDSESSION

will instantly close the current session without reconnect.
When this was the last session, IVT will exit and either return you to the operating system or display the initial Create-Session dialog depending on the setting of EXPLICIT_EXIT.
See also the IVT special ESC<space>P escape sequence, which can be used by the host to tell IVT to disconnect.
See also EXIT.


13.9.22: EXIT (Ends IVT)


EXIT number

This simply causes an immediate exit of the IVT program, returning the (numeric) argument as the exit status to the operating system.
The number can be a complex expression.

No checks or warnings are performed - if you have many sessions open and one script in one session somewhere calls EXIT, all sessions die immediately.
Needless to say: use with care. Example use is in a startup script where you detect some fatal error, or in a batch run of IVT (see BATCHMODE) where you know that there will only be one session anyway.

See ENDSESSION to abort a single session.
See RETURN to return from a script CALL normally.
See also EXPLICIT_EXIT.


13.9.23: FOR/NEXT (For loop BASIC style)


New syntax:
FOR (startexpr; testexpr; increxpr)
  Statements
NEXT

Old syntax:


FOR Variable Start End [Increment]
  Statements
NEXT

In the new syntax, you can use the new style expressions to make the FOR more readable and powerful than the old syntax, for example;


   FOR (i = 0; $i < 100; i++)

Instead of:


   FOR i 0 100 1

New syntax:
The startexpr is executed once, then the testexpr is evaluated once for every iteration of the loop. After every iteration, the increment expression increxpr is executed. The FOR terminates when testexpr evaluates to FALSE.
Statements will be executed zero times when testexpr evaluates to FALSE the first time.
Statements will be executed infinitely many times if testexpr never evaluates to FALSE. If that is intentional, see FOREVER.

Old syntax:
The Variable, Start, End and Increment are all string expressions.
The Variable is initialised to the value of Start, and the Statements are executed as long as the value of Variable does not exceed the value of End.
After every iteration, Variable is incremented by the value of the optional Increment expression (defaults to 1).
Statements can be executed 0 times if Start is greater than End.
Statements will be executed infinitely many times if Increment is zero.

Loops (FOR, FORALL, WHILE and FOREVER) can be nested up to 10 deep.
Use BREAK to break out of a loop prematurely.
Use CONTINUE to start a new iteration of the loop before the NEXT is reached.

Example:


   FOR (i = 1; $i < 10; i = $i + 1)
      echo "i=$i\n"
   NEXT

This is your basic kind of FOR loop (prints out i=1 to i=9).
Make sure you do not write "i = i + 1" as increment expression, since the second "i" is seen as a string, which evaluates to TRUE (1) since it is not empty, so the new value of "i" becomes 2 every time...
A better way (starting with IVT 25.1) is to write "i++".
The same goes for "i < 10" which is always TRUE and has nothing to do with the value of the variable i (which is $i).

See also IDENTIFIERAS(), which allows you to change this behavior.


13.9.24: FORALL (Loop through hashes, arrays and variables)

This is a powerful statement that allows you to manipulate arrays of variables in IVT scripts, or loop through complex data structures such as hashes and arrays.

There are several types of FORALL loops:

For other types of loops, see WHILE, UNTIL, FOR and FOREVER.


13.9.24.1: FORALL (Loop through existing variables, new syntax)

The FORALL statement has been upgraded in IVT version 25.0 to allow you to iterate through a hash or array. The syntax for iterating through a list of existing variables has been improved, while retaining compatibility with old scripts, of course.
See here for the old syntax of the FORALL statement

The new syntax for looping through existing variables is:


FORALL (VARIABLES Name LIKE regexp [CASE_INSENSITIVE] [FILTER typelist])
   ... Statements ...
NEXT

Typelist is comma-separated list of one or more of:

IVT will inspect all existing variables and execute Statements once for every match found with Name set to the full name of the variable.
The match is specified using a regular expression.
The $FORALLTYPE variable indicates the current type of variable.
The FILTER expression can be used to specify a (partial) match on FORALLTYPE to make selecting the proper variables easier.
Before the loop is executed, the list of variables that matches the regexp and filter is sorted alphabetically.

All this is perhaps demonstrated best by an example:


   Script Test
      xxx1 = "I am xxx1";
      xxx2 = "I am xxx2";
      xxx3 = "I am xxx3";

      FORALL (VARIABLES Nm LIKE "^xxx")
         IF $FORALLTYPE != "LOCAL" THEN CONTINUE
         x = Expand("\$$Nm")
         ECHO_LIT "Variable $Nm = $x\n"
      NEXT
   END

When script "Test" is started, it creates 3 variables whose names start with "xxx". The FORALL loop will be executed 3 times (assuming there are no other variables that start with the "xxx" prefix).
Nm will be set to xxx1, xxx2 and xxx3 respectively. The Expand function can be used to get the current value of a variable.

The rules are as follows:

As an example, this little snippet will display all variables, their type and values as visible to the executing script:


   FORALL (VARIABLES x LIKE ".")
      ECHO "$FORALLTYPE: $x" Expand("\$$x") "\n"
   NEXT

Note: This does not display the value of a hash or array variable correctly, but will find the name of such objects. Use TYPEOF to determine the type of a variable found by a FORALL loop.

See also the old FORALL syntax.


13.9.24.2: FORALL (Loop through existing variables, old syntax)

The FORALL statement has been upgraded in IVT version 25.0 to allow you to iterate through a hash or array. The syntax for iterating through a list of existing variables has been improved, while retaining compatibility with old scripts, of course. If you write new code, you are urged to use the new syntax described here.

The old syntax is much simpler, it just matches a cases sensitive prefix or selects everything by using the word ANY. The old syntax is:


FORALL Name {Prefix | ANY} [FILTER]
     ...Statements...
NEXT

Example:


   FORALL x ANY
      ECHO "$FORALLTYPE: $x" Expand("\$$x") "\n"
   NEXT

This iterates through all existing variables and prints their values.
See also TYPEOF, HASHES and ARRAYS.
See also NAMEOF and GETVALUE.


13.9.24.3: Syntax for iterating through a hash

In version 25 of IVT, hashes and arrays were added to IVT to allow more complex data structures to be manipulated by IVT scripts.
Al this is based (loosely) on Perl, if you know Perl you will recognize many of the IVT features. However, IVT is limited in many ways when compared to Perl (but IVT emulates a terminal way better than Perl can :-)

There are separate loop types for the key values of a hash and the members of an array. The FORALL KEYS is used to iterate through the keys of a hash, explained below. The FORALL VALUES is used to loop through the members of an array.


   FORALL (KEYS [order] var [match] $HashVar[part])
     ... Statements...
   NEXT

order: ASCENDING | DESCENDING
match: [NOT] LIKE "pattern"
       [NOT] CONTAINS "string"  
       Optionally followed by "CASE_INSENSITIVE"

This will find all keys in the given hash $HashVar.
You can specify a part of a hash by giving the appropriate keys (see below for an example).

The loop will find the keys in the order they are stored, unless you specify a sorting order, in which case they will be sorted alphabetically in either ascending or descending order.

The "var" variable gets the value of the current key.

The "match" allows you to specify a filter for the key values.
The "LIKE" uses a regular expression syntax to include (LIKE) or exclude keys (NOT LIKE) that match the regular expression.
The "CONTAINS" uses a simple substring to include (CONTAINS) or exclude (NOT CONTAINS) keys that contain the given string.

The CASE_INSENSITIVE keyword can be used to specify the type of comparison used by the CONTAIN and LIKE operators.

Note: Before the first execution through the loop, all keys that currently match the selection criteria are selected. If the code in the loop alters the contents of the hash, that does not influence the number of iterations or the values of the keys seen by the loop.

Example:


   hash{1}{'one'} = "The first"
   hash{1}{'two'} = "The second"
   hash{2}{'one'} = "2/one"
   hash{5}{'one'} = "5/one"
   hash{"last"}{'one'} = "last/one"

   FORALL (KEYS DESCENDING x NOT CONTAINS "a" $hash)
      ECHO "Key=$x\n"
   NEXT

This will select all the keys that do not contain an "a" and sort them in reverse order. Since the FORALL does not specify a key for the hash, all keys in the first dimension of the hash are selected. So this will print:


   Key=5
   Key=2
   Key=1

To print all the members of the 2-dimensional hash in the example, two nested loops are required:


   FORALL (KEYS ASCENDING x $hash)
      FORALL (KEYS ASCENDING y $hash{$x})
         ECHO "hash{$x}{$y} = $hash{$x}{$y}\n";
      NEXT
   NEXT

This will print:


   hash{1}{one} = The first
   hash{1}{two} = The second
   hash{2}{one} = 2/one
   hash{5}{one} = 5/one
   hash{last}{one} = last/one

Of course, hashes can have an arbitrary number of dimensions.

Use TYPEOF to dynamically determine what a specific variable is (SCALAR, HASH, or ARRAY). TYPEOF can also be used on members of a hash to determine what type that part of the hash contains.
See also the DUMPER example that can format arbitrary hashes.

See also FORALL for arrays.
See also FOR, WHILE, FOREVER, UNTIL and NEXT.


13.9.24.4: Syntax for iterating through an array

In version 25 of IVT, hashes and arrays were added to IVT to allow more complex data structures to be manipulated by IVT scripts.
Al this is based (loosely) on Perl, if you know Perl you will recognize many of the IVT features. However, IVT is limited in many ways when compared to Perl (but IVT emulates a terminal way better than Perl can :-)

There are separate loop types for the key values of a hash and the members of an array:


order: ASCENDING | DESCENDING
match: [NOT] LIKE "pattern"
       [NOT] CONTAINS "string"  
       Optionally followed by "CASE_INSENSITIVE"

This will loop through all values in the given ArrayVar variable.
That last part of the statement must evaluate to the name of an array. This can be the last dimension of a hash, or a plain array (not part of a hash).
For examples, see below.

The loop will find the values in the order they are stored in the array (left to right, or front to back depending how you visualize it), unless you specify a sorting order, in which case they will be sorted alphabetically in either ascending or descending order.

The "var" variable gets the value of the current array member.

The "match" allows you to specify a filter for the selected values.
The "LIKE" uses a regular expression syntax to include (LIKE) or exclude values (NOT LIKE) that match the regular expression.
The "CONTAINS" uses a simple substring to include (CONTAINS) or exclude (NOT CONTAINS) values that contain the given string.

The CASE_INSENSITIVE keyword can be used to specify the type of comparison used by the CONTAIN and LIKE operators.

Note: Before the first execution through the loop, all values that currently match the selection criteria are selected. If the code in the loop alters the contents of the array, that does not influence the number of iterations or the values seen by the loop.

Example for a simple array:


   Push(0,MyArray,"Three", "blind", "mice");
   FORALL (Values x $MyArray)
      echo "$x "
   NEXT
   echo "\n"


This will print "Three blind mice".


   Push(0,MyArray,"Three", "blind", "MICE");
   FORALL (Values x CONTAINS "i" case_insensitive $MyArray)
      echo "$x "
   NEXT
   echo "\n"


Will print "blind MICE", because member "Three" is skipped because it does not contain either an upper or lower case "i".

Processing a more complex hash:


   Push(0,Hash{2},"Margarine", "Butter", "fat", "Alcohol")
   Push(0,Hash{1},"Sugar", "Coffee", "Tea");
   FORALL (Keys k ASCENDING $Hash)
      FORALL (VALUES v ASCENDING LIKE "^[A-Z]" $Hash{$k})
         ECHO "$k: $v\n"
      NEXT
   NEXT


Will print:


   1: Coffee
   1: Sugar
   1: Tea
   2: Alcohol
   2: Butter
   2: Margarine

Note that the order is ascending for both keys, and member "fat" is skipped because it does not match the initial capital letter specified by the pattern.

See also FOR, WHILE, FOREVER, UNTIL and NEXT.
See also the DUMPER example that can format arbitrary hashes.


13.9.25: FOREVER/NEXT (Infinite loop)


FOREVER
   Statements
NEXT

This is an infinite loop, that should be broken by a GOTO, RETURN or BREAK or some such forced means.
The Statements are executed indefinitely.
See also WHILE, UNTIL, FOR and FORALL.


13.9.26: GLOBAL (Change a global IVT.RC setting)


GLOBAL <.rc statement>

Sets global configuration options. When the GLOBAL keyword is omitted, this will set options LOCAL to the session. See also VOLATILE and COLOR_VOLATILE.

ATTENTION: The GLOBAL keywords has nothing to do with the LOCAL keyword (appearances not withstanding :-) The LOCAL keyword is used to indicate that one or more variables are of local scope (current SCRIPT only), and variables that are set with the GSET statement are global variables (visible in all current and future sessions).

The GLOBAL keyword changes an IVT.RC setting! When the GLOBAL keyword is used, this will change the setting for all future sessions, but NOT for the current one (unless the particular setting is global only, see the documentation for that particular setting).
When the GLOBAL is omitted, only the current session is changed, and NOT all other current and future settings.

Almost all IVT.RC settings can be changed from a script, except for a few that are impossible to change afterwards (they cause errors when you try).

Note that when an IVT.RC setting is used OUTSIDE a script, it is automatically considered global - since it defines the settings IVT starts up with.
The GLOBAL command is a script statement, hence syntactically wrong anywhere else.


13.9.27: GOTO (Jump to a label unconditionally)


GOTO labelexpr

Jumps to the mentioned label. When the label does not exist, this will print an error message in reverse video on the session screen.
See also GOTO_OPT (optional GOTO).
See also ONERROR, which allows you to trap any kind of error.
The labelexpr can also be a string-expression, which should result in an existing label.
For example:


      x = CALL MenuChoice
      GOTO "Menu_Item_$x"
   LABEL Menu_Item_1
      ...
   LABEL Menu_Item_2
      etc...

This uses an indirect GOTO. One might also write:


      GOTO Concat("Menu_Item_",$x)

To make the concatenation and indirection more explicit.


13.9.28: GOTO_OPT (Optional GOTO)


GOTO_OPT labelexpr

This is like GOTO, only the statement does nothing when the resulting label does not exist (the standard GOTO generates a run time error).
This can be very convenient when you use indirect GOTO statements that can evaluate to invalid targets.

A little example:



Choice = Prompt("Enter your choice (1-5):",1,1)
GOTO_OPT MENU_$Choice
ECHO "Sorry - invalid choice: $Choice\n"
RETURN

LABEL MENU_1
   # User typed a "1" as choice...
   ...
   RETURN

LABEL MENU_2
   # User typed a "2" as choice...
   ...
   ... etc ...

This will attempt to branch to "MENU_9" when the user types 9, which does not exist, so the GOTO_OPT does nothing which means the error handler can be coded just after the GOTO_OPT. In other words, this is the multi-branch IF statement of the IVT scripting language.

For more advanced error handling, see ONERROR.


13.9.29: GSET (Set global variable)


GSET name [=] expr

Sets global variable name to expr.
The equal sign is optional, THE SPACES BETWEEN PARTS ARE NOT! See variables explained for further details on variables.
See the LSET statement for examples.

"Global" means that the variable will be visible in all (parallel) sessions.
Normal variables are local to the session that creates them. LOCAL variables are visible only to the current level of script (see LOCAL and CSET).
Global variables are rarely used, but vital for some applications.
Example:


Script STARTUP
   IF $IvtPasswdFile == "" \
   THEN GSET IvtPasswdFile "$IVTTMPDIR/PASSWORD.IVT"
   ...
END

INCLUDE_OPT "$IvtPasswdFile"

This startup script runs while IVT is starting. It sets a global variable with the name of file, which is the included into the configuration using an INCLUDE_OPT statement which uses the global variable. This makes for very flexible configurations.

See also LSET, LPSET, GPSET and CSET.


13.9.30: GPSET (Set global PUBLIC package variable)


GPSET name [=] expr

The GSET statement sets a global variable and can be used to create a DYNAMIC variable by using an indirect assign:


Nm = "...some expression ..."
GSET $Nm = expr

This cooks up some name, then creates a global variable with that name.
Problem with such dynamic global names that are part of a PACKAGE is that you cannot write a PUBLIC declaration for such variables because you do not know the names in advance. This is what GPSET is for: it combines the GSET with a dynamic PUBLIC declaration to create dynamic variables that are visible in all sessions and all packages.

See also LPSET.


13.9.31: HELP (Provide help from within a Script)


HELP "Subject"

When you use the HELP statement in a script, IVT will pretend you did a search in the manual pages with the given Subject.
This will display the help screen for this subject when it exists.
IVT will first search for a topic that exactly matches the subject (the name of a hyperlink). If it cannot find that, it will search for a string that matches the subject. If it cannot find that, it will display an error.
The Subject can be a complex string expression.

Example:


   HELP "IF"

Will show the help on the IF statement. Note that searching the help FIRST does a search on a topic with the given name. Only when that fails, will it do an ordinary search on the text. So "IF" finds the "if" statement, not the very first occurrence of the word "if" in the manual.
This works for manual searches, too.

See also DIALOG HELP to associate internal IVT help with items in dialogs created by a script.


13.9.32: HIDE (Hide a script from the F4-X screen)


HIDE
HIDDEN

Script does NOT appear in F4-X screen. Most scripts should have this attribute. Public scripts (non-HIDDEN) can be executed manually from the F4-X screen. In practice, most scripts are only CALLed by other scripts, and the chain is started by an ONCONNECT or PRECONNECT trigger.
Also, you can BIND scripts to (function) keys, or use KEYMACRO.
However, some scripts are meant to be started manually.

See also DESCRIBE, which allows you to identify a scripts purpose.
See also MENU, which allows you to invoke your own scripts from the menu bar.
See also CANCEL.


13.9.33: IF (Conditional statement)

This is (of course) one of the most powerful statements in the script language because it allows conditional scripts. Over time, 3 different syntactical forms of the IF have evolved, all of which are supported:


IF expression Label
IF expression THEN Statement [: Statement]... ELSE Statement [: Statement]
IF expression THEN { block } [ELSE { block }]

Older versions of IVT (pre 2007) had a very limited expression syntax.
Version 21 of January 2007 introduces a much more powerful syntax for expressions.
Version 25 (April 2017) finally adds nested statement blocks to the language.

The simple first version simply jumps to the given Label when expression evaluates to TRUE, like:


   IF $x > 9 TooBig
   ...
LABEL TooBig
   # $x is over 9

When the THEN keyword is used, it can be followed by one or more statements, separated by colons, like so:


  IF $x > 9 \
  THEN x = 1 : echo "All done\n" : RETURN \
  ELSE x = $x + 1

There are still some important limitations:

Starting with version 25.3, IVT supports blocks of statements in the THEN and ELSE branches of the IF. These are delimited by curly brackets { ... } and no longer have to be on a single, logical line. The statements between the curly brackets have no more limitations: all normal script statements can be used, including other IF statements of all varieties, including nested block IFs.
For example:


   IF (expression) THEN {
      statement1
      statement2
   } ELSE {
      statement3;
      statement4;
   }

The styles of THEN and ELSE can be mixed (a colon-separated simple list in the THEN and a block in the ELSE or v.v.

There is one limitation concerning layout: The THEN and curly-open must be on the same (logical) line as the IF, and the closing curly bracket of the THEN, the word ELSE and the optional curly bracket open of the ELSE block must also be on the same (logical) line (like in the example above). If you want a different optical layout, use line continuation:


   IF (expression) \
   THEN {
      statement1
      statement2
   }     \
   ELSE  \
   {
      statement3;
      statement4;
   }

The backslashes at the end of the line make all the difference here.
Violating that simple rule will give you various syntax errors.

See also GOTO, WAIT and LABEL. See also the various examples, which contain numerous IF statements.


13.9.34: IGNCHILDREN (Ignore exit of child processes)


IGNCHILDREN "on"|"off"

Normally, children created by the THREAD or FORK statement execute independently until they RETURN. The return value of such a process must be collected by a WAITTHREAD statement (analogous to FORK/WAIT in Unix).
Also analogous to Unix is that sometimes you want to forget the fact that you have created child processes, and their demise is of no interest to you.

When an IGNCHILDREN ON is in effect at the time the thread is created, a child process that exits simply disappears immediately, its exit status is lost.
When IGNCHILDREN OFF is in effect (the default), a 'zombie' is left that occupies resources, which are not freed until a WAITTHREAD is done by the parent to collect the exit status.
This setting is per thread; it only affects the children created by the thread that executes the IGNCHILDREN statement. A child thread inherits this setting from its parent.

A lone IGNCHILDREN is equivalent to IGNCHILDREN "on".


13.9.35: IGNORE_ESCAPE (Ignore the next ESCAPE sequence)


IGNORE_ESCAPE
IGNOREESCAPE (old spelling)

This command causes the next escape sequence transmitted by the host on the current session to be ignored.

In rare cases, hosts will send things that are simply wrong, and which cannot (easily) be fixed. For example, if you tell your HP-UX machine that you are a VT220 terminal (IVT's default), the darned thing will send you an initialization string during logon that assumes that the screen is 25 lines long (the initialization sets a 25-line scrolling region explicitly).

When the window is bigger, this results in a messy screen, especially if the cursor happened to be below line 25 when the command was issued.
This ought to be fixed in the terminfo entry for the vt220 on the HP, but I was not the administrator, there were a lot of machines involved, so I invented the IGNORE_ESCAPE command.

With this, you can use a WAIT statement to wait for stuff that offends you.
Every received character on the session is FIRST processed by these WAITs, so you can write a bit of script like:


        WAIT "\1B[1;25r"
        IGNORE_ESCAPE

The main IVT engine will look at an internal flag set by the IGNORE_ESCAPE statement before executing any escape sequence. Since the actual "r" command character is first seen by the WAIT, the actual command will be ignored this way.
This is perhaps not the most elegant command in IVT, but it works...
Both spellings of the command have the same effect.

NOTE: This command only works in combination with WAIT (you have to WAIT for the proper command to ignore). Whenever IVT sees an ESC character from the host, it resets the internal ignore flag. The WAIT must match the ESC character and the specific command, and then issue the IGNORE_ESCAPE.
If for some reason you want to ignore all ESC commands, you'll need something like this:


        FOREVER
           WAIT "\1B"
           IGNORE_ESCAPE
        NEXT


Which waits for an escape character and ignores whatever command comes next.

13.9.36: KEYBOARD (Enable/disable keyboard)


KEYBOARD ON|OFF
KEYBOARD AUTHENTICATE_ON|AUTHENTICATE_OFF

Enable (ON) or disable (OFF) keyboard during execution of a script.
This is useful during automatic login-scripts that you do not want to be disturbed by keyboard input from the user.
Normally, during execution of a script, all keyboard input is processed normally by IVT. Data-generating keys will result in data being transmitted to the host, possibly intermingling with the data generated by SEND statements.
Other keys are internal to IVT and cause (for example) switching to another session, creation of new sessions or setup/help.

With KEYBOARD OFF only this last class of keys is still active. All data generating keys are disabled. Make sure that the script ends in a KEYBOARD ON or it will be impossible to use the session. In that case, the user must issue an F3-R command (which will reset the entire session, including termination of any script for that session and re-enabling the keyboard).

If the user types data while a KEYBOARD OFF is in effect, the data is buffered (for that particular session) and will be transmitted when a KEYBOARD ON is issued sometime later. This means type-ahead by the user will still be transmitted to the host, only a bit later.

IVT counts the number of KEYBOARD OFF statements, and the same number of KEYBOARD ON statements is required to actually turn the keyboard on again.
Therefore it is important to balance the number of OFF and ON statements, so multiple parallel THREAD scripts can all manipulate the keyboard as they see fit and it will only be actually enabled when all scripts allow it.

NOTE: The exception is AUTHENTICATE_ON. If the keyboard is disabled by one or more scripts waiting to configure a session once login is complete, and the user needs to type a username, password or some other type of authentication, the keyboard MUST be temporarily enabled. The PWDLEARN system uses this to make sure the keyboard is enabled when it is really necessary and locked otherwise.
The AUTHENTICATE_ON is independent of, and overrules any nested number of, normal KEYBOARD ON/OFF statements.

Keys to switch sessions (or to create new ones) are ALWAYS processed by IVT, so are keys to manipulate menus, start setup (F3) and so on.

There is also an escape sequence from the host that can disable the keyboard.
This is handled separately - as long as the host keeps the keyboard disabled, KEYBOARD ON won't do any good.

See also DISPLAY.


13.9.37: KILL (Kill an IVT script process)


KILL pid signal

When a process is created with THREAD or FORK, a PID (process ID) is returned to the caller.
The WAITTHREAD function can be used to wait for this PID to terminate, the KILL statement can be used to signal an event to the process. The PID must be valid, or the statement is silently ignored.
Every instance of a script can refer to the value of $PID to find its own unique process ID, and to $PPID for its parent.

The destination process must have used a TRAP statement to handle the incoming signal (otherwise the signal is silently lost). So really, KILL is a misnomer, as it does not actually kill anything - it sends signals only.

When a TRAP is in effect, execution of any script in the destination process is aborted and control is transferred to the label mentioned in the TRAP.

The signal is a number between 1 and 10 inclusive. No special meaning is attached to these numbers by IVT itself.

See also F3-R and F3-C, two ways a user can terminate scripts. See also the CANCEL statement.


13.9.38: LABEL (Define a target for IF/GOTO/WAIT etc)


LABEL name

Target for IF, WAIT, GOTO, TIMEOUT etc. statements.

The label must be a valid string; there are no restrictions on lengths or valid characters otherwise.

Every time a script attempts to jump to a non-existing label, an error-message will be printed on the screen in reverse video (but see GOTO_OPT).
See also ONERROR, which allows you to trap any kind of error.
Labels are local identifiers - they may be duplicated in various scripts.

Do NOT make the mistake of using a colon after the name, like in:


   LABEL Loop:
        ...
   GOTO Loop

since in this example the label is named "Loop:", not "Loop"!


13.9.39: LOCAL (Declare a variable to be LOCAL)


LOCAL var [= expr] [...]

Makes all mentioned vars LOCAL for the current invocation of a script.
The names can be separated by either spaces (old syntax) or commas (new).

This is required to force a variable to have local scope, see variables explained for an explanation of how variables are created and referenced.
Optionally, you can assign a value when you declare the variable.

See also GSET for global variables.
See also CSET to create local variables dynamically.
Procedures can be called recursively.

Example: LOCAL a, b = 10, c = $b * 2;

This will declare variables a, b and c to be local.
Note that you can assign values to variables, and that the assignments are evaluated left-to-right, so c will receive the value "20".

The difference between a normal variable set by = and a variable declared LOCAL is important for sessions that have complex THREADs or scripts running or scripts that use recursion.

Also notice that it is common to have multiple ONCONNECT scripts, that handle various details for the session (like logging in and starting commands once logged in). All these scripts run in parallel on the same session. A plain session variable like "x" is visible in ALL these parallel scripts, so it is easy to introduce bugs that way. A neat script is a script that keeps everything private to prevent such bugs.
The new PACKAGE keyword is another way to separate functionality.

Multiple simultaneous instances of such a script (either caused by THREADs or recursion) will have their own separate variable.
Example:


Script Fact (x)
   LOCAL Min1;

   IF $x == 1 THEN RETURN 1
   Min1 = Call Fact($x - 1)
   RETURN $x * $Min1
END

Shows a recursive function with a local variable "Res". Note that IVT does not allow you to write:


Script Fact x
   RETURN ($x == 1) ? 1 : ($x * Fact($x - 1))

Since a call to the script Fact must be preceded by the CALL keyword, and that can only be a simple statement like (Min1 = Call Fact($x - 1)).
This is a limitation of the script language of IVT.


13.9.40: LPSET (Set a local/session PUBLIC variable)


LPSET $name = expr

When you create dynamic variables using indirect assigns, this will create session variables (visible for all scripts that are active for the current session).
When such a script is part of a PACKAGE, these dynamic variables are not visible outside that package because you cannot write a PUBLIC statement for variables that are created dynamically.
That is what LPSET is for: When a variable is created like so:


   name = "Var_Name_$i"
   LPSET $name = Call SomeFunction()

This will create a PUBLIC variable in the current package with a dynamic name.

See also GPSET.


13.9.41: LSET (Set a local/session variable)

New syntax:


name = expr [;]

And expr can be any complex combination of numbers, strings, operators and built-in functions.

Old syntax:


LSET name expr

And expr must be a single number or string.

Sets a non-global variable name to the value of expr.
Variables set this way are local to the session (and thus, visible to all scripts and threads that run for the current session).

Variables can also be global (set by GSET), in which case they are visible by all scripts in all sessions.

Variables can also be local (either declared LOCAL or created using CSET), in which case they are only visible in the current script.

LSET can also be used to set a parameter or a LOCAL variable.
The equal sign can be used (optionally) for better readability.
Also, the actual LSET keyword can be omitted when the new '=' operator is used.
The following statements are equivalent:


   x = ($x + $y) * 2
   LSET x = ($x + $y) * 2
   LSET x ($x + $y) * 2

The first form is preferred.
See variables explained for a discussion of the various variable types.


13.9.42: MENU (configure menus on the menu bar)


MENU SELECT      entry
MENU RESET
MENU TITLE       "Text string"
MENU CALL        "Text string" Scriptname [arguments]...
MENU IVTFUNCTION "Text string" "function description"
MENU STRING      "Text string" "string data"
MENU HELP        "topic"
MENU LINE
MENU ENABLE
MENU DISABLE
MENU KEEPENABLED
MENU NOKEEPENABLED

These statements can be used to configure up to 10 entries in the session menu bar.  The normal session menu bar has items like "Session", "Edit", etc. The custom menu entries will appear to the right of the "Session" entry.
IVT itself uses entry 0 for the "Scripts" entry.
When a text string has a TAB character in it (\t), the part to the right of the tab is considered the "Shortcut text", it will appear right-aligned in the menu. Shortcuts are (of course) optional. IVT will assign them automatically if you omit them.

NOTE: Where it says "Text string" above, any valid expression can be used that produces a string. Similarly, the script name and arguments can all be complex expressions, as long as they produce valid results. This allows you to use the NLS() function to produce strings in the proper IVT_LANGUAGE.

Make sure the titles are not so long it causes trouble on narrow windows.
See also MENUTAB, which does the same thing for the TAB context menu.

SELECT Selects a menu bar entry. Default is 0. Maximum is 9.
RESET Clears and disables any previous menu.
TITLE Sets the name of the menu entry on the menu bar.
CALL Appends an item that will call a script, return new text.
IVTFUNCTION Calls one of the internal IVTFUNCTION codes.
HELP Sets a help topic for the last-added entry.
STRING Appends an item that will send a string of data.
LINE Appends a horizontal line in the menu.
ENABLE Causes the menu to appear on the session bar.
DISABLE Causes the menu to disappear from the menu bar.
KEEPENABLED Menu will remain usable during create-session dialog.
NOKEEPENABLED Menu will not remain usable during create-session dialog.

Older versions of IVT only had ONE customizable entry. New in version 23.1 is to have up to 10. All MENU actions are performed on the selected menu, which is zero by default (so older versions of scripts still work like before).
So this can create multiple drop-down menus on the IVT MENUBAR.
For example, select the second entry by using:

   MENU SELECT 1

Valid values are 0 - 9 inclusive, anything else will produce an error.
Entry number 0 is the "Scripts" entry used by the default IVT configuration.
Now all other commands (TITLE, RESET, etc.) operate on that selected menu.
This is global for all of IVT, so make sure there are no competing scripts that all try to change the appearance of the menu bar simultaneously.
There is no constraint on the order, you can enable entries 0 and 4 and leave 1, 2 and 3 unused. One entry can have KEEPENABLED and another can be NOKEEPENABLED, etc.

The "Text string" is the literal text that appears in the menu.
When a character in the string is preceded by an &, that character is highlighted and becomes the shortcut character. If you want an & character in the text, double it. There can be only ONE '&' character per menu item.
It is your responsibility to prevent duplicate keyboard shortcuts.
NOTE: If you do not assign a shortcut character, IVT will assign a unique one automatically, taking any of your explicitly assigned shortcuts into account.
Thus, you only have to assign shortcuts if you insist on a specific one and the default chosen by IVT is not to your liking.

TAB characters are expanded, you should avoid other special characters.

When you use a CALL, the specified function is called with the specified parameters when the user chooses the menu item. The function can return an optional string. When it does, and the string is not empty, it becomes the new text for that specific menu item. That way you can implement ON/OFF type of menu items that show the current setting.

When you use IVTFUNCTION, the specified internal function is called.
The "function description" is a string that is evaluated twice (once during definition and once more when the item is clicked). The evaluation must yield a valid IVTFUNCTION or it will produce an error message.

When you use the "HELP" command, the string must specify a searchable topic in the IVT manual. When the user uses F1 or right-clicks the item, that topic in the manual will be displayed. Usually, you want to use a keyword here (since every keyword in IVT has its own manual page) but any searchable string will do.

Normally, the custom menu is disabled while a create-session dialog is in progress (since most entries in your custom menu will require a session).
When KEEPENABLED is specified, the entry will remain active.

The default distribution of IVT configures a "Script" menu using this feature.
It does it like this:


   MENU SELECT 0
   MENU RESET
   MENU TITLE NLS("MN1_SCRIPTS","Scripts")
   MENU CALL  "Key-broadcast on/off" DoBroadcast
   MENU HELP  "Ex-Broadc"
   MENU CALL  "Load project files"   ProjectsAdd
   MENU HELP  "PROJECTS"
   MENU CALL  "Manage address book"  ManageAddressbook
   MENU HELP  "HOSTLIST"
   MENU CALL  "Add your own here, click for info" ShowMenuHelp
   MENU HELP  "SCRIPTSMENU"     # Click and right-click do same...
   MENU ENABLE
   MENU KEEPENABLED

Script ShowMenuHelp
   HIDE
   HELP "SCRIPTSMENU"
END

Careful study of this will tell you how to use this powerful feature.
See menu bar for more details.
See also MENUTAB and IVTFUNCTION.


13.9.43: MENUTAB (configure context menus on the tabs)


MENUTAB TP RESET
MENUTAB TP CALL        "Text string" Scriptname [arguments]...
MENUTAB TP IVTFUNCTION "Text string" "function description"
MENUTAB TP STRING      "Text string" "string data"
MENUTAB TP LINE

TP is either GLOBAL or SESSION.

These statements can be used to configure extra entries in the context menu that appears when you right-click a session tab on the tabs bar.
There are two lists:

NOTE: Where it says "Text string" above, any valid expression can be used that produces a string. Similarly, the scriptname and arguments can all be complex expressions, as long as they produce valid results. This allows you to use the NLS() function to produce strings in the proper IVT_LANGUAGE.

IVT will first display the standard items in the menu. These can be disabled using IVT_DIALOGSTATE.
Then the GLOBAL list is added, and finally the SESSION list.
Each menu item can specify one of the following commands:

RESET Clears and disables any previous menu.
CALL Appends an item that will call a script, return new text.
IVTFUNCTION Calls one of the internal IVTFUNCTION codes.
STRING Appends an item that will send a string of data to the host.
LINE Appends a horizontal line in the menu.

For details on the functionality, see MENU, which allows very similar things with the global menu bar of IVT.

Example:


   MENUTAB GLOBAL  RESET
   MENUTAB SESSION RESET
   MENUTAB GLOBAL  LINE
   MENUTAB GLOBAL  IVTFUNCTION "Change session colors" "Setup: Colors (only)"
   MENUTAB SESSION STRING "Send DATE command" "date\r"
   IVT_DIALOGSTATE TAB_MENU_EDIT  SKIP
   IVT_DIALOGSTATE TAB_MENU_NEW   SKIP
   IVT_DIALOGSTATE TAB_MENU_REORG SKIP
   IVT_DIALOGSTATE TAB_MENU_CLONE SKIP
   IVT_DIALOGSTATE TAB_MENU_KILL  SKIP
   IVT_DIALOGSTATE TAB_MENU_ABT   SKIP

This starts by clearing any previous lists (both GLOBAL and SESSION).
The GLOBAL menu gets a separator line followed by an item that, when clicked, will start the setup color-configuration dialog, allowing you to change the colors of the current session.
Then the current session gets a menu item that, when clicked, will send the string "date\r" on the current session.

The IVT_DIALOGSTATE statements disable all standard menu items on the tab menu (makes them disappear).
The names of these items can also be found in the language files, and are listed here as an easier way of finding the exact names.
Since all these functions are available through IVTFUNCTION, you can replace the standard ones with your own (enhanced) ones.

You can also CALL a script. Mind, the script should return either nothing at all OR a string that will REPLACE the specified text in the menu.
This simple trick will allow you to implement on/off type things in a menu.

For more details, see MENU.
See also IVTFUNCTION.
See also CALL.


13.9.44: NEXT (End of a FOR/FORALL/FOREVER/WHILE)


NEXT

The NEXT statement ends a loop started by FOR, FORALL, WHILE or FOREVER, and starts the next iteration of that loop.
There MUST be a matching NEXT for every loop (or you get a syntax error).

See the examples.


This is an important feature, others are prev/next


13.9.45: ONKEY (Jump to label when key is pressed)


ONKEY label [UNIQUE]
ONKEY off
ONKEY PASSKEY

When a key is pressed, jump to label. Identification of the actual key is in variables $ONKEYS1, $ONKEYS2, $ONKEYN1 and $ONKEYN2.
Label must be off to cancel any outstanding ONKEY directive.

This major feature of scripts gives you a way to take over the keyboard for a particular session. Once an ONKEY label directive is given, every time you press a key, IVT will give control to the code following label (for as long as the script does not return or issues an ONKEY off).
When KEYBOARD OFF is used, keystrokes are NOT passed to ONKEY routines! The password learning system uses this feature to snoop the user name and the password as the users types them.

The key that was pressed can be identified using the $ONKEYS1 and $ONKEYS2 variables, which contain the string-representations of the characters that were typed. For a plain data-key (say the letter 'a'), S1 will contain an 'a' and S2 will be empty.

For special keys, the $ONKEYN1 and $ONKEYN2 variables contain the scan-codes of the key. For a function key, ONKEYN1 will be zero and ONKEYN2 will identify the function key. You can use this setup screen to turn on keyboard debugging, which will display the scan-codes for the keys you press.
Note, this does not tell you the data that the keys would send to the host.
For that, have a look at ONSEND.

When you use IME (International Method Editor) to type complex languages like Arabic or Chinese, the $ONKEYS1 will contain the UTF-8 representation of the complex data key.

When IVT passes control to the script, it executes until a blocking statement is executed (such as WAIT or PAUSE), or an endless loop is encountered.

When an ONKEY PASSKEY is NOT executed, the keystroke is ignored by the main body of IVT, which implies that the key is not processed.
Thus, this can be used to filter keystrokes - PASSKEY says that the key should be passed to IVT, which will interpret them (send to host, enter setup mode in the case of an F3, etc). Not doing a PASSKEY allows processing of the keystroke by the script only.

The numeric ONKEY variables are handy for function keys, the string variables are handy to process plain data. See also special variables for a list of other IVT built-in variables. See also TOASCII and FROMASCII.

Also note that by using THREADs, there can be more than one script that 'wakes up' due to a single keystroke. They will all get a chance to process the key and execute an ONKEY PASSKEY.
When the UNIQUE qualifier is used, only the thread that has used this will receive the keystrokes. If multiple threads are (foolishly) using this, only the first one found by IVT will receive the key.
The UNIQUE is important when the script knows for sure that the keys are meant for a specific purpose and nothing else could want them.

Also note that this statement may result in pre-empting a WAIT statement.
Control is passed to the label specified in the ONKEY statement and the WAIT is discarded and not restarted automatically in any way.
This can be used to interrupt a WAIT that takes too long, but see also TIMEOUT, which is another way to interrupt a WAIT.

See the KbdLine example for a script that makes use of ONKEY.
See also KEYBOARDMOD and BIND for other ways of programming the keyboard.
See also "Learn mode" and KEYMACRO.
See also ONSEND and PROMPT.
See also KEYBOARD and QUERYSETTING.


13.9.46: ONSEND (jump to label when data is about to be sent)


ONSEND label
ONSEND PASS_SEND
ONSEND OFF
$ONSEND_DATA

This statement is very much like ONKEY.
The ONKEY statement allows you to monitor what keys are pressed by the user, and can determine whether that key is going to be processed normally or not.

During development of a script to copy all keystrokes to all sessions (so you can type commands which are simultaneously executed on any number of hosts) an important shortcoming of ONKEY came to light - it does not know what data is generated by a key. For simple keys, that is not a problem, but ALT-keys, cursor keys, function keys, redefined keys, keyboard macro's and so on all together make it hard to predict what data actually is going to be sent to the host when a certain key is pressed.

The ONSEND statement causes control to jump to the specified label every time IVT wants to send keyboard-generated data to the host. Before it does so, the actual data string is stored in $ONSEND_DATA. The script must decide whether the data is going to be transmitted or not. If the scripts terminates or blocks before it does an ONSEND PASS_SEND, IVT will throw the data away.
If it executes a PASS_SEND, the data is transmitted normally.

See also ONKEY.
Example:


   ONSEND snddata
   FOREVER
      PAUSE
LABEL snddata
      # Do something with $ONSEND_DATA
      ONSEND PASS_SEND
   NEXT

The statements after the snddata label are executed every time IVT wants to send something, the data to send is $ONSEND_DATA.

Check out the BROADC.IVT script in the IVT distribution kit, this broadcasts keystrokes to all sessions upon request (easy to start and stop).


13.9.47: PAUSE (Block, wait for interrupt)


PAUSE

This statement is an elegant way of making an IVT script block (to do nothing efficiently). Execution of the script is suspended.
A PAUSE can be broken by various events:

See the KbdLine example for a script that makes use of PAUSE. See also YIELD.


13.9.48: POPUP (Display popup, get result)


POPUP string [varname1 varname2 [timeout]]

Put "string" in a popup. The user has to acknowledge the popup before the script can continue. When the session executing the POPUP is in the background, IVT will sound the (background) BELL and wait for the user to switch to that session. Only then will the popup appear. Notice that the background of the status indicator will be red because of the bell.

NOTE: varname1 and 2 are NAMES of variables, not CONTENTS of variables, so they must NOT be preceded by a '$'! The named variables are created (or reset) by POPUP!

When varname1 and varname2 have been specified, they are used to store the scan codes of the key that is pressed by the user to acknowledge the popup (they have the same values as $ONKEYN1 and $ONKEYN2).
When the user clicks OK, $varname1 will be set to 13 (\r) and $varname2 to 0.
When the user cancels the popup, $varname1 will be set to 27 (ESC) and $varname2 to 0.

When the optional timeout is specified, the popup will remain on-screen for no more than the specified number of milliseconds. When the timer expires before a key is pressed, both $varname1 and $varname2 will be set to "-1".

The popup dialog will not normally show a CANCEL button, unless the variable named by varname1 already exists and contains the word "CANCEL" when you use the POPUP statement (this interface leaves something to be desired :-).

Of course, IVT will continue to process all other sessions, scripts and threads while waiting for the user to acknowledge the popup.

See also WINDOW, which allows much finer control over (text) popup windows.
See also DIALOG, which allows full-fledged GUI dialogs created by an IVT script.

Example:


   FOREVER
        one = "CANCEL";
        POPUP "Enter a digit" "one" "two" 10000
        # After popup, $one and $two contain result!
        IF $one == 27 THEN BREAK   # Cancel, or ESC
        IF $one == 0 && $two == 0 HadTimeout
        x = TOASCII($one)
        IF $x < "0" || $x > "9" THEN CONTINUE
        BREAK
   NEXT

This gives a popup (with a CANCEL button) that waits for the user to type a digit. When a wrong key is typed, the question is asked again.
When nothing is typed for 10 seconds (10000 milliseconds) IVT branches to the HadTimeout label.


13.9.49: RETURN (Return from a CALL statement)


RETURN [expr]

Ends invocation of a script, returns an optional value of expr.

When the script was started from a CALL, execution will continue after that CALL (recursion is allowed). The return value of the script will be the optional string value (or the empty string if no value is supplied).
A script can also end by simply reaching the END line. In this case, no value is returned.

When the script was started because of a BIND, CREATE, F4-X and so on, any returned value is simply discarded.
The expr can actually be a complex expression, like:


   RETURN ($x + 1) * 2

NOTE: There MUST be a at least a space after the RETURN! See also THREAD, FORK, CALL and WAITTHREAD.


13.9.50: PUSHBACK (Push back data for a WAIT)


PUSHBACK string

When you push back data, that data will be seen by the next WAIT statement as if that data was just received from the host. This can be used to "undo" a wait that realises it is looking at unexpected data.
The data is NOT seen by anything else but the script WAIT statements.
See VTECHO for a way to create data that seems to come from the host and is "seen" by the rest of IVT.

There is no limit to the amount of data that can be pushed back, nor is there a rule that pushed back data should matched really received data (so you can use this to generate fake data to wake up a WAIT).
It is also not an error to PUSHBACK an empty string (is ignored silently).


13.9.51: SCRIPTDEBUG (Print script debugging into a file)


SCRIPTDEBUG file
SCRIPTDEBUG off

When writing scripts in the IVT script language, this statement can aid in debugging such scripts.
When a file is specified, every executed statement is traced into that file with many details (time, parameters, etc).
When off is specified, tracing is turned off, the file is closed.
When the file does not exist, it is created (the complete pathname is created automatically, missing directories are created).
When the file exists, it is appended to, not overwritten.

All scripts for the session are debugged into one file! So once debugging is turned on, it is on for ALL currently running scripts and future scripts for the current session. Different sessions can have different (or no) debugging.

Scripts read from encrypted files cannot be debugged, this is a security feature. During debugging you will have to use the plain-text version.

There are no debug levels: all relevant details are logged, always.
The QuerySetting function can be used to query the current state of debugging.


13.9.52: SCOPE (Explicit scoping of variables)


SCOPE range type name [, ...] ;

This explicitly declares an object to be of a specific type and scope.
Normally, you do not need to declare variables in the IVT scripting language before use. Using GSET creates global variables, plain assignments create session variables, and using LOCAL or CSET creates local variables.
See "variables explained" for more details.

This was sufficient until the introduction of hashes and arrays.
You cannot use GSET to assign values to an array, you need PUSH for that.
So SCOPE is introduced to explicitly declare a certain type and scope of an object. Once it is defined, you can use the normal means to assign values to the declared object. The rules are:

Range is one of:

This defines the scope. If you do this in a script that is part of a PACKAGE, it will create objects that are PACKAGE_GLOBAL or PACKAGE_SESSION.

The TYPE is one of:

The HASH will create an empty object (a hash with zero entries). The ARRAY will create an empty array (zero members in the list).
The VARIABLE will create an empty, plain variable.

The TYPEOF operator will return the proper type for objects that have been declared using SCOPE but not otherwise assigned to.

The names is a list if one or more names that are declared to be of the given type and scope.
Example:


SCOPE GLOBAL ARRAY GlobArray1, GlobArray2;

Declares the two objects to be arrays. You could assign values to such an array using:


PUSH(0,GlobArray1,"One","Two","Four");

Using SCOPE LOCAL VARIABLE is logically the same as using a plain LOCAL and is included for completeness sake.

It is valid to combine PUBLIC SESSION and PUBLIC GLOBAL with SCOPE SESSION and SCOPE GLOBAL to declare shared objects.

NOTE: SCOPE is a statement that needs to be executed as part of a script.
If your package wants to declare a number of objects to be of global scope, the best way to arrange that is to have a STARTUP script at the start of your package, see the projects example.

See also LOCAL, GSET and variables.
See also arrays and hashes.
See also PACKAGE and PUBLIC.


13.9.53: SECRET (Run script without status indicator)


SECRET

When a script is active for a particular session, IVT will normally show a red S icon in the status line to show this (so the user knows that a script is active which might interfere with normal operation of keyboard or screen).

When all active scripts have the SECRET attribute, the status line will NOT show this indicator.
When a SECRET script calls a non-secret script, the instance of the called script will inherit the secrecy.

See also crypting files and the CRYPTFL function.
See also HIDE, DETACH, CANCEL and SHAREMODE, which are all attributes of scripts.


13.9.54: SEND (Send data on a session)


SEND string

Sends the string on the session. This is an important statement, often used in chat-scripts to allow all sorts of interaction with a host.
The string can be a complex string expression.

The WAIT statement allows you to monitor incoming data from the host and act accordingly.
Like all strings, you can make use of \ characters to send special characters.
For example, if you want to send a ^C character (an ASCII character with the hexadecimal value 3), you could use SEND "\03".

Here is another example:


   Script LogIn
      HIDDEN
      WAIT CASE_INSENSITIVE "login:"
      Send "johnb\r"
      WAIT CASE_INSENSITIVE "password:"
      SEND "Secret\r"
   END

You cannot send NULL characters with SEND, since IVT uses C-style strings internally (which are terminated by a NULL character).
Use SENDNULL for this purpose.

See also SEND_KEYB.


13.9.55: SEND_KEYB (Send simulated keyboard data)


SEND_KEYB string

This does exactly what SEND does, only IVT treats the data to be sent to the host as if it was generated by the keyboard.
The upshot is that if you have one thread using SEND_KEYB, and another thread uses ONKEY, that the ONKEY thread will be woken up by the SEND_KEYB data, which implies that the ONKEY can stop the data from actually being transmitted.
A normal SEND does NOT wake up an ONKEY in another thread.

For example, the ESCESC.IVT script when combined with the BROADC.IVT needs this to function properly.

See also SEND and ONKEY.


13.9.56: SENDNULL (Send 1 or more NULL characters)


SENDNULL number

The SEND statement can be used to send any sort of data to the host, except for NULL characters. A NULL will terminate any sort of string used by IVT, so it can never be part of any string (constant or variable).
Since IVT should be able to send any sort of data to the host, the SENDNULL statement is required to fill the gap.
It takes one argument, which should evaluate into a number between 1 and 1024.
IVT will send that number of NULL bytes on the session.
The number can also be a complex numerical expression.

See also SEND and WAIT ANYCHAR.


13.9.57: SETDTR (Toggle serial DTR line (forces hang-up))


SETDTR on|off

Serial sessions only.

Raises (ON) or lowers (OFF) the serial line DTR (Data terminal Ready) signal.
For non-serial sessions, this statement is ignored.
When a modem is connected to the session, lowering the DTR signal will normally result in an immediate disconnect (hang-up) by the modem. Thus, this is a HARDWARE method of disconnecting, which is to be preferred over software since it is more reliable.
However, proper operation depends on the configuration of the modem (which can be made to ignore the DTR setting) and the cable between modem and PC (if you have an external modem).

Be sure to allow some time to pass between a SETDTR OFF and SETDTR ON. If the interval between these events is too short, most modems will ignore it.
For example:


        SETDTR OFF
        USLEEP 250
        SETDTR ON

This is a sequence that will lower DTR for a quarter of a second, which should work reliably.

See also WAITCARRIER.


13.9.58: SETPOS (Position cursor)


SETPOS row column

Position the cursor to the specified row and column.
The top-left corner of the screen is on row 1, column 1.
When the specified position is outside the current screen size, IVT will position the cursor a close as possible.
The current cursor position can be obtained using CURSOR_COL() and CURSOR_ROW().
The dimensions of the screen are given by $ROWS and $COLS.
Example:


   SETPOS ($ROWS / 2) ($COLS / 2);

Positions the cursor in the middle of the screen.

See also VTECHO, ECHO and CLS.
See also WINDOW_SIZE.


13.9.59: SHAREMODE (Allow multiple script invocations yes/no)


SHAREMODE ALL
SHAREMODE SESSION
SHAREMODE NONE

The default for this is SHAREMODE ALL.
This statement is not really a statement, but like DESCR and HIDE attaches a specific attribute to the script it is found in.

A script with attribute SHAREMODE NONE can only have ONE instance at any time within IVT (remember that scripts normally run in the context of a session and IVT can run multiple sessions). When you attempt to start a second instance of this script (using CALL or THREAD or IVTFUNCTION or BIND etc), any such attempt will fail when the previous instance of the script is still active.

When you use SHAREMODE SESSION, other instances of the script can exist at the same time, but only when they are part of ANOTHER session (so this limits the script to one instance per session).

The default (SHAREMODE ALL) imposes no restrictions.

This statement is useful when you use KEYMACRO with an ASYNCFUNCTION option.
Every time you press the key, IVT creates a new instance of the script, which CAN cause multiple simultaneously running copies of the script if you are not careful. A SHAREMODE SESSION will, in such cases, quietly refuse to start new copies as long as one is still running.

SHAREMODE NONE is useful for scripts manipulating files or doing user interaction. Only one running instance of the script per IVT instance is allowed. Note that this does not protect against multiple running copies of IVT, each running the script.

No error message is given, but a debugging diagnostic is printed when IVT refuses to start a script due to a SHAREMODE violation.

Note that the same functionality can be programmed explicitly into a script (by using session-local (LSET) variables for a SHAREMODE SESSION and global (GSET) variables for SHAREMODE NONE to administrate the fact that a script is running and test for that when the script is started.
However, it can be tricky to administrate termination of a script reliably (because a script can be killed, aborted by the user, the session it is part of can be destroyed, etc). The SHAREMODE statement does not have such problems.


13.9.60: SLEEP (Suspend current script N seconds)


SLEEP seconds

Suspends current thread for seconds seconds.
Incoming data from the host will still be processed, and other threads for that session are not blocked.
The seconds parameter can be a complex, numerical expression.

Other sessions and scripts continue to execute at full speed, of course.
See also TIMEOUT, which allows finer control (milliseconds).
See also USLEEP, which allows millisecond sleeps.


13.9.61: STATUSHOST (Show string in status line)


STATUSHOST string

Shows string as host in the status line. Use this when you have complex scripts that log you in from one host to another (using Unix telnet or SSH, for example) which results in the host that IVT is connected to no longer being the one the user is actually talking to.
The string parameter can be a complex string expression.

The string will be displayed in the status line.

NOTE: The string can contain formatting and color commands as described in the ECHO command. For example:


   STATUSHOST Concat(ColorAttribute("BRIGHTWHITE BRIGHTRED"), \
               "Red ",                                  \
               ColorAttribute("BRIGHTWHITE BRIGHTBLUE"),        \
               "Blue");

This will render the words in various colors.

See also F4-S, where this data can be edited manually.
Clicking on the text is another way to modify it.
See also STATUSTXT and STATUSTXTFIX to manipulate other parts of the status line.
See also $IVT_STATUSHOST, a variable that contains the current value of the field.


13.9.62: STATUSTXT (Show temporary comment in status line)


STATUSTXT string
STATUSTXT ""

Temporarily shows string in the comment part of the status line.
An empty string cancels this, which will result in the original comment being restored. This command is intended to be used to display progress during a script that takes a while to complete. This dialer is an example of such a script. See also the $STATUSTXT variable.

IVT maintains two comments for each session:

NOTE: The string can contain formatting and color commands as described in the ECHO command. For example:


   STATUSTXT  Concat(ColorAttribute("BRIGHTWHITE BRIGHTRED"), \
              "Red ",                                   \
              ColorAttribute("BRIGHTWHITE BRIGHTBLUE"), \
              "Blue");

This will render the words in various colors.
See also F4-S, where this comment can be <Edit>ed manually.

When COMMENTIGNORE is used, a number of these commands to set the status text will be ignored (this is to make sure the proper text ends up in the status).
In some circumstances, it may be required to issue a COMMENTIGNORE 0 before using the STATUSTXT command to force it to be accepted.


13.9.63: STATUSTXTFIX (Show fixed comment in status line)


STATUSTXTFIX string

Shows string in the comment part of the status line.
See also STATUSTXT, which alters the comment part of the status line temporarily (and a discussion on permanent vs. temporary comments).
Example:


   STATUSTXTFIX "This will show in status comment"

See also F4-S, where this comment can be <Edit>ed manually.
See also the $STATUSTXT variable.

When COMMENTIGNORE is used, a number of these commands to set the status text will be ignored (this is to make sure the proper text ends up in the status).
In some circumstances, it may be required to issue a COMMENTIGNORE 0 before using the STATUSTXT command to force it to be accepted.

NOTE: The string can contain formatting and color commands as described in the ECHO command. For example:


   STATUSTXTFIX Concat(ColorAttribute("BRIGHTWHITE BRIGHTRED"), \
               "Red ",                                          \
               ColorAttribute("BRIGHTWHITE BRIGHTBLUE"),        \
               "Blue");

This will render the words in various colors.


13.9.64: SWITCHTO (Make a session the foreground one)


SWITCHTO number
SWITCHTO "ME"

IVT will switch the session with the specified number into the foreground.
Specify the literal "ME" to have the session that uses this statement force itself into the foreground.

The number of a specific session can be communicated between sessions by means of GLOBAL variables (see GSET) and the MYSESSNR function.
The number that identifies a session is normally the same you would see in the status line. However, when you have more than 10 sessions, or sessions in several groups, the internal number used by IVT is different from the perception the user has.

You can use this when you have a complex series of scripts that manage a single logical task by means of several sessions.

If the session number is invalid, the statement is ignored.
See also FORK, CREATEGROUP, IGNCHILDREN and so on.


13.9.65: TIMEOUT (Jump to label after N milliseconds)


TIMEOUT ms label
TIMEOUT 0

After ms milliseconds, jump to label.
The ms expression must be a simple, non-complex expression.

This can be used to set a timeout on a WAIT statement, infinite loop and so on. Use a TIMEOUT 0 to cancel any outstanding timer.
Several timers can be active for a single session by using THREADs, but normally speaking there is only one per session (a new timeout statement will cancel any running timeout and set a new one).

If a SCRIPT has set a TIMEOUT before CALLing another script, and the timer fires before the called script has RETURNed, all called functions are terminated prematurely and control is passed to the specified label regardless (like a SIGNAL and a LONGJMP would do in C).

When a SCRIPT terminates (RETURNs) before a timer it has set expires, the timer is cancelled. You can use QuerySetting("TIMEOUT") to find out how much time is left before the timeout expires.

See the WaitPrompt script for an example use of timeouts.

See also SLEEP and USLEEP, which can block a script without doing something else in the meantime.

See also PAUSE.


13.9.66: TRAP (Catch signals from KILL)


TRAP sig label
TRAP sig off

Branch to label when signal sig is received (or turn catching off for signal sig when label is off).
The signal number must evaluate to a number between 1 and 10 inclusive.
The signal can be sent from another session or another thread using the kill function.

Unix shell programmers will recognize these constructions. Within IVT this can be used to synchronise sessions. or to synchronise threads running on behalf of a single session. The key broadcast script shows examples of using TRAP and KILL.


13.9.67: UNSET (Delete variables)


UNSET Variable ...

This deletes the named Variables.
It will free the memory used by those variables and make them undefined.
When you UNSET a LOCAL variable, it will lose its LOCAL status.
Please do not UNSET internal IVT variables (you might crash IVT that way, these variables are not protected from such abuse).
When the variable is an array or hash, all members will be deleted, too.
You can unset variables indirectly, like so:


   somename = "Special"
   UNSET $somename x

This will delete the variables Special and x.

You can UNSET an ENV_ (environment) variable by using the PUTENV function with an empty string value; PUTENV("X=") will unset the environment variable X.

NOTE: UNSET always interprets plain names (unprotected by quotes) as names, irrespective of the current setting of IdentifierAs.


13.9.68: USLEEP (Wait for a specified number of milliseconds)


USLEEP MilliSecs

This statement blocks the current thread of execution for the specified number of milliseconds. Other threads continue to execute normally.
How many milliseconds actually elapse before the next statement is executed depends on the speed of your machine and the number of other tasks that IVT is working on.
The MilliSecs expression can be a complex, numerical expression.

NOTE: This is a STATEMENT, not a FUNCTION call. That implies that the number (expression) has to be separated with at least one space from the keyword.

See also SLEEP, TIMEOUT, TRAP, KILL and PAUSE.


13.9.69: VOLATILE (Mark IVT.RC changes as temporary)


VOLATILE [RESETTABLE] <.rc statement>

NOTE: Read carefully!
This statement is used in rare cases. Consider a script that connects the user to some application that requires lots of SSH activity, authenticated using the Pageant authentication agent. Normally, the SSH_SHOW_AGENT will issue a warning for every time the agent is used, but in this case so many of them are issued that the users consider them a hindrance, since they also mess up the screens built by the application. So the script, knowing this, issues a:


NO_SSH_SHOW_AGENT

to turn the warning off. This is a setting local to the current session, so the warnings are only turned off for this particular session, and all seems well. But now the user enters setup, changes some entirely different attribute (for example, the screen colors) and then uses "Save as" to save these new color settings as the startup defaults. IVT compares all the current settings of the session to the current defaults, and saves all the modified values.

Now, unexpectedly and unintentionally, the SSH_SHOW_AGENT gets turned off permanently because the save-to-registry function cannot distinguish between a value modified by the user and a value modified by a script! In this particular example, this has serious security implications.

Similar things can happen for other settings typically manipulated by a script, see the proxy script for a script that could leave a proxy intended for a single session permanently enabled the same way.

The VOLATILE statement is invented for these rare cases. When it is used to qualify an IVT.RC statement, it tells IVT that this particular change must NOT be saved into the registry.

The RESETTABLE means that a reset of the session (either by the user using F3-R of the host sending a reset command) will not survive the reset. The default is that a setting that is applied by a script using VOLATILE will survive such a reset.

The rules are as follows:

For example, if a script does a VOLATILE RESETTABLE NO_SSH_SHOW)AGENT and the user enters setup and opens the SSH panel, he will see the "Hijack protection" checkbox UNCHECKED (because that is the (volatile) setting for the current session).
Also, the description of the item will be in COLOR_VOLATILE colors to indicate the special status of the field.

If the setting is not touched, and the setup is saved, the SSH_SHOW_AGENT setting is NOT saved (the VOLATILE applies).
If the session is reset, the default setting is restored and the volatile setting is removed - all is back to default.

If the setting is toggled ON, the VOLATILE indicator is removed for that particular setting (the color changes). If the user saves setup now, the indicator is STILL not saved, since the current value (ON) is equal to the startup value, thus not considered changed, and not saved.
If the user would have toggled the setting on and back off immediately, THEN saving setup WOULD save the new (OFF) value, since there is no VOLATILE in effect anymore and the current value is different from the default.

So, use with care, since a user can be confused by this...
The visual (color) indication helps, but is no guarantee.

See also GLOBAL and COLOR_VOLATILE.


13.9.70: VTECHO (Send strings through VT220 engine)


VTECHO string

Treats string as if sent from the host. All ESCape sequences are interpreted and acted upon. This differs from ECHO, which can only display data.
When an inquiry command is passed to VTECHO, IVT will respond to the host.

Use this when you want to use colors and complicated screen formatting commands. There is no limit to the length of the string you want processed.
See also ESC<space>R, which allows running local commands, which can be initiated from a script this way.
The string expression can be a complex expression.

VTECHO data is processed BEFORE any "normal" session data. This means that if you use WAIT statements followed by a VTECHO when something is found that you were WAITing for, IVT will process the VTECHO data immediately. Pending data for the session is, of course, processed afterwards.

Also, VTECHO data is processed asynchronously from the execution of your script. This means that if, for example, you use VTECHO to position the cursor, then use ECHO to display data at that position, it may well be that the data is displayed in the wrong position because the VTECHO is not actually processed yet. To force this, use WAITIDLE, which blocks execution of your script until all buffered data is processed.

See also CLS, SETPOS and SPRINTF.


This is an important feature, others are prev/next


13.9.71: WAIT (Wait for several things simultaneously)


WAIT string[,label]...
WAIT IN string[,label]...
WAIT IN_UNIQUE string[,label]...
WAIT ANYCHAR[,label]
WAIT VARIABLE_ASSIGN varname[,label]
WAIT REGEXP regexp[,label]
WAIT ... CASE_INSENSITIVE ...
WAIT ... CASE_SENSITIVE ...
WAIT ... EAT_MATCH ...
WAIT ... EAT_NOMATCH ...
WAIT ... EAT_NONE ...

This is one of the more powerful statements in the IVT language. Together with the SEND statement is allows you to write chat scripts that perform a variety of automatic functions on a host. The power comes from the fact that the WAIT can wait on an unlimited number of strings simultaneously and branch to different labels depending on the first matching string actually received on the session. Example:


  WAIT CASE_INSENSITIVE         \
         "connect"              \
         CASE_SENSITIVE         \
         "BUSY",busy            \
         "VOICE",voice          \
         "NO DIALTONE",notone   \
         "NO ANSWER",noans      \
         "NO CARRIER",noans

This is taken from a real Hayes modem dialing script.
NOTE: Strings and their labels are separated by a comma and there must NOT be any spaces between them! If your string contains spaces, it must be quoted.
The rules are:

The example at the top will continue on the next line when the string "CONNECT" is received, and branch to different places when various errors are returned by the modem when attempting to establish a connection to a remote computer. This allows the script to give appropriate error messages in each case.

Note that NULL characters can be matched only by a WAIT ANYCHAR, since they cannot be part of one of the normal strings or IN arguments.
NULL characters are ignored by a normal WAIT statement, so VAX machines that sometimes send NULL characters in random places can be accommodated.
Also note that some (serial) hosts have an annoying tendency to sprinkle the conversation with NULL bytes, meant for delay (timing) purposes.

For examples, see the password learning system.


13.9.72: WAITCARRIER (Wait for serial carrier state)


WAITCARRIER ON|OFF

Waits until the carrier-detect signal of a serial line takes the state specified (on or off).
This statement is ignored for non-serial sessions.
See also SETDTR, which can manipulate the Data terminal Ready line.

This command can be used to monitor incoming modem connections. Normally, a modem will raise the CARRIER signal of the serial line when an incoming call is established. IVT will monitor this signal and show the state in the status line. It depends, however, on the configuration of the modem and the cable between modem and PC for this to work properly. See also this setup screen to change the status line indicator.


13.9.73: WAITIDLE (wait for receive/transmit buffers to empty)


WAITIDLE

Sometimes, complex scripts such as the modem dialer use a combination of commands like SETPOS and ECHO (which have an immediate effect) and commands like VTECHO (which are handled asynchronously by IVT).
This can result in strange effects where the results of ECHO statements and VTECHO statements are not processed in the expected order.
To keep VTECHO fast, I do not want to make it synchronous, so I've added this WAITIDLE statement, which briefly halts the script to give IVT the opportunity to process stuff in incoming and outgoing buffers.
The script resumes as soon as all these buffers are empty.

It is also possible to use this to wait until all received data has been processed and the session is quiescent.
See this example.

Example:


   WAIT "blah\n"
   WAITIDLE

Receiving "blah\n" will cause the WAIT to end. But the "\n" is FIRST matched by the WAIT and only processed AFTER that. The WAITIDLE will wait until the receive buffers are entirely processed.


13.9.74: WHILE/NEXT (Basic style loop)


WHILE expr
  Statements
NEXT

This is a basic WHILE loop. The Statements between WHILE and NEXT are executed as long as expr evaluates to TRUE.
The rules for the expr are the same as for the IF statement.
This example reads a file line by line:


   fd = OPEN("InputFile.txt",0)
   Cnt = 1
   WHILE (Ln = READLN($fd)) != ""
      echo "Line nr $Cnt: $Ln\n"
      Cnt = $Cnt + 1
   NEXT
   CLOSE($fd);

See also FOR, FORALL, FOREVER, NEXT, BREAK and CONTINUE.


13.9.75: WINDOW (Create and manipulate text windows)

The WINDOW statement allows you to create text-windows that float on top of the session screen. This single powerful statement allows control over the appearance (TITLE, COLOR, BOX, SIZE, TIGHT) of the window, the contents (TEXT, MORE) and relative order of the windows.
A WINDOW can be active while data is being received.
The WINDOW statement is much more versatile than POPUP.
For interactive GUI dialogs, see DIALOG.

Execution of a script continues while the window is being displayed, where a POPUP must first pop down before execution of the script continues.
The Autologin & Password Learning system uses these windows extensively.
See this example, which is an extract of the password learning system.

A few simple rules:

The following parameters are allowed:

As an example, this would display an error message in the center of the screen for a few seconds. The extra new lines make it more attractive.


      WINDOW ERR
      WINDOW ERR NOBOX
      WINDOW ERR COLOR "WHITE RED BRIGHT BRIGHT"
      WINDOW ERR TEXT "\n Try again \n\n"
      WINDOW ERR SHOW
      WINDOW ERR TIMEOUT 2500

See here for another example.
See the WINEXISTS function, too.


13.9.76: WIN_MINIMIZE/MAXIMIZE/SHOW (Min-/maximize/show window)


WIN_MINIMIZE
WIN_MAXIMIZE
WIN_SHOW

These functions manipulate the window the IVT runs in (it calls the Windows API call ShowWindow).


WIN_MINIMIZE - Minimizes the window (shows only on taskbar)
WIN_SHOW     - Calls SHOWNORMAL, restores previous size and position
WIN_MAXIMIZE - Calls SHOWMAXIMIZED, maximizes the window.

These statements can be used to make a batch-like IVT application where the user starts IVT from a shortcut, which creates sessions, executes scripts etc.
which the user does not have to see (at least not all of it).

When a MINIMIZE is used, the IVT application minimizes itself. Note that the user can always explicitly restore the window by clicking on the taskbar.
WIN_SHOW restores normality, WIN_MAXIMIZE explicitly maximizes the window.

See also -B command line option and WINDOW_SIZE.
See also the FULLSCREEN statement.
See also ToTray, to move IVT to the icon tray.
See also ONMINIMIZE.


13.9.77: YIELD (Voluntarily give up the CPU)


YIELD

This statement will make IVT stop executing the current thread and pursue other business. Normally not needed, since the scheduler of IVT is capable of scheduling all sessions, scripts, threads, timers and such and still give good response, but included for sake of completeness.

When you have an endlessly looping script that has nothing to do for a while, you can call YIELD and/or USLEEP.

See also PAUSE and WAITIDLE.


13.10.1: ABS (Absolute numerical value)


ABS(Numeric-expression)

This function simply returns the absolute value of its argument.
The expression can be any numeric-value yielding expression.

Example:


    ECHO ABS(5 - 7) "\n"

Will display "2".


13.10.2: BROWSEFILE (Use Windows file selection dialog)


variable = BrowseFile(ShouldExist,AskOverwrite,FilterName,FilterPat)

This function call makes the standard Windows functions GetOpenFileName and GetSaveFileName available to IVT scripts. It pops up the familiar file selection dialog and allows the user to select an object on the file system to be used or created, The rules are:

The function returns the selected object when successful as a Windows path (so with backslashes instead of slashes).
The empty string is returned when the user cancels the operation.

For further details, see msdn.microsoft.com and search for the OPENFILENAME structure.
See also BROWSEFOLDER and PROMPT.


13.10.3: BROWSEFOLDER (Use Windows folder selection dialog)


variable = BrowseFolder(Prompt)

This function makes the standard Windows Shell function SHBrowseForFolder available to IVT scripts. It pops up a selection window that allows the user to select a folder.
The given Prompt string is displayed at the top of the dialog, it is intended to instruct the user to select a specific folder.

The function returns the selected object when successful as a Windows path (so with backslashes instead of slashes).
The empty string is returned when the user cancels the operation.

See also BROWSEFILE and PROMPT.


13.10.4: CALL (Call a function that returns a value)


variable = CALL name[(expr[,expr...])] (new syntax)
LSET variable CALL name [params]... (old syntax)

This form of CALL invokes a script called name (possibly recursively). This script executes and eventually RETURNs. The value passed to that RETURN is assigned to the given variable.

The name of the script does not have to be a constant, you can call scripts indirectly. For example:


   Proc = "SomeScript"
   x = CALL $Proc("a",$b)

will call the script "SomeScript" with parameters string "a" and the current contents of variable $b. All parameters are passed by value.

There can be any number of actual values for parameters, which can all be complex expressions, use IVT internal functions and so on.
The declared script is supposed to have a parameter declaration for every parameter passed. When too many actual values are passed, they are ignored.
When too few are passed, the called script will receive empty strings.

A CALL without an assignment to a variable will also work, any RETURNed value is discarded.

This is, of course, a very powerful feature of IVT. There are several examples in this manual that allow you to study how scripts are written, see:


Script to log on to a host automatically
Script to dial out through modems
Script to read line from keyboard
Waiting for any sort of prompt


13.10.5: CALLEDBY (Stack backtrace function)


CALLEDBY(Level,Tp)

This function can be used to generate a stack backtrace of IVT script calls, it returns information about the current script (level 0), the script calling the current script (level 1) and so on.
For every level, the file that contains the calling script can be returned, the line number in that file, and the name of the script that contains the CALL.
When a non-existent level is passed, an empty string is returned.
When "FILE" is passed, a string with the name of the file as read by IVT is returned.
When "LINE" is passed, a number designating the source line number is returned.
When "SCRIPT" is passed, the name of the invoking script is returned.

This can be used by error-logging functions to show extra information about the context of the error. For example:


   Level = 0;
   Trace = "";
   WHILE CalledBy($Level,"LINE") != ""
      Trace = Concat($Trace, \
                     CalledBy($Level,"FILE"),   ": ", \
                     CalledBy($Level,"SCRIPT"), ": ", \
                     CalledBy($Level,"LINE"),   "\n");
      Level++;
   NEXT
   ECHO "$Trace"

This prints a stack backtrace of arbitrary depth, starting at the place where the CalledBy is coded (level 0).

See also ONERROR.


13.10.6: CLOSE (Close a file)


CLOSE($fd)

This simply executes an operating system CLOSE call on the given file descriptor and returns whatever value is returned by the operating system.
It is the responsibility of the script programmer to make sure that the file descriptor is valid (i.e. obtained from a previous OPEN or CREAT call.
If you close files that belong to IVT (script files, IVT.RC files, etc.) then you should expect the unexpected.

See also OPEN, WRITE, CREAT and READLN.
See the modem dialer for an example of using these statements.


13.10.7: CHDIR (Change directory)


CHDIR(directory)

The IVT process will change its current directory to the directory you specify.
The function returns 0 when successful. A return value of -1 indicates an error, and $ERRNO is set to indicate the error.
Use with care: IVT is multi-session and changing the current directory of the entire process from one session can possibly confuse scripts running in other sessions. It is probably best to use absolute path names whenever possible and not rely on the current directory.

See also GETCURDIR.


13.10.8: CHOOSECOLOR (Pick a color using a GUI dialog)


Rgb = ChooseColor();

This blocking function can be called from a script and will bring up the standard Windows color chooser. The user can then pick a color either by using the mouse to point to a desired color, or by entering RGB values, or by pointing to one of the standard colors that Windows offers, etc.

When the user confirms a valid choice, the function will return a string in the form of '#RRGGBB' where RR is 2 digits specifying a 'Red' component, GG is green, BB is blue. Each set of 2 digits is the hexadecimal value between 0 and FF. So '#000000' would be black, '#FFFFFF' the brightest white, '#00FF00' bright green, etc.

All color configuration options in IVT understand this format, so you can have the user pick a color which you then use in configuring IVT, dialogs and so on.

When the user aborts the dialog, an empty string is returned.
This function requires that the current session is in the foreground, when that is not the case, it will wait for the user to switch to the session.


13.10.9: COLORATTRIBUTE (Color code in a DIALOG)


COLORATTRIBUTE(String)

The new DIALOG statement of IVT allows you to create GUI dialogs.
Internally, IVT uses the same technology to create its own "Create Session" and setup dialogs. The ColorAttribute function uses the internal IVT function to get colors into texts that you can add to a dialog.
The String must be a valid color definition string (see COLORS).
The function returns a small string that encodes the given colors.
The code begins with a "~A", followed by two character (one for the background and one for the foreground colors). Other such "~codes" are described at the ECHO statement.
Note that you can specify explicit 'default' for either the foreground or background colors, which is handy for dialogs.

Example:


   DIALOG CFG TEXT_NL \
      Concat(ColorAttribute("BrightRed BrightWhite"),\
             "I am a ~1warning~0!\n")

The ~1 turns on reverse video, swapping foreground and background colors, so Note that you can specify explicit 'default' for either the foreground or background colors, which is handy for dialogs.

the "I am a" text will be red-on-white, the "warning" will be white-on-red.
The ~0 turns all video modes off (back to normal text).


13.10.10: COMMANDOUTPUT (Run a command, capture output)


x = CommandOutput(command[,options[,exitcode]])

This function starts a Windows program (with optional parameters) and returns the standard output of that command (as a string).
There is no limit to the size of the output.

Also, this command can be used to read data from long-running commands or blocking commands without blocking IVT in general. Only the script (or thread) using this function will block until the command is complete.

The optional options parameter controls the creation of the process. It can contain zero or more of the following:

When no options are specified, the default is "STDERR DETACHED".

The exitcode must be the name of an IVT variable that receives the exit code of the command. Normally, zero means success, anything else is an error code.

Note: The script will block until the command is finished, but IVT will poll for output of the command so all sessions and other scripts active in IVT will continue to run even if the command itself runs for a long time.
This allows you to have multiple sessions and multiple THREADs that run various commands, all simultaneously.

Due to technical limitations, such a blocking call can only be written as a simple assignment, you cannot use COMMANDOUTPUT in more complex expressions.

Example:


x = CommandOutput("sort","DETACHED STDERR=errout INPUT=myfile","errc")
IF $errc != 0 \
THEN ECHO "Sort failed: errors are $errout" \
ELSE ECHO "Sorted output:\n$x\n"

This will run the "sort" program on the "myfile" as stdin. When OK, the results are displayed, when there are problems, the details are shown.

See also SHELLEXECUTE and SYSTEM.
See also the ESC<space>R escape sequence.


13.10.11: COMPUTE (Perform simple calculations)


LSET Variable COMPUTE expr

NOTE: COMPUTE has been superseded by normal, nested expressions...

The COMPUTE function is a relic of the past. Versions 21 and later of IVT support complex expressions that can be used in LSET and IF statements, and can do more operations in a single statement than the old COMPUTE could handle.
The assignment statement in IVT can now do things like:


   x = $x + $y * ($z + 20)

See expr for details.

The manual entry for the original COMPUTE statement is retained for historical reference.

Old syntax:


LSET Variable COMPUTE expr1 operator expr2

IVT can perform calculations upon the numerical representations of variables (and constants). The expr1 and expr2 cannot be complex expressions. To keep IVT small and fast, I have not attempted to implement a full expression evaluator with parentheses, precedence and all the rest when the average script only needs things like a = a + 1 anyway. So there.

The operator can be:


        +       Addition
        -       Subtraction
        *       Multiplication
        /       Integer division
        %       Modulo

Examples:
        LSET a COMPUTE $a + 1
        LSET b COMPUTE $a * $a

Don't forget the word COMPUTE!


13.10.12: CONCAT (Concatenate expressions into a string)


CONCAT(expr1,expr2[,expr...])

This function takes a minimum of 2 arguments, there is no maximum.
It takes the string representation of all arguments (each of which can be a complex expression) and returns a string which is the concatenation of all those strings. There is no practical limit to the size of the resulting string, other than available memory.
So, you can do stuff like:


   ECHO Concat(Sprintf("%-30.30s",$Host),    \
               Sprintf("%-15.15s",$LoginNm), \
               Sprintf("%-9.9s",$Indicator), \
              "\n")

Which is IVT's way to print a formatted line to the screen.
Strings can also be concatenated like so:


   x = "$str1$str2";
   y = "${str1}and${str2}";
   z = "$Hash{'key1'}$Hash{'key2'}";

The braces are necessary in this case because "and" will be seen as part of the variable name otherwise. New in version 26.7 is that you can reference hashes and arrays inside a quoted string.

See also SUBSTR, REGMATCH, LENGTH and STRSTR.


13.10.13: COPYHASH (Copy (parts of) hashes)


CopyHash($Destination[{key}],$Source[{key}...])

This function can be used to copy (parts of) a hash into another hash.
It returns the number of items that have been copied.
Since an array is really the simplest form of a hash, CopyHash can be used to copy arrays, too.

In its simplest form, an entire hash or array can be copied:


CopyHash($NewHash,$OldHash)

And this will make an exact copy of OldHash into NewHash. An easier way to achieve the same copy of an antire hash is a simple assign:


   NewHash = $OldHash;

A copy can also be stored under a sub-key in the destination hash:


CopyHash($NewHash{'mysubkey'},$OldHash)


A copy of the entire OldHash is stored under the 'mysubkey' key.

You can also copy a part of a hash:


CopyHash($NewHash,$OldHash{'some'}{$x})


And only the indicated sub-part of the OldHash is copied.

And, of course, a combination is also allowed:


CopyHash($NewHash{$y}{$x},$OldHash{'some'}{$x})

In all cases, the actual number of items transferred is returned as the result of the function.
In version 26.7 of IVT this function is largely superseded by simple assigns of (sub)hashes.

See also DELHASH, SAVEHASH, READHASH.
See also TYPEOF, GETVALUE, NAMEOF, PUSH, POP, JOIN.
Se also ARRAYS.


13.10.14: COPYFILE (Copy a file)


COPYFILE(SourceFile,DestinationFile)

This function simply copies a file.
The first argument should yield an existing file.
The second argument should yield a valid file name. If the destination file already exists, it is overwritten.
The copy is done in binary mode (works for any file).

The result code is:
0 - Copy succeeded.
1 - Could not read SourceFile.
2 - Could not create DestinationFile.
3 - Could not write (all of the) data to DestinationFile.

When a problem occurred, the variable $ERRNO is set to indicate the reason of the failure.

See also EXISTS, CREATE, OPEN, READLN, WRITE and CLOSE.


13.10.15: COUNTCHARS (Count occurrences of characters in a string)


COUNTCHARS(chars, stringtosearch)

This function counts the number of characters present in chars in the string to search. For example:


x = COUNTCHARS("\n", $SomeString);

Returns the number of newline characters in $SomeString.


x = COUNTCHARS("\n\r", $SomeString);

Returns the sum-total of all CR and NL character in $SomeString.


13.10.16: CREAT (Create a file)


CREAT(file,mode)
CREATE(file,mode)

This function will use the creat() function of the operating system to create the specified file. It will return the value returned by this system call, and set the IVT variable $ERRNO to whatever the operating system has set it to.
IVT accepts both the "creat" and "create" spelling of this function call.
The second parameter of the creat() system call must be the creation-mask.
This specifies if the file will be read-only or read-write. Specify 0 for read-only and 0666 for read-write (this is the Unix way to specify access modes for an object such as a file).
A return value of -1 indicates an error.
Example:


   fd = CREAT("C:/TMP/JUNK",0666)
   IF $fd < 0 THEN Popup "Error $ERRNO during CREAT"

See also OPEN, WRITE, CLOSE, EXISTS and READLN.
Note that OPEN also allows you to create files by specifying the O_CREAT flag, and that SOPEN can be used to share open files between processes.


13.10.17: CRYPTFL (Crypt a file)


CRYPTFL(Filename,"PASSWORD",word,[1way])
CRYPTFL(Filename,"DEFAULT",[1way])
CRYPTFL(Filename,"REUSE",[1way])

This function allows you to encrypt files from within an IVT script.

The first form will encrypt the mentioned file with the password you specify.

The second form will encrypt the file with the built-in IVT default password.
When IVT has to read this file later, it will always try the default password first. If none of the passwords IVT knows are usable, IVT will prompt for a password. In other words, files encrypted with the default password can be read without delay, files encrypted with other passwords can result in a prompt.
IVT will remember any password you type (or specify with CRYPTPWD) and only prompt if none of them work.

When you specify a REUSE, IVT will encrypt the file with whatever password is known for that file. If no password is known, you'll get an error (see below).

The optional 1way will prevent decrypting the file ever again. IVT WILL be able to read it, but you cannot use the setup screen or the DECRYPTFL function to decrypt the file. The password learning system uses this to further protect the password database - even if somebody knows the password used to encrypt the file, this still does not mean that all passwords in that file can be read by a human.

The CRYPT/DECRYPT functions can return the following values:


0 - Success
1 - File could not be opened
2 - File exists and is not encrypted
3 - Failure. Could not (re)create the file.
4 - Cannot decrypt, bad password.
5 - Cannot decrypt, file is 1-way encrypted
6 - REUSE specified and no password known.

See also DECRYPTFL and CRYPTFLPWD.
See encrypting files for further help.


13.10.18: CRYPTFLPWD (Set the password to encrypt a specific file)


CRYPTFLPWD(Filename,"DEFAULT")
CRYPTFLPWD(Filename,"PASSWORD",word)
CRYPTFLPWD(Filename,"TEST","DEFAULT")
CRYPTFLPWD(Filename,"TEST",word)
CRYPTFLPWD(Filename,"INHERIT",FileOrg)

This function manipulates the password to be used by the REUSE options of the CRYPTFL function. The password learning system uses this when you change the master password of the password database.

The return code of this function is the same as for CRYPTFL.

The first two forms above actually set the password associated with the file.
No check is made for the actual existence of the file, IVT just stores the information and will use it when the file needs to be read or written in the future.
When the DEFAULT password is set, IVT will use a built-in password, which means the file can be read without the need to type a password.

The TEST DEFAULT form returns 0 when the file exists and is encrypted with the default password. It returns an error code otherwise (see here).
The TEST word form returns 0 when the file exists and is encrypted with the given password. It returns an error code otherwise (see here).

When the INHERIT is used it means the Filename inherits the current password FROM the file FileOrg (whatever that password is).
This can be used to create a copy of a password file, encrypt it with the same password as the original, then use COPYFILE to replace the original file.
This prevents an unencrypted copy ever existing on a network drive, even for a short while.

See also DECRYPTFL and CRYPTFL.
See crypting files for further help.


13.10.19: CRYPTSTRING/DECRYPTSTRING (Crypt/decrypt strings)


CryptString(InputString[, key])
DecryptString(CryptedString [, key])

The CryptString function takes an arbitrary string text and returns an encrypted version of that string. The format is hex-encoded binary, so it can be printed, stored in a registry or file, or manipulated in arbitrary ways. For example, it can be used to encrypt passwords before they are stored in the registry.
When no key is specified, IVT uses a standard, built-in one.
When you specify a key, that is used instead.

The DecryptString function takes a string as produced by the CryptString function and returns the original plaintext version.
You will have to specify the same key as used during the encryption.

Used in combination they can be used to hide secret information in a public place. The used encryption algorithm is IVT specific.

You can also combine this with CRYPTFL to crypt scripts that use passwords in some way.


13.10.20: CURSOR_COL/CURSOR_ROW (Current cursor position)


CURSOR_ROW()
CURSOR_COL()

Returns the coordinates of the cursor position of the current session.
The top-left position of the screen is designated coordinates 1,1.
The cursor can be positioned using the SETPOS statement.

See also $ROWS and $COLS.
See also SCREENTXT and SCREENATTR.
See also CLS, ECHO and VTECHO.
If you want to interact with the user in a complex fashion, use DIALOG.


13.10.21: DECRYPTFL (Decrypt a file)


DECRYPTFL(Filename,Password)

This function decrypts an encrypted file.
This first operand specifies the file to be decrypted; the second must specify the correct password (key) with which the file is encrypted.

See here for a list of return values.

You can, of course, not decrypt files that were encrypted with the default password, nor can you decrypt files that were 1-way encrypted.

See also CRYPTFL and CRYPTFLPWD.
See encrypting files for further help.


13.10.22: DEFINED (Check for existence of a SCRIPT by name)


DEFINED(name)

This function is passed the name of a SCRIPT. It returns TRUE (1) when a script with that name exists, and FALSE (0) if it does not.
This can be used to prevent error-messages about non-existing scripts when you use an indirect CALL such as:


    Script LogIn ... StartMe ...
    ...
       IF DEFINED($StartMe) THEN CALL $StartMe
       ...
    END

This way, the script name specified in $StartMe is called only when it exists.
See also VARDEF, which does the same for variables.
See also ONERROR, which allows you to trap any kind of error.
See also DELSCRIPT, to delete script definitions from memory.
See also QueryScript to see if a script is active.


13.10.23: DELHASH (Delete parts of hash)

See hashes and arrays for a description of complex data structures in IVT.


DelHash($Hash[{key}...])

This function can be used to delete an entire hash or a part of it.
If you specify keys, only that part of the hash below that given key is deleted. Without keys, everything is deleted.
Deleting makes the given key(s) in the hash undefined and frees the associated memory.
When you specify the name of an array, the entire array is deleted.

Examples:


   DelHash($h)         # Delete entire hash
   Delhash($h{'xx'})   # Delete everything below key with value 'xx'
   Delhash($h{$x}{$y}) # Delete everything below specified key pair

See also TYPEOF, to determine the type of data that is going to be deleted by DELHASH.
See also FORALL KEYS.
See also FORALL VALUES.
See also NAMEOF and GETVALUE.
See also UNSET.


13.10.24: DIALOGADDEVENT (Generate a GUI dialog event)


DialogAddEvent(Dialog,Code,Key1,Key2,Id)

This (seldom used) function can be used to generate an event as seen by DialogEvent. In other words, you can pretend controls are clicked or data typed into a GUI dialog using this function. This can be used to translate certain keys being typed into certain actions (like clicking buttons).
The Dialog must specify the name of an existing DIALOG, or must be the literal "IVT", in which case the event is sent to IVT itself. For names of valid objects to send messages to, see IVT_DIALOGSTATE.

The function returns TRUE when successful, and FALSE when there are problems.
A diagnostic will appear on-screen with a description of the problem.

The Code must be one of:

After using this function, the next DialogEvent will return the event just added.
Example:


WHILE (Ev = DialogEvent("DIALOG","ITEM","KEY1","KEY2")) != "END"
   IF $Ev == "KEY" && $KEY1 == 13 \
   THEN DialogAddEvent("CMNT","CLICK",0,0,"OK");
   ...

This translates a RETURN key being typed into a click on the OK button.
See also DIALOG and DialogQuery.


13.10.25: DIALOGEND (End a GUI dialog)


DialogEnd("NAME")

This function aborts the dialog identified by NAME.
It has the same effect as the user clicking on the CLOSE button of the dialog.
It does not generate an END event (as returned by DialogEvent), but a subsequent call to DialogEvent will return an "ERROR" event because the dialog no longer exists.
The function returns TRUE when the specified name is an existing, active dialog, and FALSE otherwise.

See also DIALOG and DIALOGQUERY.
See also DIALOG NAME DESTROY.


13.10.26: DIALOGEVENT (Query user actions on GUI dialogs)


DialogEvent(VAR_DIALOG,VAR_ITEM,VAR_KEY1,VAR_KEY2)

This function is used to find out which actions are performed by a user on a DIALOG. Clicking on buttons, entering data into text boxes, using function keys and so on is all reported through DialogEvents.

The function takes 4 parameters, all of which are names of IVT variables.
The function fills these parameters with details about an event.
If the empty string is passed for any item, that item is not returned.
The VAR_DIALOG variable is filled with the NAME of a dialog that has an event.
The VAR_ITEM is filled with the tag name of the item in the dialog.
The VAR_KEY1 and VAR_KEY2 are filled with the codes of keys typed on the keyboard (see ONKEY).
When one of these variables already exists (be it as a parameter, a local variable in a function, a session local variable or a global variable), they get assigned the new value. When the variable does NOT exist yet, it is created as a session-local variable.

The type of the event is returned as the return value of the function.
There can be the following events:

Normally, a script should use the following approach to handling GUI dialogs:


   DIALOG X DESTROY
   DIALOG X
   DIALOG X BUTTON_NL XBUT "Button text"
   DIALOG X TEXTBOX_NL XTXT "Amount:" NUMERIC "LENGTH=6"
   DIALOG X COMBOBOX_NL XCHC "Add" "Subtract" "Multiply" "Divide"
   DIALOG ... # Create the rest of the dialog
   DIALOG X BUTTON XCANCEL "Cancel"
   DIALOG X SHOW

   WHILE (Ev = DialogEvent("DIALOG","ITEM","KEY1","KEY2")) != "END"
      IF $Ev == "NOTHING" THEN CONTINUE
      IF $Ev == "ERROR"   THEN BREAK
      GOTO_OPT "${Ev}_${DIALOG}_${ITEM}"
      CONTINUE

LABEL CLICK_X_XBUT
      ...Button XBUT is clicked...
      CONTINUE

LABEL CLICK_X_XTXT
      DialogQuery("X","XTXT","Amnt")
      ... Value entered into XTXT textbox is in $Amnt ...
      CONTINUE

LABEL CLICK_X_XCHC
      Res = DialogQuery("X","XCHC","Line")
      ... Res is now 0 - 3 (choice from dropdown list) ...
      ... Line is now "Add", "Subtract" etc (text from dropdown list) ...
      CONTINUE

LABEL CLICK_X_XCANCEL   # User clicked Cancel. End dialog
      BREAK
   NEXT

   DIALOG X END

This creates a dialog, displays it and handles all the events. When the loop ends the dialog is destroyed using DIALOG END.

Note the use of GOTO_OPT in the handler. By using the DIALOG, Ev and ITEM variables, an indirect, optional GOTO is performed to a destination that uniquely identifies the dialog, event and control that had an event.
For example, when the user clicks on the button identified by "XBUT" in the "X" dialog, $Ev will be CLICK, $DIALOG will be "X" and $ITEM will be "XBUT".
This will do a GOTO to "CLICK_X_XBUT". When that label exists, the code there will be executed. When it does NOT exist, the goto does nothing, the event is ignored and the CONTINUE fetches the next event. This way, you only have to write code for the interesting events.

For example, when the user types an F1, $Ev will be HELP, $ITEM might be "XBUT" and $DIALOG will be "X" again. Since there is no label HELP_X_XBUT the event will be ignored. Note: Help can be handled automatically using DIALOG HELP.

The example shows a typical handler for a textbox (the CLICK event signifies that data has been entered, the DialogQuery retrieves the actual value.

The CLICK_X_CHC shows a typical handler for a combobox. The CLICK event signifies that the user chose an entry, the DialogQuery identifies WHICH entry in two ways (the sequence number and the actual line of data from the control).

The handler for the CANCEL button breaks from the loop (using BREAK), causing the DIALOG X END to be executed, and the dialog to disappear.

See also DIALOG, DialogEnd and DialogQuery.
See also DialogAddEvent.


13.10.27: DIALOGQUERY (Query state of GUI controls)


DialogQuery(Dialog,Tag[,DetailVar])

This routine can be used to query the present state of an item in a DIALOG.
The dialog you want to query is specified by the first parameter.
The item tag (option, combobox, listview, etc) is specified in Tag.

The optional third argument specifies the name of a variable that will receive additional information. When that variable is declared as LOCAL, that is used.
When an existing global variable is found, THAT is used, else a session variable is created or overwritten.

The function returns a number. On errors, the number is negative. Possible errors are:

Exactly WHAT the function returns, depends on the type of item being queried:

Example:


   DialogQuery("CFG","METSYS","IvtPwdMetaSystem")

Retrieves the current value of the password metasystem into $IvtPwdMetaSystem.

For more examples of handling complex GUI dialogs, see: password maintenance.


13.10.28: DIALOGSORTCOLUMN (Sort a column of a LISTVIEW)


DialogSortColumn(Dialog,Tag,ColumnNumber[,order]);

When you create LISTVIEW with the SORTHEADER property, the header of the view becomes clickable. Such events are reported by DialogEvent, and the common purpose of the click is usually to sort the listview on the column that is clicked, and the actual sorting is done by this DialogSortColumn function.

You must specify the name of the dialog, the tag of the listview and the column number (reported through $KEY1 parameter of DialogEvent function).
The 'order' is optional. Default is ASCENDING. Valid options are:

A typical use of this function would be:


   DIALOG Dia ...
   DIALOG Dia LISTVIEW MYLIST "COLUMN=10" "COLUMN=20" "COLUMN=4"
   DIALOG Dia LISTVIEW MYLIST "REQHEIGHT=30" "SORTHEADER"
   DIALOG Dia LISTVIEW MYLIST "HEADER=Date\tName\tAge"
   ...
   WHILE (Ev = DialogEvent("DIALOG","ITEM","KEY1","KEY2")) != "END"
      if $Ev == "ERROR"   then break;
      if $Ev == "NOTHING" then continue;
      ...
      GOTO_OPT "${Ev}_${DIALOG}_${ITEM}"
      continue;
      ...
LABEL CLICK_HEADER_Dia_MYLIST
      if ($KEY1 == 2) THEN {
         DialogSortColumn($DIALOG,$ITEM,$KEY1,"NUMERIC FLIP");
      } else {
         DialogSortColumn($DIALOG,$ITEM,$KEY1,"ALPHA FLIP");
      }
      continue;

The MYLIST will be a listview with 3 columns: a date, a name, an age.
The columns will be clickable because of the SORTHEADER.
When clicked, a "CLICK_HEADER" event will be reported by DialogEvent, where $DIALOG will be "Dia", $ITEM will be "MYLIST", $KEY1 will be the column number (0 - 2). The code for handling the event simply sorts the proper column.
The first click on a column will sort ascending, the next descending.
For column #2, NUMERIC is given so ages are sorted properly.
The other columns explicitly use the ALPHA setting (could be omitted).

More details can be found in the "Workon" plugin which is part of the standard distribution of IVT.


13.10.29: ERROR (Invoke the standard error function)


ERROR(Number,Level,string)

This function invokes the built-in, standard error handling function of IVT.
This will set $IVT_ERR_NR to the specified error Number, and treat String as an error of the indicated Level.

If you set an ONERROR handler, it will be invoked when you use the ERROR function. Valid values for Level are:

0 - Warning.
1 - Error.
2 - Fatal error.

Invalid values for Level are silently adjusted.
Normally, warnings and errors will be displayed. Level 2 errors will terminate the session.
See ONERROR for a further description of the possibilities.


13.10.30: EXISTS (Test if a file or directory exists)


EXISTS(path)

This function returns TRUE (1) if the specified path exists and FALSE (0) if it does not.
The path can be a file or a directory. You can use STAT to find out what the attributes of a certain path are, but see also ISDIR.


   IF !Exists(x = "C:/tmp/junk") THEN Popup "$x is missing"

Note the way an assignment is used as an expression, and the way the name of the missing file is displayed in the popup.

See also TYPEOF and VARDEF (to see if a variable exists).` See also STAT, OPEN, WRITE, CLOSE, CREAT and READLN.
See also UNLINK, MKDIR, ISDIR and RMDIR.


13.10.31: EXPAND (Reference variables indirectly)


EXPAND(string)

This function takes a given string and expands all references to variables into their contents. Consider, for example, the following statements:


   Var_1 = "This is var one"
   Var_2 = "This is var two"
   Index = 2
   x = EXPAND("\$Var_$Index")

The EXPAND function will be passed the argument "$Var_2", so the result will be that the variable x will contain:


This is var two.

As you can see from the example, this can be used to indirectly reference variables, which can be used to implement arrays.
Of course, newer versions of IVT have real arrays and this trick is no longer necessary.

Not also that the indirection is not limited to single dimensions: ANY valid identifier can be dynamically generated this way. Also, it is not required to use numbers, any naming or numbering scheme can be implemented this way.
Assigning variables indirectly is done by (for example):


   Index = 2;
   Var_$Index = "Another value for member two";

I.e., when you assign values, the receiving variable can be a simple string EXPRESSION, rather than a constant. It must yield a valid identifier, so no spaces or special characters.

To loop through all members of such an indirect array, use FORALL.


13.10.32: GETFILESIZE (obtain the size of a file)


GETFILESIZE(name)

This returns the size (in bytes) of the file given by name.
The STAT function also has this functionality, but in some rare cases the information returned by STAT() is not up to date. Depending on the file system the named file resides on and the networks involved, Windows may decide to cache the meta information of a file and so can return old information.
See https://blogs.msdn.microsoft.com/oldnewthing/20111226-00/?p=8813/ for details.

This GetFileSize function is based on the GetFileSizeEx function in Windows.
Rumor has it that this function always returns an accurate result.
Upon failure the function will return -1 and the $ERRNO variable will be set to indicate the cause of the failure.

See also STAT.


13.10.33: FFLUSH (Flush buffer of an open file)


FFLUSH(fd)

The fd is a file descriptor obtained from a successful call to OPEN, CREATE or POPEN. The FFLUSH call will force any buffered data to disk (the WRITE function will buffer I/O to improve performance).
Files are flushed automatically when you CLOSE the file, or when IVT exits.

The function returns 0 upon success and -1 upon error.


13.10.34: ISDIR (Determine if something is a directory)


IsDir(stringexpr)

This function returns TRUE (1) when stringexpr is an existing directory, FALSE (0) when not.
It returns -1 on error, in which case $ERRNO set to indicate the cause of the problem.

See also STAT, MKDIR, RMDIR, EXISTS and FindFiles.
See also this example script for dropping files onto IVT.


13.10.35: NLS (Translate national language in scripts)


NLS(tag,English)

NLS is National Language Support.

This function can be used to create IVT scripts that display text in the language of the user. When the IVT_LANGUAGE command is used, or the user alters the national language of IVT (using interactive setup), all IVT's own dialogs and menus switch to the language the user has selected (see IVT_LANGUAGE for a list of supported languages).

However, a user script that displays dialogs, menus, or popups will of course not switch to the new language by itself.
If you want to support multiple user languages in your script, most of the work can be done by IVT. The person writing the script must supply a file that contains the translations of all text items used by the script.
Each text item is identified by a TAG.
The NLS function takes the TAG and the original English text, and returns the text belonging to that TAG in the current language, or the original English text if there is no translation to be found (or the current selected language is English).

Since IVT will automatically align text in a dialog, and provide keyboard shortcuts for all items automatically as well, the programmer need not to be concerned about alignment (older versions of IVT were unable to do this).

This is also the way that IVT itself provides support for multiple languages in the scripts that are shipped with IVT.
A simple example is the key broadcast script, which is one of the scripts that come with the IVT distribution.
The "Languages" directory of IVT contains the translation tables for all languages. The file Languages/Dutch/stdscripts has the Dutch texts for all standard scripts that ship with IVT. When the key-broadcast script wants to display a message that another session is already using the key-broadcast script, it says:


   POPUP NLS("OTHERBOSS","Another terminal is already master!")

And in the stdscripts file of the Dutch language you can find the following lines:


   FILE    "broadc.ivt"
   PACKAGE "keybroadcast"
   ..
   STRING OTHERBOSS "Een andere sessie is al hoofd-typist!"

Which is the Dutch translation of the popup text.
The FILE and PACKAGE directives tell IVT that the following translations are intended for that package in that file, so every script can have its own "name space" in the translation file, so there is no need to make the tags names unique for all current and future scripts.

When you write your own scripts, you could alter the "stdscripts" files that ship with IVT to add your own translations (and that would work), but that would mean altering standard files (Not Nice).
The LANGUAGE_FILES directive can be used to tell IVT about your translation files. Store those in any convenient place that IVT can access and the script you write will automatically switch to the proper language.

See also ONLANGUAGE, which allows you to trigger a script of your own when the user alters the current language. This trigger can be used to update your customized menu titles (which show up on the IVT menu bar) to the proper language, and also the menu texts themselves.
See also IVT_LANGUAGE.
See also LANGUAGE_FILES.


13.10.36: FGSESSID (Foreground session ID)


FGSESSID()

This function returns a unique number that identifies the current foreground session (see MYSESSID() for details on sessions IDs).
This can be used to identify the current foreground session, and to test if the current script is running in the foreground by doing:


IF MySessID() == FgSessID() \
THEN ... I am the foreground session ...\
ELSE ... I am in the background ...

Not needed very often, but in some cases a script can change appearances of IVT which is only appropriate for the foreground session.

See also MYSESSNR() and MYSESSID().


13.10.37: FILE_SEND/RECEIVE (X/Y/Zmodem/ASCII File transfer)


FILE_SEND(Protocol,Pattern)
FILE_RECEIVE(Protocol[,Pattern])

These two function calls allow file transfer under script control.
The Protocol must evaluate to a string, of which the first character must be one of:


X: Xmodem;
Y: Ymodem;
Z: Zmodem.
A: ASCII (no protocol, send only)

Any other value will result in a return value of -2 (invalid call).
Both upper and lower case are acceptable to specify a protocol.
When file transfer is disabled (secure mode) the result of the function will be -1.

IVT will start the transfer. The host should be ready to receive or transmit a file as well, use SEND and WAIT commands for this (see example below).
When using ZMODEM, make sure you use NO_ZMODEM_AUTO to prevent IVT from starting a normal file transfer automatically, which would conflict with another one started on the same session by your script. Don't forget to enable it afterwards (ZMODEM_AUTO).

Only XMODEM requires a filename when a file is received - the other protocols transmit the filename as part of the transfer.
The ASCII protocol can only be used for transmitting, not receiving.

Once the transfer is started, the function waits for it to end. The success or failure is indicated by the return value. A positive integer indicates the number of bytes in the last successfully transmitted file. A negative number indicates a failure (aborted due to communications failure or a human aborting the transfer). When the user should not interfere with the transfer, use a KEYBOARD OFF prior to starting the transfer (and KEYBOARD ON afterwards).

Perhaps a little example is required:


   Script DoReceive
      LOCAL x, fd, line, auto;

      auto = $ZMODEM_AUTO
      NO_ZMODEM_AUTO
      KEYBOARD "OFF"
      UNLINK("$IVTDOWNLOAD/mydata")
      SEND "sz /tmp/mydata\r"
      WAIT "\r"
      x = FILE_RECEIVE("Z")
      WAIT "finished"
      WAIT "\r"
      IF $auto != 0 THEN ZMODEM_AUTO
      KEYBOARD "ON"
      IF $x <= 0  THEN \
         ECHO "File transfer FAILED code=$x\n" : \
         RETURN

      ECHO "\nReceived $x bytes OK\n"
      if (fd = OPEN("$IVTDOWNLOAD/mydata",0)) < 0 THEN RETURN
      x = 1
      WHILE (line = READLN($fd)) != ""
         ECHO "$x: $line"
         x = $x + 1
      NEXT
      CLOSE($fd)
   End

The example above receives a file, when that is successful, it is displayed on the screen with line numbers.
Currently, there is no feedback to the script on the filename of received files, only the number of bytes. As in the example above, the script will usually know the name of the file to transfer.

Another example for sending a file:


   Script DoSendFile dir file
      LOCAL x

      NO_Zmodem_Auto
      Send "rm -f $file; rz\n"
      Wait "\r"
      x = FILE_SEND("z","$dir/$file")
      Echo "\nFile $dir/$file sent, result is $x\n"
   End

Note the subtle WAIT "\r" in both examples. This makes the script wait for the echo of the RZ and SZ commands. If that is not done, the file transfer will see that echo, reject it as invalid protocol stuff, wait for several seconds, and try again. Your file will be transferred, but not as fast as you'd want it to.
To insure fast start-up, follow the example.

A last example, if you want to transfer a number of files to a Unix host and it does not have any X, Y or Zmodem software, but your connection is through a reliable connection (telnet, SSH or an error-correcting serial link), then the following works:


   Script SendFiles names Remote
       SEND "SavedTty=`stty -g`; "              # Save current TTY mode
       SEND "stty -echo tabs -opost -icrnl; "   # Set binary connection
       SEND "cat - > $Remote; "                 # Redirect to file
       SEND "stty \$SavedTty; "                 # restore settings
       SEND "\r"                                # End command
       USLEEP 500                               # Wait for CAT to receive
       FILE_SEND("A","$names")                  # Send in ASCII mode
       SEND "\r\04"                             # Send ^D, EOF
   END

   KEYMACRO "F8" SendFiles "test*" testfiles

When you press F8, this will transmit all files that match the pattern test* to a (single) file testfiles on the remote system.
The 'stty -g' output is saved in a shell variable, then the connection is set to not echo, not expand tabs to spaces, and not the change received CR chars into new lines. Then a CAT is started to redirect received data to a file.
The FILE_SEND actually transmits all the data, and sends an EOF afterwards to terminate the CAT. Finally, a last STTY command is use to reset the connection to the saved settings.


13.10.38: FINDFILES (search for Windows files and directories)


FindFiles(Base,Scope,Directory,Pattern[,Options])

This function allows you to retrieve a list of file names and directories into IVT variables. This is a powerful function that can run for a long time.

Like SPLIT, there is a new and old interface for this function:

1) New. The Base specifies the name of a hash by using "Name{}". So by ending
   the name with a pair of curly-brackets you designate that a hash is to be
   used to store the results.
   IVT will fill this hash with 2 dimensions: A sequence number from 0 to N
   (where N is the number of retrieved objects) and the second dimension is a
   tag that describes an attribute of the object (see below).

2) Old.
   The Base specifies a name used as a base name for IVT variables to store the
   results in. The variables are created with a sequence number (see below).
   You must use the EXPAND function to retrieve the values. This interface is
   deprecated, and retained for backward compatibility with times when IVT did
   not have true hashes and arrays.

The Scope specifies the type of the scope of the hash or variables created by this function:

The Directory specifies the name of a directory to start the search in. The Pattern specifies the wildcard pattern to search for.
Options is an optional string expression that can contain one or more of the following words:

The function returns the number of objects found. The results are stored in variables with Base as a base name, according to the following rules and with a scope of the type specified:

To retrieve the name of the first object returned when NAMES is specified as the base name (old interface), you could use:


   Index = 0;
   Nm = Expand("\$NAMES_${Index}_NAME")

Since $NAMES_0_NAME is the name of the variable that holds the name of the first object returned.
Or, if you use the new hash interface: $Hash{$Index}{'NAME'}.

Perhaps an example can serve to clarify all of this:

First the new interface using a hash:


   Cnt = FindFiles("NAMES{}","LOCAL","C:/Program Files","*.pdf",\
                   "RECURSIVE BLOCK SHORTNAME")
   ECHO "Found $Cnt objects\n"
   FOR (i = 0; $i < $Cnt; i++)
      ECHO_LIT "$i: " $NAMES{$i}{'NAME'} "\n" \
           "   "      $NAMES{$i}{'SHORTNAME'}" "\n"
   NEXT

And the same in the old interface:


   Cnt = FindFiles("NAMES","LOCAL","C:/Program Files","*.pdf",\
                   "RECURSIVE BLOCK SHORTNAME")
   ECHO "Found $Cnt objects:\n"
   FOR (i = 0; $i < $Cnt; i++)
      ECHO_LIT "$i: " Expand("\$NAMES_${i}_NAME") "\n" \
           "   "     Expand("\$NAMES_${i}_SHORTNAME") "\n"
   NEXT

Both cases produces output similar to:


Found 20 objects:
0:  C:/Program Files/Adobe/Acrobat 7.0/Help/ENU/Reader.pdf
    C:/PROGRA~1/Adobe/ACROBA~1.0/Help/ENU/Reader.pdf
1:  C:/Program Files/Adobe/Acrobat 7.0/Help/NLD/Reader.pdf
    C:/PROGRA~1/Adobe/ACROBA~1.0/Help/NLD/Reader.pdf
...
19: ....
    ....

This finds all PDF files below the "Program Files" directory, returning all attributes of all files, including the SHORTNAME. While the function runs, IVT is deaf and blind to everything else (BLOCK option). 20 objects are found, numbered 0 - 19, and the FOR loop displays both the long name and the short name. The ECHO_LIT is required to make sure that ~ characters do not cause problems (the ancient 8.2 names contain tildes, and they are special in IVT).
The variables that are created (NAMES_0_NAME, etc) are of scope LOCAL, which means they are automatically deleted when the script ends.
The same goes for the hash with a local scope.

See also GetFullName to translate to absolute pathnames.
See also IsDir and STAT.
See also EXISTS.
See also the ONDROPFILES example script, which uses all options of the FINDFILES function extensively when a directory is dropped on the IVT window (it transfers all files in the directory tree to the host).


13.10.39: FINDPATH (Search PATH for a file)


FINDPATH(filename)

This function uses the current environment variable PATH to find the given file name. When found, it returns the directory name where the file is installed. When not found, it returns the empty string.

Example:


IF ((x = FindPath("perl.exe")) != "") \
THEN echo "Perl is installed in $x\n" \
ELSE echo "Perl is not installed in $ENV_PATH\n"

You can use this to prevent errors when using SHELLEXECUTE and you want to make sure the program can actually run.


13.10.40: FLASHWINDOW (Flash the IVT window or button)


FLASHWINDOW(Options, Count, Timeout)

This function uses the FlashWindowEx function of Windows. It flashes the window caption, task button, or both.

Options is a string that can contain a list of the following options (space separated):

Count
  The number of times to flash the window.

Timeout
  The rate at which the window is to be flashed, in milliseconds. If Timeout
  is zero, the function uses the default cursor blink rate.

The return value is an integer with the return code of the underlying Windows FlashWindow function, see:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms679346(v=vs.85).aspx

Typically, you flash a window to inform the user that the window requires attention but does not currently have the keyboard focus. When a window flashes, it appears to change from inactive to active status. An inactive caption bar changes to an active caption bar; an active caption bar changes to an inactive caption bar.

Example:


   FLASHWINDOW("TRAY TIMERNOFG",0,0)

When IVT is minimized, this will flash the tray button endlessly with default speed until the user brings IVT in the foreground.


   FLASHWINDOW("ALL",5,400)

Flashes both the window title and the tray button 5 times, every 400 Ms.


13.10.41: FULLSCR (full screen control)


FULLSCR("on"|"off"|"status")

This function allows you to control the FULLSCREEN status of IVT from a script.
Full screen mode will be either turned ON or OFF, and the result will be TRUE (1) when the status changed, and FALSE (0) when the mode was already correct.
The current status can be obtained by using the STATUS parameter, the result will be TRUE when IVT is currently in full screen mode, FALSE (0) when not.

The FULLSCREEN keyword is used to describe what the screen will look like in full screen mode, if you want IVT to start in full screen mode you will have to either click on <Save> in setup while IVT is in that mode, or write a STARTUP script that calls FULLSCR to make the switch, or to use a:

NOTE: This is a blocking function, which cannot be used in a PRECONNECT script (the script will be killed if it tries). This is because switching full screen mode on or off is a complex, time-consuming operation.


WINDOW_SIZE FULLSCREEN DEFAULT

In your IVT.RC file.


13.10.42: FORK (Create a session from a SCRIPT)


Child = FORK("ScriptName"[,parameters])

FORK can be used to create new sessions from a script. It is based on Unix FORK, which splits a program into two almost identical programs. The initiator is called the "parent", the newly created copy is called the "child". The child starts out as an exact copy of the parent, makes changes to its environment as desired, then overlays itself with another program. This is how new programs are started in Unix.

The only difference between parent and child is the return code of the FORK: The child has a return code of zero, the parent receives the process ID of the newly created child.

IVT mimics this: When you call FORK, a new session is created which is an identical copy of the one calling FORK, but the new session is not connected to any host yet. But the child has a copy of all variables (local and session), a copy of the calling stack and all other scripting context.
Before FORK returns, the specified "Scriptname" is called (with any number of optional parameters). This is intended to be used to specify the host to connect to, the protocol to use, the user to login as, and anything else that is required for the job at hand.

The child can see it IS the child by looking at the FORK result code, and the parent can do the same and create more children, wait for children to stop, or whatever else it cares to do.
When FORK returns in the child, IVT will connect the child session, so make sure that $HOSTNAME and $USER are set, that PROTOCOL is specified and so on.
Remember that since the child is a copy, it will run the same loops and execute the same code as the parent does if you are not careful. Usually, you'll want the child to end using ENDSESSION.
PRECONNECT and ONCONNECT scripts will run in the child session as they would for any other session.

For synchronisation mechanisms between sessions you can use TRAP and KILL, combined with GLOBAL variables.
See also THREAD.

As an example, suppose you want to write a script that connects to a thousand hosts to check availability, password correctness and so on of all those hosts. Using an IVT session group of a thousand hosts is not going to work, as a thousand parallel sessions will overwhelm the capacities of the PC that IVT runs on. Initiating sessions one by one is going to take half an eternity.
What is needed is parallelism in an optimal degree (say 20 parallel sessions).

The example below reads hostnames from a file and initiates sessions to all of the names in that file, running twenty sessions in parallel.
As soon as one session finishes, a new one takes its place.
The WAITIDLE is required because after the FORK returns in the parent, the child has not established a session yet. The WAITIDLE waits until IVT has nothing to do for a while.
Careful study of the code below should show you how to use FORK.


########################################################################
Script HandleSession (Host)
   LOCAL x;

   ECHO "Connecting to $Host $PROTOCOL $PROTOCOL_SESSION\n"
   x = Call IvtWaitLoggedIn()
   IF !$x THEN ENDSESSION       # Login failed

   # Here you do what you need to do on all hosts.
   SEND "date\r"                # For example
   Call WaitPrompt
   SEND "exit\r"                # Gracefully end session
   ENDSESSION                   # Or ungracefully when you get here
END
########################################################################
Script ForkSet (host,proto)
   PROTOCOL "$proto";
   HOSTNAME = $host;
   USER = "root";
END
########################################################################
Script ForkAll ()
   LOCAL fd, Host, Child;

   IF ((fd = Open("Hostnames",0)) < 0) \
   THEN POPUP "Cannot open file 'hostnames'" : RETURN

   WHILE ((Host = ReadLn($fd)) != "")
      Host = Replace($Host,"\r",""); # Remove \r and \n
      Host = Replace($Host,"\n","")
      Child = FORK("ForkSet",$Host,"SSH")
      IF $Child == 0 THEN Call HandleSession($Host) : RETURN

      WAITIDLE
      SWITCHTO 1
      WHILE NRSESSIONS() >= 21
         USLEEP 10
      NEXT
   NEXT

   Close($fd);

   WAITIDLE
   WHILE NRSESSIONS() > 1       # Wait until I am only session
      USLEEP 10
   NEXT

   echo "All done\n"
END
########################################################################


13.10.43: FROMASCII (Translate from ASCII to numeric)


FromASCII(char)

This function returns the (numeric) ASCII value of the first character of the char string expression.

Example:


FromASCII(" ")

Returns the number 32 (0x20), the code for a space character in ASCII.
See also ToASCII.


13.10.44: GETCLIPBOARD (Get contents of clipboard)


GetClipboard([register])

This function returns the current contents of the windows clipboard (when invoked with zero arguments).
The optional register parameter can specify one of the named copy/paste buffers (internal to IVT only).
The returned string is an UTF-8 string.
When the current contents of the clipboard is not text, an empty string is returned.

See also the IVTFUNCTION "Copy String to Clipboard", which allows a script to store information on the clipboard.

Example:


   x = GetClipboard()
   IF $x != "" THEN {
      x = Replace($x,"\\","/")                  # Make slashes sane
      IvtFunction("Copy String to Clipboard","WAIT",$x) # Store sane version
   }


13.10.45: GETCURDIR (Get current directory)


GetCurDir()

This function returns the current working directory of the IVT process as a string. See also CHDIR.
When the function fails it sets $ERRNO to the reason of the failure and returns an empty string.


13.10.46: GETFULLNAME (Get full path name of a file)


GetFullName(FileName)

This function retrieves the full path and file name of a specified file.
GetFullName merges the name of the current drive and directory with a specified file name to determine the full path and file name of a specified file. This function does not verify that the resulting path and file name are valid, or that they see an existing file on the associated volume. Share and volume names are valid input for FileName. For example, the following list identifies the returned path and file names if test-2 is a remote computer and U: is a network mapped drive:

GetFullName does not convert the specified file name. If the specified file name exists, you can use GetLongName and GetShortName to convert to long and short path names, respectively.
Example:


   GetFullName("ivt.rc")

Returns:


   "C:\Program Files\BearStar Software\IVT VT220 Telnet\ivt.rc"

When IVT is installed and started from the default location.
Note the default Windows notation (backslash instead of slash).

See also GetShortName, GetLongName and FindFiles.


13.10.47: GETLONGNAME (Get long name from an 8.3 file name)


GetLongName(Pathname_expression)

This function takes a short 8.3 file name as input and returns the full, long pathname.
See also GetShortName and FindFiles.


13.10.48: GETPAGERPOSITION (Get current scroll back position)


GetPagerPosition()

This function returns a string that uniquely identifies the position in the scroll back history pager.
The only thing you can do with such a string is to pass it to the sister- function SetPagerPosition which restores the position (when possible).
When the pager is not currently active, the function returns -1.

This set of functions can be used to obtain and restore this position while doing something else on the session in the meantime.
A nice example of this is a HIGHLIGHT pattern that will start an editor on a pattern that is recognized to be a compiler error of some sort.
Clicking on the error starts an edit session. When the editor is done, a script can restart the history pager at the same position so the user sees the same error messages again.

See also HISTORY and pager.
See also SetPagerPosition.


13.10.49: GETSHORTNAME (Get 8.3 name of a long file name)


GetShortName(Pathname_expression)

This function takes a path name to an existing object as in input parameter and returns the short name representation of this object (in 8.3 format).
Such names do not contain spaces, which can be convenient.
For any halfway really descriptive name they return an unreadable, though unique name, which can be very inconvenient.

See also GetLongName and FindFiles.

Beware when you show these names on screen using ECHO, since they often contain ~ characters, and these are interpreted by ECHO. Use ECHO_LIT instead, or do:


   ECHO Replace(GetShortName(Pathname_expression),"~","~~") "..."

To double all ~ characters, or use VTECHO.


13.10.50: GETTABTEXT (get text of the current tab)


GetTabText()

When the TABSBAR is in use, every session gets a tab on the bar that identifies it. The text in the tab of the current session can be queried using this function.
When no text or session is known, the empty string is returned.
The text can be set by using the SetTabText function, but see also TABSBAR, which has option to set various handy defaults.

See also TABSBAR and SETTABTEXT.


13.10.51: GETUSERNAME (Get Windows login name)


GetUserName()

This IVT function calls the Windows function with the same name and returns the result: the name of the user that has logged in on the Windows workstation.

Example:


   echo "The current user is" GetUserName() "\n"

Normally, the name can also be found through $ENV_USERNAME, but that depends on the current environment - the function always retrieves the actual value.

See also PUTENV.


13.10.52: GETVALUE (get value of variable in a STRICT environment)


GetValue(expression)

This is a convenience function. When the STRICT_CHECK is on for variables, every reference to a variable that might not exist has to be carefully checked for existence using the TYPEOF function, like so:


   IF TypeOf(SomeVar) != "UNKNOWN" && $SomeVar == "Some VALUE"...

To prevent this complexity, the GetValue function returns the value of an expression with the strictness disabled. This can be used to refer to members of an array or hash that has not been initialized, simple variables, complex expressions, etc. Non-existent variables are treated as empty strings.
When used in a numeric context, they are treated as having a value of zero.
A "bare word" as part of the expression is treated as a reference to a variable inside a GetValue (see IdentifierAs).

So now you can write:


   IF GetValue(SomeVar) == "Some VALUE"...

Which is equivalent to:


   IF GetValue($SomeVar) == "Some VALUE"...

When $SomeVar does not exist, GetValue returns an empty string without complaints. But this is also valid:


        GetValue($var1 == "" ? $var2 : $var3 + $Hash{$key})

This will evaluate without complaints even when none of the symbols actually exist.

See also TYPEOF, NAMEOF and STRICT_CHECK.


13.10.53: HOLDSESSION (block session)


HOLDSESSION(0)  # Release session
HOLDSESSION(1)  # Block session
HOLDSESSION(2)  # Query status

Sometimes, a script wants to make sure nothing changes on screen while a certain script runs. Blocking the session with HOLDSESSION makes sure that no further data is read from the host. It is functionally equivalent to the user pressing F1 (Hold screen), but the HOLDSESSION is quiet (no indicator in the status line, and the user cannot unblock the session by using the F1 key). It is the responsibility of the script to unblock the session.

When a scripts dies or forgets to unblock, the user can use F3-R to force a reset on the session. F3-C (cancel scripts) also unblocks the session.

When a session is blocked, typed data IS transmitted to the host, but received data is NOT read. Use KEYBOARD OFF to block the keyboard, too.

A parameter of 2 returns 0 (free) or 1 (blocked) and does not change the status. A parameter of 0 or 1 returns the PREVIOUS setting (0 or 1) and sets the requested status.
Any other parameter results in an error-message and a return status of 3.

It is a good idea to use WAITIDLE just before you issue a HOLDSESSION(1). That makes sure that all buffered data is processed and no unexpected effects occur.


13.10.54: HUMANSIZE (Translate number to readable human format)


res = HumanSize(number[,base])

This function converts any number over 4 digits in length to a human- readable format. For example. 10240 is converted to 10K, 12345678 is converted to 117.7M, etc. The suffix will be K(ilo), M(ega), G(iga), T(era), etc.
It will have at most one decimal. This function is used by the script to replace all big numbers on screen to a readable format.
It is provided as a built-in IVT function because the underlying floating point calculations are not easiliy achieved in the scripting language of IVT (which lacks floating point support).

The "base" parameter can be either 1000 or 1024, and the result will be true kilo/mega etc. bytes or their more decimal equivalent. It defaults to 1024.


13.10.55: IdentifierAs (How to interpret an identifier)


IdentifierAS("STRING" | "VARIABLE" | "ERROR" | "PARSE" | "STATUS")

This function changes the way the script parser and engine treat ambiguous identifiers in scripts. Consider code such as:


x = thing

This is ambiguous, since you can see it as either:


x = "thing"
x = $thing

I.e. a 5-character string with the value "thing", or a reference to the variable called "$thing". This goes for any identifier (a possible name of a variable). Traditionally, the old script language would treat such a case as if the identifier were surrounded by quotes, so it would treat everything as a string. The new script syntax allows much more complex constructions, and consequently, it is easier to make mistakes. Since the more powerful script engine makes it easy to change the runtime behavior, you can now choose how the ambiguity is resolved:

A nice feature is that every script can be written in an individual style. When a script calls IdentifierAs(), that script plus all the scripts that it CALLs will have the given setting.
The GLOBAL default can be changed by a STARTUP script, like so:


Script STARTUP
   IdentifierAs("PARSE")
END

This forces you to write all your scripts unambiguously, i.e. write quotes for strings and dollars for variables, everywhere.
This setting is preferred since it defines the scripts in a way that no matter what the current setting is, they always execute predictably.

Most of the scripts that are supplied as part of the IVT distribution are written unambiguously, so you can call them from your own scripts in your own style without needing to worry about changing their behavior.

The function returns the previous setting (STRING, VARIABLE, ERROR or PARSE).


13.10.56: IgnoreActivity (Suppress activity indicators)


IgnoreActivity(millisecs)

The activity indicators of IVT are a very powerful feature to show activity in other sessions. However, in rare cases, IVT itself will produce activity that should not result in moving the activity indicators.
An example of this is a timeout-preventer, which will regularly produce some activity on a session that looks like the user is typing a command, with the only purpose to defeat auto-logout. That activity will then normally show up on the tabs bar (or on the status bar). This function can suppress that.

This function must be called with a numeric parameter indicating the number of milliseconds that the activity is going to be ignored for.
Call with a value of zero to turn any current interval off.
The indicator will show no activity during the given period, not even when activity occurs due to unexpected causes. Handle with care.


13.10.57: INSTR (Find characters in a string)


INSTR(s1,s2)

Returns lowest offset in s1 of any s2-char. When no character from s2 is found in s1, the result is -1.
The first character in the string has offset 0.
The s2 string can contain multiple characters. The first occurrence of any of those characters is returned.

For example:


   WHILE (x = INSTR($s,"\n")) != -1
      # Process a line, $s contains a newline at pos $x
      Line = SUBSTR($s,0,$x)
      s = SUBSTR($s,$x + 1,-1)  # Rest of buffer, after newline
   NEXT

See also STRSTR, REGMATCH and SUBSTR.


13.10.58: IVTEVAL (Execute a dynamic script)


Res = IvtEval(string)

The return code of the IvtEval function is TRUE when the script contains no syntax errors, FALSE when errors were detected (and so the script was not executed).

This function interprets "string" as a (series of) statements, compiles them and executes them in the context of the current script.
This means you can generate bits of scripts dynamically and execute them.
The script has the same possibilities and limitations of normal scripts.
Every statement must be on a separate line, for example. The easiest way to generate properly formatted script lines is to PUSH them into an array and pass the result of a JOIN to IvtEval (see below).

Since the script runs in the context of the current script, you can access all local variables and assign values to such local variables as well. As an example:


   LOCAL Scr;
   PUSH(0,Scr,'FOR (i = 0; $i < 5; i++)');
   PUSH(0,Scr,'   echo "i = $i\n"');
   PUSH(0,Scr,'NEXT');

   IvtEval(Join("\n",Scr))
   ECHO "After Eval, i is $i\n"

The single-quoted strings are used to protect the '$' signs in the script.
The output of this fragment is:


   i = 0
   i = 1
   i = 2
   i = 3
   i = 4
   After Eval, i is 5

This example shows how the FOR loop (which in this case might just as well been written directly) executes and leaves the local variable "i" set to 5.

Perhaps a more useful example: Print all variables known by IVT, their scope and their content (plain variables, hashes and arrays):


   FORALL (VARIABLES x LIKE ".")
      IvtEval("y = CALL Dumper($x)")
      echo "$FORALLTYPE $y"
   NEXT

Here the IVTEVAL is essential: The dumper script uses the NAMEOF function to find both the name and the contents of all variables, and in this case the parameter "$x" is expanded, the result passed to IVTEVAL and so Dumper will show the real name of the actual variable.


13.10.59: IVTFUNCTION (Execute internal IVT function)


IVTFUNCTION("name"[,"WAIT"|"NOWAIT"][,param])

One of the shortcomings of IVT was the inability to program keys to perform a built-in function of IVT. Say you reprogram the F2 (Print screen) key to something else, then you could not program some other key to perform the Print Screen function. You were left without the possibility to print screens.

Similar restrictions were true for all other built-in functions of IVT tied to keys. In version 19.0, all such functions were made available for both the macro recorder and IVT scripts. Internally, there is a big table in IVT which associates a "name" with a call to a particular internal function.
When you program a key, it associates the key with the unique entry in the table. The IVTFUNCTION allows another way to use the table, namely by specifying the name of the function as parameter to the IVTFUNCTION call.
You must specify the name exactly as shown below.
The script call will cause the internal IVT function to be executed just as if the user had pressed the key normally associated with that function.

Later, functions were added to the table that are NOT normally associated with a key, but which allow you to assign keys to such functions yourself, or to have scripts that access these built-in functions. Examples are the setup panel functions, which can give users access to some setup-panels but not others.

Some functions can only be reached by pressing lots of keys, such as sending serial breaks, special TELNET commands, etc. All of those internal functions can now be associated with keys AND activated from a script.

The optional WAIT parameter can be used to make script synchronize with the functions that you start through IVTFUNCTION.
If, for example, you use:


   x = IVTFUNCTION("Setup (F3)")

then IVT will start the setup-panel but the IVTFUNCTION will return before that the setup-action has ended (actually, even before it started). This is fine if that script just wants to kick off that action and do nothing else, but suppose you would want the script to do something else afterwards.
In that case you want to wait until the actual internal IVT function has ended, and this is what you get when you use the WAIT clause. Example:


   Script SetupAndPrint
      LOCAL x

      x = IVTFUNCTION("Setup: Printers (only)","WAIT")
      IF $x != 0 THEN IVTFUNCTION("Print Screen (F2)")
   END
   KEYMACRO "P-Shift+Ctrl-Alt" ASYNCFUNCTION SetupAndPrint

This will program "P-Shift+Ctrl-Alt" (Ctrl-P) to call the script SetupAndPrint in asynchronous fashion. That script first allows the user to change printer setup (and ONLY the printer setup). When the user uses OK to leave that setup panel, the IVTFUNCTION returns TRUE (1). When the user aborts, it returns FALSE (0). This fact is used in the IF, when the user accepts the changes then a call is made to print the screen (presumably the user used setup to select a different printer or to change the settings of the current printer).
Since this 2nd call to IVTFUNCTION (to print the screen) is the last action in the script, there is no point in using WAIT here, so the script ends while the print screen function is just starting...

There is one problem with using KEYMACRO to execute an internal function of IVT, though. You can press such a macro key at any time, even when the function invoked by that macro is already active. For example, if you define Alt+s to be "Setup (F3)", pressing it twice would cause the internal "Setup" function to be called TWICE. This causes all sorts of problems, and will crash IVT.
Elaborate checks have been built into IVT to prevent this.
Every internal function listed below has up to 5 special characteristics.
These are:

The complete list of valid strings for "name" follows below. This list can be extended in future versions of IVT. Should you find that a function is missing, please mail to support@ivtssh.nl.
Make sure you spell them EXACTLY as shown (case insensitive). If you omit colons or spaces, the name won't match and you'll get an error.
Every function lists the indicators that apply to it, as explained above.


Address book 1,2                      Session: 9 (Alt+9) 1,3
Alert toggle (Alt+a) 2,3              Session: Create (Ctrl+PgUp) 1,4
Any key (Alt+0) 1,2                   Session: Create groups (F4-G) 1,4
Autolog Resume 2,3                    Session: Create+login (Ctrl+PgDn) 1,4
Autolog Suspend 2,3                   Session: Next (Ctrl-Curs-right) 1,3
Background indicator Blink 2,3        Session: Next Group (Alt+g) 1,3
Background indicator Green 2,3        Session: Prev (Ctrl-Curs-left) 1,3
Background indicator Red 2,3          Session: Toggle (Alt+t) 1,3
Buzzer 1,2,4                          Set history search pattern 2,3,5
Cancel Scripts (F3-C) 2,3             Setup (F3) 1,2
Clear History Buffer 2,3              Setup: Autolog (only) 1,2
Clear marked text 2,3                 Setup: Autolog 1,2
Clone session 2,3                     Setup: Colors (only) 1,2
Copy History to Clipboard 2,3         Setup: Colors 1,2
Copy Screen to Clipboard 2,3          Setup: Crypt files (only) 1,2
Copy String to Clipboard 2,3,5        Setup: Crypt files 1,2
Create group 3,5                      Setup: Font/Keyboard (only) 1,2
Cut (Alt+c) 1,2                       Setup: Font/Keyboard 1,2
Dump data (F3-D) 2,3,4                Setup: Highlight (only) 1,2
Edit Session Description 1,2          Setup: Highlight 1,2
Edit Session Group Code 1,2           Setup: Kerberos (only) 1,2
Edit Session Hostname 1,2             Setup: Kerberos 1,2
Edit Session Tab text 1,2             Setup: Macros (only) 1,2
End Session (Alt+F4) 1,3              Setup: Macros 1,2
File Transfer (Alt+F9) 1              Setup: More settings (only) 1,2
Flash Screen 1,2,4                    Setup: More settings 1,2
Flush Printer (F3-F) 2                Setup: Mouse (only) 1,2
Groupfix 1,2,3,5                      Setup: Mouse 1,2
Help (F4) 1,2                         Setup: Printers (only) 1,2
History Cursor Down (auto-end) 2      Setup: Printers 1,2
History Cursor Down 2                 Setup: Protocol (only) 1,2
History Cursor Up 2                   Setup: Protocol 1,2
History End 2                         Setup: Rlogin (only) 1,2
History Home 2                        Setup: Rlogin 1,2
History PageDown (auto-end) 2         Setup: Serial (only) 1,2
History PageDown 2                    Setup: Serial 1,2
History PageUp 2                      Setup: SSH (only) 1,2
History Quit (ESC) 2                  Setup: SSH Hostkey algo (only) 1,2
Hold Screen (F1) 2,3                  Setup: SSH Hostkey algo 1,2
Hold Screen (Query) 2,3               Setup: SSH Key Exchange (only) 1,2
Keyboard language 2,5                 Setup: SSH Key Exchange 1,2
Keypad: APPLICATION 2,3               Setup: SSH Port Forwarding (only) 1,2
Keypad: BLOCKED 2,3                   Setup: SSH Port Forwarding 1,2
Keypad: NUMERIC 2,3                   Setup: SSH 1,2
Kill all sessions but this 1,4        Setup: Tabs bar (only) 1,2
Kill all sessions, exit IVT 4         Setup: Tabs bar 1,2
Lock terminal (Alt+l) 1,2             Setup: Telnet (only) 1,2
Manage keymacros (F4-K) 1,2           Setup: Telnet 1,2
Manage scripts (F4-X) 1,2             Setup: VT220 settings (only) 1,2
Manage sessions (F4-S) 1,2            Setup: VT220 settings 1,2
Maximize window (Shift+Alt+m) 2,4     Setup: Windows (only) 1,2
Paste default (Alt+p) 2,3,4           Setup: Windows 1,2
Paste named (Shift+Alt+p) 2,3,4       Setup: ZMODEM (only) 1,2
Print Screen (F2) 1,2                 Setup: ZMODEM 1,2
Propagate settings 1,2                Show current cursor position 2
Reset terminal (F3-R) 1,2,3           Slow Down (Alt+s) 2,3
Restore config 2,3                    Speed Up (Alt+q) 2,3
Save History (Alt+s in history) 1,2   Splash screen 1,2
Screen Saver (Sh+Alt+s) 1             SSH: Start key exchange 1,2,3
Serial BREAK (Long) 2,3               Stop Pageant 2,3
Serial BREAK (Short) 2,3              Subshell (Ctrl+F6) 1
Serial preset 2,3,5                   Swap primary/alternate screen 2,3
Session: 1 (Alt+1) 1,3                Telnet: Force logoff 2,3
Session: 2 (Alt+2) 1,3                Telnet: Send Are You There 2,3
Session: 3 (Alt+3) 1,3                Telnet: Send BREAK 2,3
Session: 4 (Alt+4) 1,3                Telnet: Send Interrupt 2,3
Session: 5 (Alt+5) 1,3                Telnet: Show status 2,3
Session: 6 (Alt+6) 1,3                Telnet: Toggle Binary 2,3
Session: 7 (Alt+7) 1,3                Toggle FullScreen 2
Session: 8 (Alt+8) 1,3                Upgrade now 1,4

Note the special setup functions, which come in two tastes.
When a function like "Setup: Printers" is used, the function does what would normally happen when the user enters setup and clicks on the "Printers" button.
This allows the user to modify the printer settings, then click OK and that will return him to the main "Setup" panel. From there, other setup functions can be chosen, registry settings can be saved, deleted, etc. Total freedom.

When the "Setup: Printers (only)" is chosen, IVT starts JUST that single setup panel to control printing. When the user uses the OK button to exit that panel, IVT executes an "Apply" in the main setup (that panel never gets displayed itself). When the user uses the ESC key (or uses the CLOSE in the upper-right), IVT uses "Cancel" in the main panel, so all changes the user has made in the printer-setup panel are discarded.
By using KEYMACRO or IVTFUNCTION with one of these "only" functions, you can get very detailed control over what the user can (and cannot) access.

Note the "History" functions that come in two tastes, too (without and with the "auto-end"). When you use an "auto-end", IVT will quit the history pager and resume normal operations when scrolling hits the end of the history buffer (like would happen when you use the mouse-wheel). Without "auto-end", IVT will remain in history mode (like it would when you use the keyboard).
This allows you to simulate both mouse-wheel and keyboard actions in a script.

The IVTFUNCTION return value depends on the function being called.
When no WAIT is being used, there is no true result yet, so the result of the function is a simple TRUE (1).
When WAIT is used, most functions return TRUE, but some (like the "Setup...") return TRUE when the new setup was applied and FALSE (0) when it was cancelled.
A few others also return a "logical" result (true when OK, false otherwise).
When a function fails, $IVT_FUNC_ERRNO is set to indicate the reason for the failure.

Also note that sometimes an IVTFUNCTION simply does not apply. An example is an attempt to invoke "Setup: Printers (only)" while the printer is currently active. Normally, the setup panel would show a greyed-out "Printer setup" button and an enabled "FLUSH/Close printer" button. When IVT is asked through an IVTFUNCTION to start printer setup, the request is ignored and marked as failed. This can be confusing to a user, since the result is that sometimes the printer setup works, sometimes not, and there is no visible reason.
Be warned.

See also IVT_DIALOGSTATE which allows you to make certain parts of the IVT dialogs inaccessible or invisible to the user.
See also KEYMACRO and secure mode.


13.10.60: JOIN (Combine members of an array)

See hashes and arrays for a description of complex data structures in IVT.
This function works about the same as JOIN in Perl, it combines all the elements of an array by concatenating all values, separated by a given string.


Result = JOIN(string, array)

This function takes the name of an array (which can be part of a hash) and joins all members of the array with string being used as a separator.
The resulting string is returned as the result.

Example:


   PUSH(0,MyArray,"One", "Two", "Three");
   AllParts = JOIN(" - ", $MyArray)
   ECHO "$AllParts\n"

Will display:


   One - Two - Three

There is no limit to the number of elements that can be joined, or to the length of the separator or resulting string.
See also SPLIT.
See also ARRAYS, and FORALL VALUES.


13.10.61: KRB5_ENCRYPT (Manage Kerberos encryption)


KRB5_ENCRYPT("enable" ,cipher,["input"|"output"])
KRB5_ENCRYPT("disable",cipher,["input"|"output"])
KRB5_ENCRYPT("start"  ,["input"|"output"])
KRB5_ENCRYPT("stop"   ,["input"|"output"])
KRB5_ENCRYPT("query"  ,"input"|"output")
KRB5_ENCRYPT("debug"  ,"on"|"off")

This function controls the encryption of the session from a script.
When Kerberos authentication is used to establish a session, IVT will attempt to encrypt the session data by default (see the KRB5_AUTOENCRYPT and KRB5_AUTODECRYPT IVT.RC keywords to change these defaults).
Note that Kerberos will always authenticate securely, but ALLOWS the actual session (what you type and what the host returns) to be plain text.
The original reason for this was performance, but ony any post-1990's machine the performance delay caused by encryption will be negligible.

The KRB5_ENCRYPT function can be used to control and query the encryption status of the session. The following rules apply:

See also this setup screen, which gives an interactive way to change and query the encryption settings.
See "Kerberos" for general information on the Kerberos authentication scheme.
See "Kerberos encryption" for general information on encryption.
See also the KRB5, KRB5_DLL and KRB5_FORWARD options.


13.10.62: LEFTSTR (Left-hand part of a string)


LEFTSTR(SourceString,Len)

This function returns the leftmost Len characters of SourceString.
It is equivalent to:


Substr(SourceString,0,Len)

LEFT is an alias for LEFTSTR.
See also RIGHT, SUBSTR, LTRIM and RTRIM.


13.10.63: LENGTH (Length of a string)


LENGTH(stringexpression)

The result of this function is the length of its argument string expression.
This simply counts the number of bytes in the string, see also DISPLAYLENGTH.
For the empty string, 0 is returned.
Example:


   x = LENGTH("123456789")

will set the variable $x to 9.
See also SUBSTR.


13.10.64: LOWER (Translate string to lower case)


LOWER(stringexpression)

This function returns the lower case version of the string expression.
See also UPPER, SUBSTR, REPLACE and LENGTH.


13.10.65: LSEEK (Position in an open file)


LSEEK(Fdexpr,Offset,Whence)

This positions the current offset in the file identified by Fdexpr.
The file descriptor must have been obtained from a successful call to OPEN or CREAT.

The Whence parameter can take the following values:


0 - Offset is interpreted as an absolute offset.
1 - Offset is relative to the current position (positive or negative).
2 - Offset is relative to the end of the file.

So "LSEEK($Fd,0,2)" will position the file pointer at the end of the file, and "LSEEK($Fd,0,1)" will return the current position.

The lseek function returns the offset, in bytes, of the new position from the beginning of the file. A return value of -1 indicates an error, and $ERRNO is set to indicate the error.
Note that IVT uses 64-bit numbers internally, so it can handle large files.

See also EXISTS, RENAME, OPEN , WRITE and READLN.
See also UNLINK, MKDIR and RMDIR.


13.10.66: LTRIM/LTRIM/TRIM (Trim whitespace on left, right or both)


LTRIM(string)
RTRIM(string)
TRIM(string)

These functions trim whitespace from the left, right or both ends of a string.
LTRIM removes leading spaces and tabs from the left of a string.
RTRIM removes leading spaces and tabs from the right end of a string.
TRIM removes leading spaces and tabs from both ends.

They return the resulting string as a result.

See also UPPER, LOWER, and REPLACE.


13.10.67: MATCH (Wildcard string matching)


MATCH(pattern,string)

Note: See REGMATCH for a more powerful regular expression matcher.
This function is a very simple matcher retained for reasons of backward compatibility. New code should use REGMATCH.

This is a simple wildcard pattern matching function.
Definition of pattern syntax:

The function returns 1 for a successful match, 0 for an unsuccessful match, and < 0 for a syntax error in the pattern.

Note that these are not true regular Unix style expressions, but a lot simpler.
See REGMATCH for a full Perl compatible regular expression matcher.
For example:


   MATCH("a*b","XaYYb")

will NOT match, because the leading X in the string is not matched by the pattern. Every character in the string must be matched by part of the pattern for the MATCH to succeed! So:


   MATCH("*a*b","XaYYb")

DOES match.

See also REGMATCH, SUBSTR, INSTR and STRSTR.
See also HIGHLIGHT.
See also searching scroll back data.


13.10.68: MKDIR (Create a directory)


MKDIR(pathname[,DoPath])

This function calls the operating system version of the MKDIR system call.
It creates the directory specified by the pathname parameter.
The pathname can be specified either with forward or backward slashes.
Remember to double backslashes, since they are special.

If the function succeeds, the return value is 0. When it fails, the return code is set to -1 and the $ERRNO variable will contain an operating system error code.

When the optional boolean DoPath parameter is present and TRUE, all directories leading up to pathname are created automatically. For example, if you say:


MKDIR("c:/a/b/c/d",1)

IVT will first create a, a/b and a/b/c (when those directories do not exist yet), before actually using mkdir on a/b/c/d.

See also RMDIR, UNLINK and CREAT.
See also EXISTS, and STAT (to look at details).
See also FindFiles.


13.10.69: MYERRORCOUNT (Return number of errors so far)


MYERRORCOUNT(["GLOBAL"])

This function returns the number of error messages that have been issued for the current session (when no parameters are specified), or for IVT as a whole when the "GLOBAL" parameter is passed.
It can be used, for example, before and after a READRC call to determine if, and if so, how many, errors were issued as a result of reading that file.

In a startup script, it can be used to determine if there were any errors during startup.

Artificial errors caused by the ERROR() function are not counted.

See also ONERROR.


13.10.70: MYSESSID (Return unique ID for this session)


MYSESSID()

This function returns a unique number that identifies the current session.
No two sessions in a running IVT instance will ever have the same number, and the numbers are not re-used. As long as the session exists, all calls to MYSESSID will return the same value.
It is intended to be used by multiple THREADs and processes to make sure they work for different (or the same) session.

See also MYSESSNR() and FGSESSID().


13.10.71: MYSESSNR (Return session number of current session)


MYSESSNR()

This function returns the sequence number of the current session. This number can be used as argument to a SWITCHTO statement to switch between specific sessions under script control. For example:


   SWITCHTO MYSESSNR()

will force the session that executes this to the foreground.
See also GUI_ONTOP, which will do this for the entire IVT program.

The return value of MYSESSNR() can also be used to identify the session in complex scripts that communicate between sessions. However, the sequence number of a running script can change when the user re-orders sessions or when sessions are created or closed.
See also MYSESSID, for a session-id that is unique for a particular session.
See also NRSESSIONS().
See also FGSESSID().

See also KILL and TRAP, and $PID and $PPID.


13.10.72: MYPACKAGE (Return name of containing package)


Packagename = MyPackage()

If you have a function that is defined inside a PACKAGE, you can use this function to query the name of that package. This prevents you from having to hard-code the name of the package in various places, making a rename of a package easier.
When the caller is not part of a package, the empty string is returned.

See also READRC, which optionally allows reading files as part of the current package.
See also PACKAGE, PUBLIC, GPSET and LPSET.


13.10.73: NAMEOF (Determine real name of BYREFERENCE object)


NAMEOF(variable)

When you use a script that takes a BYREFERENCE parameter, it is sometimes useful to known the original name of the object that was passed. If you use the NAMEOF function on such an object, it will return that name.
In all other cases, it will return the name of the variable you pass as a parameter. There can be many levels of BYREFERENCE passing, the function will always return the name of the "real" object.

For an example, see the dumper script.
See also TYPEOF, GETVALUE and NAMEOF.


13.10.74: NRSESSIONS (Returns current number of sessions)


NRSESSIONS([options])

Options is an optional string containing one or more of:

This function returns the current number of IVT sessions. By default, it does NOT count sessions that are in an error state (Hit ESC to abort or enter to reconnect), so this number can differ from the number displayed in the status bar.
The DEAD option can be used to force counting dead sessions, too.

Also, by default, it counts ALL sessions in ALL application groups.
The GROUP option can be used to force it to count only sessions in the SAME group as the session invoking this function.

So, to summarize:

See also MYSESSNR() and MYSESSID().
See also FGSESSID().


13.10.75: OPEN (Open a file)


OPEN(file,omode[,createmode])

This function returns a file descriptor obtained from the operating system by opening the specified file for mode omode.
When a file needs to be created, it will use the optional createmode parameter, which defaults to 0666.
Valid omodes must be OR-ed together from the following values:


O_RDONLY       0x0000  Open for reading only
O_WRONLY       0x0001  Open for writing only
O_RDWR         0x0002  Open for reading and writing
O_APPEND       0x0008  Writes done at EOF

O_CREAT        0x0100  Create and open file
O_TRUNC        0x0200  Open and truncate
O_EXCL         0x0400  Open only if file doesn't already exist

Text files have <cr><lf> sequences translated to <lf> on read()'s, <lf> sequences translated to <cr><lf> on write()'s


O_TEXT         0x4000  File mode is text (translated)
O_BINARY       0x8000  File mode is binary (not translated)

O_NOINHERIT    0x0080  Child process doesn't inherit file
O_TEMPORARY    0x0040  File is deleted when last handle is closed
O_SHORT_LIVED  0x1000  Temporary storage file, try not to flush
O_SEQUENTIAL   0x0020  File access is primarily sequential
O_RANDOM       0x0010  File access is primarily random

IVT does not supply constants or variables with these names, so if you need a specific mode you will have to supply the correct value by passing the resulting hexadecimal value. For example:


   flags = 0x4000 | 0x1000 | 0x100 | 0x0040 | 0x0002;
   fd = OPEN("somefile",$flags,0666)

will set the flags O_TEXT, O_SHORT_LIVED, O_CREAT, O_TEMPORARY and O_RDWR, so this will open somefile in text mode, create it when it does not exist and mark it as a short lived, temporary file.
If you want to open files for sharing between processes, see SOPEN.

The result is -1 when there are problems opening the file, the IVT variable $ERRNO is set to indicate the reason for failure.

The descriptor can be used in subsequent READLN, WRITE and CLOSE statements to read/write data to and from the file.
See also CREAT, SOPEN and EXISTS.
See also MKDIR, RMDIR, UNLINK and FindFiles.
See the modem dialer for an example of using these statements.


13.10.76: PLAYSOUND (Plays a sound file)


PLAYSOUND(filename)

This function will invoke the Windows PlaySound function with the given filename. First, any playing sound is aborted, then the playing is started in the background (the function returns immediately).
When the filename does not exist, IVT will search the PATH for it. When still not found, it will try with MEDIA/ in front, and .WAV appended and combinations of those.

The return value is 0 (FALSE) when the file does not exist, otherwise it is the return value of the actual PlaySound function (normally 1 on success).

Media files like you can find in the MEDIA directory on windows systems can be played via this function (.WAV files, usually). It requires a soundcard, or Windows will make the "default sound" (ring the bell).

Example:


PLAYSOUND("ding")

NOTE: If you specify a ".WAV" file, make sure that the file is actually in the proper format. The default sound recorder of Windows suggests that you can rename a ".m4a" file into ".wav", but the Playsound function of Windows then refuses to play it (and plays the default "ding" sound instead).
Use a different sound-recorder that produces properly formatted WAV file.

See also BELL WAV, which plays a sound when a bell character is received.
See also the ESC<space>n escape sequence to play sound files.


13.10.77: PUTENV (Creates, modifies, or removes environment variables)


PUTENV(envstring [,...])

The PUTENV function adds new environment variables or modifies the values of existing environment variables. Environment variables define the environment in which a process executes (for example, the default search path for programs to be started is stored in the environment variable PATH).

The envstring arguments must be strings of the form varname=string, where varname is the name of the environment variable to be added or modified and string is the variable's value.
If varname is already part of the environment, its value is replaced by string; otherwise, the new varname variable and its string value are added to the environment. You can remove a variable from the environment by specifying an empty string, in other words, by specifying only varname=.

PUTENV can affect only the environment that is local to the current IVT process; you cannot use it to modify the command-level environment.
When the current IVT process terminates, the environment reverts to the level of the calling process (in most cases, the operating-system level).

However, the modified environment will be passed to new processes created by SYSTEM, POPEN, COMMANDOUTPUT or SHELLEXECUTE.

Note: You can retrieve the value of an environment variable by simply using $ENV_NAME (where NAME is the name of the variable you want).


13.10.78: POP (Remove members from an array)

This is loosely based on the Perl function with the same name, see ARRAYS.


x = POP(front,arrayname)

This function removes an element from an array. Perl has a SHIFT and a POP, where SHIFT removes items from the left and POP from the right (if you view an array as a list, running from left-to-right).
IVT has just a POP, where the first argument is a boolean that indicates if you want to remove the item from the front (true) or back (false).
Also, the IVT pop can only remove one item at a time.
Example:


   PUSH(0,MyArray,"Item 1", "Item 2", "Item 3")
   ECHO POP(0,MyArray) "\n";   # Prints Item 3
   ECHO POP(1,MyArray) "\n";   # Prints Item 1
   ECHO POP(1,MyArray) "\n";   # Prints Item 2

So POP removes one item from either the front or the back.
There is no limit to the number of items you can store in an array.
Every item can be an any length. Arrays can be simple plain arrays (like the one in the example above), or can be part of a multi-dimensional hash, see the example at PUSH for more details.

See also HASHES and ARRAYS.
See also POP.
See also JOIN.
See also TYPEOF, GETVALUE and NAMEOF.
See also DELHASH.


13.10.79: POPEN/PCLOSE: Process pipes


fd = POPEN(command,mode)
exitcode = PCLOSE(fd)

POPEN Creates a pipe and executes a command so you can read data that is displayed by the command, or send data to that command.
POPEN returns a file descriptor associated with one end of the created pipe.
The other end of the pipe is associated with the spawned command's standard input or standard output. The function returns -1 on an error.
NOTE: The POPEN2 function offers more control than the fairly simple POPEN.

The character string mode specifies the type of access requested, as follows.

The PCLOSE function returns the exit status of the terminating command process, or –1 if an error occurs.

Example:


Script DoDirlist
   LOCAL exstat, fd, Ln, Cnt;

   fd = POPEN("dir /s", "rt")
   IF $fd < 0 THEN POPUP "Failure" : RETURN

   Cnt = 0
   WHILE (Ln = READLN($fd)) != ""
      Ln = Substitute($Ln,"[\r\n]","","g");
      ECHO "Line $Cnt: $Ln\n"
      Cnt = $Cnt + 1
   NEXT
   if ((exstat = PCLOSE($fd)) != 0) THEN ECHO "Exit code is $exstat\n"
END

This runs a command and reads the output produced by the command into IVT strings. It tests whether the command ran successfully.
NOTE: This particular example does a DIR command, if you want to actually find which files you have, use the FINDFILES function (the DIR is just a very simple example command).

See also POPEN2, OPEN, CLOSE, WRITE and READLN.
See also PCLOSE.


13.10.80: POPEN2 (Control stdin and stdout of a process)


result = POPEN2(in,out,mode,directory,command[,optarg])

POPEN2 is a more complex version of POPEN.
It is intended to be used to control both the input and the output of another process. The parameters are:

The result is TRUE when the program is started successfully, or FALSE when there is a problem.

When started successfully, you can now write data to the standard input of the program using $in, or read data from its standard output using $out.
Make sure you do both simultaneously: If you write too much to stdin and forget to read stdout, the started process will block when its output pipe is full, the write your are doing to stdin will block because THAT pipe is full, and the whole thing will deadlock.

Use READBYTE to read from stdout of the process without blocking.
Use READLN to read complete lines.
Use PCLOSE on $in to close the stdin of the process and wait for it to finish and return the exit status of the process.

Example:


   nm = "powershell.exe";
   nm = Replace(Concat(FindPath($nm),"$nm"),"/","\\");
   fl = "$ENV_HOMEPATH\\myscript.ps1";
   x = popen2(in,ot,"HIDE","",$nm,"\"$nm\" -file $fl");
   IF (!$x) THEN POPUP "Cannot start $fl PowerShell script";

This searches for the powershell executable on your system, makes it a full pathname with just backslashes, and passes it a command line with "-file" and the name of some PowerShell script to execute.

It can then do a "ReadByte($ot)" to read bytes from the stdout of the script, or "Write($in,$data)" to write data to the stdin of the powershell script.

See also POPEN, PCLOSE, READLN, READBYTE.
See also SHELLEXECUTE.
Se also COMMANDOUTPUT, and SYSTEM.


13.10.81: PROMPT (Ask a question on the bottom line)


PROMPT("Prompt string",Length,Echo)

Note: Deprecated. Try DIALOG instead.

This function asks a question on the bottom line of the screen.
The first argument is the prompt string (a question).
The second is the maximum length of the answer (shown as dots in a prompt).
The third argument is a Boolean. When 1 (TRUE), echoing is turned on, when FALSE (0), typed characters are displayed as asterisks.
When the length of the prompt plus the length of the answer is wider than the screen, a warning is displayed and the prompt function aborts.

The result is the response typed by the user, or the empty string when the user typed ESC (or just a return).

During the PROMPT call, the user can still switch between sessions. The prompt call will be resumed when the user switches back.

Example:


User = PROMPT("User name",10,1)
Pswd = PROMPT("Password: ",8,0)

Asks for a user name and a password. The latter is not echoed.
See also ONKEY and READLN.
The new DIALOG system is a much better way to interact with the user!


13.10.82: PUSH (Add members to an array)

This is loosely based on the Perl function with the same name, see ARRAYS.


PUSH(front,arrayname,elements,...)

The function always returns TRUE.

This function adds element(s) to an array. Perl has UNSHIFT and PUSH, where UNSHIFT adds items to the left and PUSH to the right (if you view an array as a list, running from left-to-right).
IVT has just a PUSH, where the first argument is a boolean that indicates if you want to add the items to the front (true) or back (false).

Example:


   PUSH(0,MyArray,"Item 1", "Item 2", "Item 3")   # Push at back
   PUSH(0,MyArray,"Item 4")                       # Push at back
   ECHO POP(0,MyArray) "\n";   # Prints Item 4
   ECHO POP(1,MyArray) "\n";   # Prints Item 1
   ECHO POP(1,MyArray) "\n";   # Prints Item 2

The PUSH function can be passed an arbitrary long list of items to be added to the array. When you push at the front, the list of arguments is processed from left to right, every item is added to the front. So if you do:


   PUSH(1,MyArray,1,2,3)

You get:


   $MyArray[0] == 3
   $MyArray[1] == 2
   $MyArray[2] == 1

And if you do:


   PUSH(0,MyArray,1,2,3)

You get:


   $MyArray[0] == 1
   $MyArray[1] == 2
   $MyArray[2] == 3

The example above shows a simple array. You can also use PUSH on the last level of a (multidimensional hash), like so:


   PUSH(0,MyHash{1}{1},"Argument 1", "Item 2", 3);
   PUSH(0,MyHash{1}{2},"This", "That", "and", "the", "other")

So a single hash can contain an arbitrary number of arrays.

Use the TYPEOF function to determine the type of data stored under a specific key. For example "Typeof(MyHash{1}{1})" would return "ARRAY" in the example above.

The POP function is the only way to delete individual items from an array.
The DELHASH function can be used to delete entire arrays (and whole sections of a hash) in one operation.

The $# operator can be used to count the number of elements stored in a hash at a given location.
So "$#MyHash{1}{2}" would yield 5 in the exmple above.

See also HASHES and ARRAYS.
See also POP.
See also JOIN.
See also TYPEOF, GETVALUE and NAMEOF.
See also DELHASH.


13.10.83: QUERYSCRIPT (Test if a script is active)


QUERYSCRIPT(ScriptName[,Package][,"GLOBAL"|"SESSION"]])

This query can be used to find out if a particular script is currently executing within IVT.
ScriptName is the name of the script.
Package specifies the package to look in. If you do not specify a package, all running scripts are searched regardless of the package they may be part of.
The third (optional) parameter specifies whether to look in all sessions (GLOBAL) or just the current one (SESSION). The default is SESSION.

The function returns true (1) or false (0).
True means that at the moment of the query, the specified script is indeed running, false means it is not.
Note that this can change at any time, as scripts can end and start at any time. To determine if a script exists in the first place, use DEFINED.

Example:


   IF QueryScript("DoBroadcast","","GLOBAL") \
   THEN ECHO "The key broadcast script is running\n"

See also QuerySetting.
See also ONCONNECT, PRECONNECT.
See also WAIT_ONCONNECT() and PRECONNECT.
See also ONSWITCHTO and ONSWITCHFROM.
See also THREAD.
See also DEFINED.


13.10.84: QUERYSETTING (Obtain current configuration values)


QUERYSETTING("feature name"[,"GLOBAL|SESSION"][,Target])

This function allows a script to find the current setting of almost all IVT configurable items. Simply specify the name of the IVT.RC feature as a string, and the function returns the current setting for the current session.
When you use the GLOBAL qualifier, the function returns the global default (used to initialise new sessions) rather than the value for the current session.
For example:


   x = QUERYSETTING("TELNET_TTYPE")
   x = QUERYSETTING("CLICK")

The first will return a string with the current setting for TELNET_TTYPE.
The second will return TRUE (1) or FALSE (0) depending on the current setting of the key click feature.
When the setting you query is a complex item (like "PRINTERS"), you have to specify the name of a target hash in which the results are stored.
Every item that requires such a target hash is explicitly documented below.


   x = QUERYSETTING("BITMODE")

will return an integer with a value of either 7 or 8 to indicate the mode the current session is operating in. As a last example:


   x = QUERYSETTING("BITMODE","GLOBAL|SESSION"[,Target])

will return the DEFAULT setting for the BITMODE feature (the one used for new sessions). Without the GLOBAL keyword, the function returns the setting for the current session, and that value can have been changed by the user, the host or a script. You can also specify "SESSION" explicitly.
Some queries return additional details in the Target variable, which will be taken as a reference to a local hash.

NOTE: The QUERYSETTING returns the internal representation of a feature! For all strings and on/off type settings this is straightforward (0 for OFF and 1 for ON). For some (like BITMODE) you get the logical decimal value of the feature. But the BACKSPACE setting will, for example, return 0 for the BACKSPACE setting and 1 for the DELETE setting because that happens to be the internal representation for the setting. This is particularly non-intuitive for color settings. If you have used a statement like:

   COLORS Black BrightWhite

IVT will translate this in a number used for the foreground color (black, being color number 0) and a number used or the background (15, being bright white).
The QUERYSETTING function does not understand "COLORS", you have to query the foreground or background colors explicitly:


   fg = QUERYSETTING("COLORS (fg)")     # Foreground color
   bg = QUERYSETTING("COLORS (bg)")     # Background color

Similar things apply to the other color settings.
Also, some settings cannot currently be queried (like MENU, which modifies the menu bar). Watch this place for future updates and a complete list of all valid feature names.

The current list of all non-straightforward queries is:

See also IVTFUNCTION which allows you to call internal IVT functions.


13.10.85: RAND (Generate a random value)


RAND()

The RAND function generates a random integer value, range from 0 to 2^63.
See also SRAND.

As an example, consider a small script that sends data to a host with the timing characteristics of a human user (with random variations in typing speed, with a random delay from 0 to 300 Ms):


   Script SendAsHuman Str
      HIDE
      FOR (i = 0; $i < Length($Str); i = $i + 1)
         SEND SUBSTR($Str,$i,1)
         USLEEP (RAND() % 300)
      NEXT
   End

   Script DoATest
      DESCR "Test of SendAsHuman"
      Call SendAsHuman("This is simulated input from a user\n")
   End


13.10.86: READBYTE (read a single byte from a file)


ReadByte(fd)

This function reads a single byte from the file referenced by the specified fd (as obtained from an OPEN, POPEN or POPEN2 call).
The function READLN is the normal way to read data from a file, but it keeps reading until it finds a newline character.
If you want to control an external process (like started with a POPEN or POPEN2 call), you may want to do a more flexible interpretation of the output of a process. Reading character-by-character with READBYTE may be required.

When you read from a pipe and the process is still running but is not currently producing output, READBYTE will return an empty string and $ERRNO will be set to the special string "BLOCKING".
When you read from a pipe and there is no more data (end-of-file on the pipe), this is indicated by an empty string and $ERRNO set to "EOF".
In all other cases, a string of 1 byte is returned.

See also READLN, POPEN and POPEN2.


13.10.87: READLN (Read a line from a file)


READLN(fd)

This function reads a line from the file referenced by the specified fd (as obtained from a previous OPEN call), reads a line from it and returns this string as its result. A carriage return is stripped from the resulting string, but a new line is returned as part of the string.
Note: fd can also come from a POPEN or POPEN2 call.

When EOF is read, the resulting string will be empty.
Example: read a file:


   fd = Open("somefile",0);
   WHILE (Ln = ReadLn($fd)) != ""
      echo "Line: $Ln"
   NEXT
   Close($fd)

See also READBYTE.
See also OPEN, WRITE, CLOSE, CREAT and EXISTS.
See also POPEN and POPEN2.
See also UNLINK, MKDIR and RMDIR.
See the modem dialer for an example of using these statements.


13.10.88: READHASH (Read a hash from a file)


ReadHash($Hash, filedescriptor)

This function can restore a hash saved to a file using the SaveHash function.
The file descriptor must be the result of a previous OPEN call where a file is opened for read-access (in binary mode).
It returns the number of bytes that were read from the file, (a number larger than zero), or -1 in case of problems.

This function allows you to save/restore arbitrary big and complex hashes to a file. The same file can hold multiple hashes, as long as you save and restore in the proper order. The current position of the file you use must be at the start of a hash previously saved by SAVEHASH.

See also SAVEHASH.
See also TYPEOF, GETVALUE, NAMEOF, PUSH, POP, JOIN.


13.10.89: READRC (Read an IVT.RC file)


READRC(fileexpr[,"STARTUP"][,"PACKAGE" | "NO_PACKAGE"])

This function reads the specified file as an IVT.RC file. This can be used to read a generated script into memory. For example, the password learning system generates a script that knows about user-id's and passwords. When a new combination is added, it generates a new file, uses DELSCRIPT to delete the old definition of the script from memory, then uses READRC to read the new script.

You can also use this to create very flexible IVT configurations.
For example, the projects system uses this to read project files.

The function returns TRUE (1) when it was successful, FALSE (0) when not.

An optional parameter can be the string "STARTUP". When passed, the specified file is read in IVT startup mode, so, for example, scripts called "startup" will be executed during the READRC processing.
When the "STARTUP" is omitted, the file is read normally.

Another optional parameter is "PACKAGE". When passed, all scripts read in the specified file will become part of the same PACKAGE as the calling function.
The default is to NOT read the file as part of the containing package, which can also be specified using the explicit NO_PACKAGE.

When the file contains syntax errors, this can be determined by looking at the value of MyErrorCount() before and after doing the ReadRC.

See also OPEN and READLN.


13.10.90: REGCREATEKEY (Create a key in the Windows registry)


RegCreateKey(Hive,Key)

This is the IVT wrapper around the standard Windows function RegCreateKey.
It creates a key in the Windows registry, a sort of directory that can hold other keys and values. The Hive must be one of the valid hive names, see here for a list.

The key can be any valid name.
The function returns 0 upon success, non-zero on errors.

See also RegDeleteKey, RegSetValueStr and RegSetValueDword, See also $IVT_INFO{'REGISTRY_BASE'}.


13.10.91: REGDELETEKEY (Delete a value from Windows registry)


RegDeleteKey(Hive,Key)

This function is the IVT wrapper around the standard Windows call RegDeleteKey.
It deletes a subkey and its values. Note that key names are not case sensitive.

For a list of valid Hive values, see here.
The function returns 0 upon success, and a Windows error code when there is a problem.

See also RegDeleteValue and RegQueryEnum.
See also $IVT_INFO{'REGISTRY_BASE'}.


13.10.92: REGDELETEVALUE (Delete a value from Windows registry)


RegDeleteValue(Hive,Key,Name)

This function is the IVT wrapper around the standard Windows call RegDeleteKeyValue. It deletes a registry subkey value.

For a list of valid Hive values, see here.
The Key must specify the value of an existing registry key, the Name must specify the name of an existing value within the given Key.
The function returns 0 upon success, and a Windows error code when there is a problem.

See also RegDeleteKey and RegQueryEnum.
See also $IVT_INFO{'REGISTRY_BASE'}.


13.10.93: REGMATCH (Match regular expressions)


RegMatch(Pattern,String[,options][,HashName[,Scope]])

This function does Perl style regular expression matching.
If you do not know what regular expressions are, (much) more information is available on the web, a good starting point might be:

And many other places.

This function can be used in three ways:

1) Simple true/false matching (pass a Pattern and a String and any
   required options).
   When the String matches the Pattern the function returns TRUE.
   When the String does not match, it returns FALSE.
   When the Pattern is invalid, an error is printed and the function returns
   a value of -1.
   Example:


   IF (RegMatch('^\d+$',$SomeVar) THEN ECHO "$SomeVar is a number\n";


   Note: When the pattern is a constant, the IVT script engine will compile
   the pattern once and re-use it when doing multiple matches (like in a loop).
   That will greatly speed up execution, so use single quotes whenever
   possible. When there is a dollar in a double-quoted string, the worst is
   assumed and the pattern is not treated as a constant.

2) Syntax checking of a pattern.
   This function normally throws an error when you pass it an invalid
   regular expression. That will trigger the error handling of IVT, show
   ugly messages on screen, and so on. When the pattern is typed by the user,
   for example in an IVT script, that may be a bit noisy.
   Instead, use the option "CHECK". In that case, the function will compile
   the pattern (and ignore the String). When valid, it will return an empty
   string, when invalid, it will return the error message as produced by the
   Perl regular expression library. That way, the script can provide custom
   error handling.

3) Pattern extraction. This is used to extract parts of String into a
   hash. Pass a HashName and, optionally, a Scope (defaults to
   LOCAL but can be GLOBAL or SESSION, too).
   Mark the parts you want to extract with parentheses, as many as required up
   to a maximum of 20. The function returns the number of matching parts.
   Example:


   Pat = 'Error ([0-9]*) in line ([0-9]*)';
   Str = 'Error 988 in line 5678';
   # Extract the error number and line number
   x = RegMatch($Pat,$Str,"ICASE","Numbers","LOCAL");
   IF $x >= 1 THEN ECHO "Error code is $Numbers{'MATCH'}{1}{'TEXT'}\n"
   IF $x >= 2 THEN ECHO "Line number is $Numbers{'MATCH'}{2}{'TEXT'}\n"

   The matching is done with case sensitivity turned off (ICASE option).
   The matching bracketed parts are stored in the hash.
   In the example, the entire match (all of $Str) is stored in match 0.
   The substring parts are stored in match 1 - n.
   So, the first number 988 is assigned to $Numbers{'MATCH'}{'1'}{'TEXT'}.
   The 2nd number 5678 is assigned to $Numbers{'MATCH'}{'2'}{'TEXT'}.
   Other members of the hash receive the start- and end positions of the
   matching strings and substrings.
   For details, see the description of $HIGHMATCH, which is the most
   complex form of this hash.
   See also the 'Dumper' script, which can print out any hash or array
   so you can get see what is available in a particular case.
   Note: When REGMATCH fails, the hash is not created/filled.
   When REGMATCH succeeds, any existing hash is destroyed, re-created and
   filled with the results of the match.

NOTE: special characters in the pattern (such as backslash and $) must be protected from special treatment by IVT when inside a double-quoted string, so you must either escape them with a backslash or use single quotes instead of double quotes for the Pattern.

The options are specified as a string, with words separated by spaces.
All options are OFF by default. IVT understands the following options:


For a description of how the hash is filled, see $HIGHMATCH. Example:


   Pat = 'Error ([0-9]*) in line ([0-9]*)';
   Str = "Error 988 in line 5678";
   x = RegMatch($Pat,$Str,"ICASE","MyMatch")
   ECHO "Number of matches: $x\n"
   Call Dumper(\$MyMatch);

Will result in:


   Number of matches: 3
   {
       "MATCH" =>
       {
           "0" =>
           {
               "END" => "22",
               "START" => "0",
               "TEXT" => "Error 988 in line 5678",
           }
           "1" =>
           {
               "END" => "9",
               "START" => "6",
               "TEXT" => "988",
           }
           "2" =>
           {
               "END" => "22",
               "START" => "18",
               "TEXT" => "5678",
           }
       }
       "PATTERN" => "Error ([0-9]*) in line ([0-9]*)",
       "TEXT" => "Error 988 in line 5678",
   }

Careful study of the above will show the possibilities.

Perl regular expressions are described in detail on the official Perl website at http://perldoc.perl.org/perlre.html.

See also MATCH, SUBSTR and SPLIT.
See also HIGHLIGHT, which uses regular expressions do match strings appearing on the session screen and associate actions with such matches.
See also WAIT REGEXP, which allows waiting on data sent by the host.


13.10.94: REGQUERYENUM (Enumerate Windows registry keys)


RegQueryEnum(Hive,Key,BaseName[,Scope])

This function is the IVT wrapper around the standard windows functions RegEnumKeyEx and RegEnumValue.
It searches the Windows registry and returns a list of subkeys and value names that it finds there. For every item found, it returns the name and the type of the object. The Hive must specify one of the valid Windows hives, see here for a list.
The Key specifies a base key to open and enumerate.

Like more functions in IVT, this one has an old and a new interface:

The type of variables is LOCAL by default, but you can use the optional Scope parameter to specify GLOBAL or SESSION.

The RegQueryEnum function returns the number of items found.
The _TP_ (or TYPE) variables can have the following values:

Example:


   x = RegQueryEnum("HKEY_CURRENT_USER",'Software\BearStar\IVT',"List{}")
   ECHO "Number of items found: $x"
   FOR (i = 0; $i < $x; i++)
      ECHO $List{$i}{'NAME'} $List{$i}{'TYPE'} "\n"
   NEXT

This lists all the subkeys and value names of the given key.
The results are stored in LOCAL variables, see also CSET.
Note the single quotes for the key, prevents having to double backslashes.

See also RegQueryStr and RegQueryDword.
See also RegDeleteKey and RegDeleteValue.
See also $IVT_INFO{'REGISTRY_BASE'}.


13.10.95: REGQUERYDWORD (Query Windows registry for an integer)


RegQueryDword(Hive,Key,Name,VariableName[,Scope])

This function is the IVT wrapper around the standard windows function RegQueryValueEx. It retrieves a binary integer (DWORD) from the windows registry. The Hive must specify a valid windows hive, which is one of:

The "Key" must specify a valid key name in the given hive. The "Name" must specify the name of a valid subkey, or the empty string to retrieve the default value of the key.

When the specified value can be retrieved successfully, the resulting value is stored in the variable given by VariableName, and the function returns 0.
The scope of the variable defaults to LOCAL, but can be specified as GLOBAL or SESSION as well.
When there is a problem, the Windows error code is returned and the variable is not assigned.

Example:


   x = RegQueryDword("HKEY_LOCAL_MACHINE",  \
          "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", \
          "EnableICMPRedirect","ReDir","SESSION");
   IF $x == 0 THEN Echo "Value of EnableICMPRedirect is $ReDir\n"

The type (DWORD) must match the actual registry contents, or the function will fail.
See also RegQueryEnum to find the names and types.
See also RegQueryStr.
See also $IVT_INFO{'REGISTRY_BASE'}.


13.10.96: REGQUERYSTR (Query Windows registry for a string)


RegQueryStr(Hive,Key,Name,VariableName[,Scope])

See RegQueryDword for details.
This function retrieves a string instead of a DWORD.


  IF (x = RegQueryStr("HKEY_CURRENT_USER", \
                 "Software\\BearStar\\IVT\\CurVersion","","IvtVer")) \
  THEN ECHO "Current IVT version is $IvtVer\n" \
  ELSE ECHO "Key for IVT is missing?\n"

See also RegQueryEnum.
See also $IVT_INFO{'REGISTRY_BASE'}.


13.10.97: REGSETVALUEDWORD (Write an integer to the Windows registry)


RegSetValueDword(Hive,Key,Name,Value)

This function is the IVT wrapper around the standard windows function RegSetValueEx. It stores a binary integer (DWORD) into the windows registry. The Hive must specify a valid windows hive, see here.

The "Key" must specify a valid key name in the given hive.
The "Name" must specify the name of a valid subkey, or the empty string to set the default value of the key.

When the key can be created successfully, the given Value is converted to its integer value and stored.

The return value of the function is 0 on success, negative for invalid parameters and a positive Windows error number when there is a Windows problem.

See also RegQueryDword and RegSetValueStr.
See also $IVT_INFO{'REGISTRY_BASE'}.


13.10.98: REGSETVALUESTR (Write a string to the Windows registry)


RegSetValueStr(Hive,Key,Name,Value)

See RegSetValueDword for a description of parameters and return values.
This function stores a string instead of an integer, so Value can be any valid string.

See also RegQueryStr and RegSetValueDword.
See also $IVT_INFO{'REGISTRY_BASE'}.


13.10.99: RENAME (Rename a file or directory)


RENAME(oldfilename,newfilename)

This function simply calls the operating system RENAME function. It renames the file or directory specified by oldfilename into newfilename.
The return value is 0 when the call is successful, and nonzero when a problem occurred. The $ERRNO variable is set to indicate the problem.


13.10.100: REMOVE (Remove a file)


REMOVE(pathname)

This removes a file, it is a synonym for UNLINK, see there for details.
See also RMDIR and FindFiles.


13.10.101: RESOLVENAME (Translate name into an IP address)


RESOLVENAME(name)

NOTE: This function is superseded by RESOLVENAME_EX, but retained for backward compatibility.

This function translates the hostname given as name into an IP-address, using the same routine that IVT uses to be able to connect to a host.
This can be configured using the RESOLVE statement.

This function can take a fairly long time to complete, depending on the availability of the name servers involved, and is therefore not allowed to be used in complex expressions (only a simple var = ResolveName($name)).

When a name cannot be resolved because it does not exist, the function returns the string UNKNOWN.
When a name cannot be resolved because name servers did not respond within the given time it returns the string TIMEOUT.
In other cases it returns the dotted-decimal IP-address for IPv4 hosts, or the numerical IPv6 address for v6 hosts. IPv6 addresses are enclosed in square brackets to make sure that they remain valid when you append a port number or service name to the result.

NOTE:
A limitation of this function is that it only resolves according to the type given by the current IPVERSION of IVT, and that it only returns the FIRST address that is found for the given host. The RESOLVENAME_EX addresses these limitations, new code should use that.

Example:


   Address = ResolveName("www.linux.org")
   ECHO "Linux lives at $Address\n"
   Address = ResolveName("www.linux.bad")
   ECHO "www.linux.bad = $Address\n"

Produces:


   Linux lives at 198.182.196.56
   www.linux.bad = UNKNOWN

Note: IVT uses a local cache to store previous results for a little while (15 seconds). This greatly reduces overhead when connecting a great many sessions to the same host but can give unexpected results if you are testing modifications to a name server. If you use RESOLVE_TRACE, IVT will display on-screen how the resolving process progresses and where results come from.

See also RESOLVE.
See also the $IVT_NETW_DOMAIN variable.
See also the DOMAIN statement.
See also the RESOLVENAME_EX statement.


13.10.102: RESOLVENAME_EX (Translate name into IP addresses)


n = RESOLVENAME_EX(name,IPtype,VarType,VarBase)

NOTE: This function supersedes RESOLVENAME, and should be used for new code. This function translates a hostname into one or more IP-addresses.

The function returns the number of names that were found (1 - n).
When the function fails, the return value is either:

This function improves over the older RESOLVENAME in the following ways:
1) You can specify which types of result you want. The IPtype can be:
   AUTO: Use system default.
   BOTH: Explicitly query both IPv6 and IPv4 addresses.
   IPV4: Only query for IPv4 addresses.
   IPV6: Only query for IPv6 addresses.
   See also IPVERSION.

2) A host can have multiple addresses, of various types. The older function
   only returns the first such address. The new function returns an array (with
   zero or more entries).

The VarType specifies the base type of the variables that are created by IVT to store the results in. It can be:

For more details, see variables explained.

The results can be returned in 2 ways:
1) The new way, specify a name ending in "[]", like "Result[]".
   The name is interpreted as an array name, and the result set is pushed
   into that array.

2) The old way.
   The VarBase specifies the base name of the created variables. The function
   creates variables names $VarBase_X, where X is a number ranging from 0 - n,
   when n is the number returned by the function.

Example:


   Cnt = ResolveName_Ex("www.xs4all.nl","BOTH","LOCAL","Result[]")
   ECHO "Result is $Cnt\n"
   IF $Cnt == "TIMEOUT" THEN RETURN
   IF $Cnt == "UNKNOWN" THEN RETURN
   FOR (i = 0; $i < $Cnt; i++)
      echo "Name $i = " $Result[$i] "\n"
   NEXT

Produces:


   Result is 2
   Name 0 = [2001:888:0:18::80]
   Name 1 = 194.109.6.92

This shows that the first address is op type IPv6, the second is IPv4.

See also RESOLVENAME for more details about resolving.
See also RESOLVE.
See also the $IVT_NETW_DOMAIN variable.
See also the DOMAIN statement.


13.10.103: REPLACE (Substitute occurrences of a string in a string)


REPLACE(source,original,replacement[,count])

This call replaces occurrences of the string original in source by the string replacement. It returns the resulting string.
When no count is specified, or the count is zero or negative, all occurrences are replaced. When count is a positive number, at most that many replacements are made.
This works properly even when replacement contains (part of) original.
When replacement is the empty string, the original part is removed.

Examples:


Replace("10.10.10.1","10.","127",1) -> "127.10.10.1"
Replace("aaaa","a","")              -> ""
Replace("aaaa","a","b",2)           -> "bbaa"

See also SUBSTITUTE, which works using regular expressions.
See also SUBSTR, LENGTH, REGMATCH, etc.


13.10.104: RIGHTSTR (Right-hand part of a string)


RIGHTSTR(SourceString,Len)

This function returns the rightmost Len characters of SourceString.
It is equivalent to:


Substr(SourceString,Length(SourceString) - Len,Len)

But is more convenient to use for complex expressions for SourceString.
RIGHT is an alias for RIGHTSTR.
See also LEFT, SUBSTR, LTRIM and RTRIM.


13.10.105: RMDIR (Remove a directory)


RMDIR(pathname)

This function calls the operating system version of the RMDIR system call.
It removes the directory specified by the pathname parameter.
If it succeeds, the return value is 0. When it fails, the return code is set to -1 and the $ERRNO variable will contain an operating system error code.
The directory must be empty and not in use for this to succeed.

See also MKDIR and UNLINK.


13.10.106: RUBOUT (Erase contents of variable at delete-time)


RUBOUT var ...

The RUBOUT statement accepts a list of variable names.
When the named variable already exists (as a parameter, local variable, hash, etc), it is now marked as a RUBOUT type of variable.
When it does not exist yet, it works the same as a LOCAL declaration and creates a new variable which is marked a RUBOUT type.

A RUBOUT variable differs only in what happens when the variable is deleted, like when it goes out of scope or is explicitly UNSET: The value is erased from memory so it cannot be found when a memory dump of the program is inspected (with a debugger). It is intended to be used for variables that contain secrets (passwords, keys, passphrases, etc). The idea is that such secrets should exist in memory as briefly as possible.

The auto-login and password learning system of IVT uses this for all variables that hold such information.


13.10.107: SAVEHASH (Save (parts of) a hash to a file)


SaveHash($Hash[{key}], filedescriptor)

This function can save (part of) a hash to a file. The data of the entire hash is stored in the file in a format that is understood by the ReadHash function.
These two functions can be used to save an (arbitrarily complex) hash to a file, with all subkeys and arrays and values they contain.

The file descriptor must be the result of a previous OPEN call where a file is opened for write-access (in binary mode).

Example:


   LOCAL fd;

   # Create a big hash with various stuff
   FOR (i = 0; $i < 100; i++)
      FOR (j = 0; $j < 100; i++)
         Hash{$i}{$j} = "I am string $i $j"
      NEXT
   NEXT
   PUSH(0,Hash{'array'},"One", "Two", "Three")

   fd = open("SomeFile",0x8101); # Open for output
   SaveHash($Hash,$fd); # Save whole hash
   SaveHash($Hash{50},$fd); # Save a part
   close($fd);

   fd = open("SomeFile",0x8100); # Open for input
   if (ReadHash($Hash1,$fd) > 0) THEN ECHO "Read 1 OK\n"
   if (ReadHash($Hash2,$fd) > 0) THEN ECHO "Read 2 OK\n"
   CLOSE($fd)
   ... Hash1 is now a copy of $Hash, $Hash2 is a copy of $Hash{50}

Not a very useful example, but it demonstrates the functions.

See also READHASH.
See also TYPEOF, GETVALUE, NAMEOF, PUSH, POP, JOIN.


13.10.108: SCREENATTR/SCREENTXT (Contents of screen buffer)


SCREENATTR(RowNumber,ColumnNumber[,length])
SCREENTXT (RowNumber,ColumnNumber[,length])

These functions return data from the current screen and scroll back history.
A positive RowNumber (1 - $ROWS) references the screen.
A negative RowNumber (-1 - ScrollBackLines()) references scroll back history.

SCREENATTR returns the character attributes from the screen buffer of the current session. SCREENTXT returns the characters from the screen.
Both functions take an optional length argument that defaults to 1.
Attributes are returned as 3 hexadecimal numbers, text as plain characters (a UTF-8 string).
NOTE: Regardless of the character set that is chosen for the current session, IVT will internally process everything as UTF-8. All possible characters can be represented using UTF-8, so this function will also return characters read from the screen in UTF-8. For "normal" English this is identical, but for line drawing characters, foreign characters and complex scripts (like Chinese) each character can take many bytes to represent in UTF-8, because each base character can be combined with a number of overstrike characters.

Attributes show the foreground and background colors, plus the special attributes such as blinking and underline. These are returned as two hex numbers separated by a space for every character cell.
The first hex number has the first 4 bits for the background color, the 2nd 4 bits for the foreground color.
The 2nd number is a 4-digit hex number where every bit has a special meaning:

The other bits are currently unused.
Note that a single cell can have many different bits set (like being a highlighted, marked, searched-for character).

The left upper corner of the screen has row and column number 1.
RowNumber zero is invalid (returns an empty string).
The size of the screen is found using the $ROWS and $COLS variables.

All this can be used by a script to inspect the current contents of the screen. For example:


   Line1 = SCREENTXT(1,1,$COLS)

returns the text of the first line on the screen.
To see if the string "FooBar" is anywhere on screen or in scroll back history, searching backward from the last line on screen into history:


   FOR (i = $ROWS; $i > -1 * ScrollBackLines(); i--)
      Ln = ScreenTxt($i,1,$COLS)
      IF StrStr("FooBar",$Ln) >= 0 THEN PopUp "Found on line $i"
   NEXT

When invalid parameters are passed (impossible row, column or length) an empty string is returned.

See also $ROWS, $COLS, CURSOR_ROW() and CURSOR_COL().
See also CAPTURE and ScrollBackLines().


13.10.109: SCROLLBACKLINES (Number of lines in scroll back buffer)


SCROLLBACKLINES()

This function returns the number of lines in the scroll back buffer of the current session. Returns zero when nothing is stored yet or when scroll back is disabled. The returned number can be used to access scroll back data using the SCREENTXT and SCREENATTR functions.


13.10.110: SETICON (Change icon for the session)


Handle = SETICON(file,index)
Handle = SETICON("DEFAULT",0)

This function allows you to change the icon for the current session. When you switch between sessions with different icons, IVT will correctly update its icon so this can be used as an extra indication of the (type of) session.
IVT normally assigns its default application icon to all new sessions.

The first parameter is the name of a file containing icons (an executable, a DLL file, or an .ICO file, and so on). The index parameter specifies which icon to retrieve from the file. IVT uses the Windows function ExtractIcon to do the actual work, and I quote from the manual page:

"Index specifies the zero-based index of the icon to retrieve. For example, if this value is 0, the function returns a handle to the first icon in the specified file. If this value is -1, the function returns the total number of icons in the specified file. If the file is an executable file or DLL, the return value is the number of RT_GROUP_ICON resources. If the file is an .ICO file, the return value is 1.

Windows 95/98, Windows NT 4.0, and Windows 2000 or later: If this value is a negative number not equal to -1, the function returns a handle to the icon in the specified file whose resource identifier is equal to the absolute value of index. For example, use -3 to extract the icon whose resource identifier is 3."

When a handle is retrieved successfully, that icon becomes associated with the current session. When a bad handle is retrieved, IVT falls back to its own default icon. You can also specify the word DEFAULT instead of a file name, in which case you force a fallback to the default IVT icon. Both the small icon (in the title bar and the taskbar) and the big icon (when you use ALT-TAB) are set by the SETICON function.

See also SETTABICON.


13.10.111: SETTABCOLORS (Set colors of the session Tab)


x = SetTabColors(Mode,Foreground[,Background])
x = SetTabColors()

This function sets or restores the colors of the current tab (so the script that uses this can only change the colors of the session it belongs to).
This can be used to make some special sessions stand out in some way, to draw attention to them, etc.

For a description of how colors can be specified, see COLOR_CURSOR. When the function is called with no parameters, all tab colors are restored to their defaults.

See also all these other colors settings.
See also SetTabText.


13.10.112: SETPAGERPOSITION (Activate pager in a given position)


SetPagerPosition(string)

The string argument must be obtained by a previous call to GetpagerPosition.
The function activates the history pager and positions it at the same place as was active when GetPagerPosition was called (when possible).

The history pager is a circular buffer, so it is possible the original data is lost. In that case, the function fails and returns -1.
On success, it returns 0.

For more details, see GetPagerPosition.
See also HISTORY.


13.10.113: SETTABTEXT (Set text in TAB for this session)


SetTabText(string)

When the TABSBAR is in use, every session gets a tab on the bar that identifies it. The text in the tab can be set explicitly by a script using this function.
You can put whatever you want in there to identify the session.
When this function is not used, the tab text defaults to $USER@$HOSTNAME, but other default settings are possible, see TABSBAR for details.

The function returns TRUE when successful, FALSE upon failure (e.g, when the tabs bar has been disabled).

By setting the empty string, a saved text is discarded and IVT resumes using the default. The text is silently truncated to a maximum of 256 characters.
Tabs are automatically sized to contain the text you specify. When you want to use long texts, you may want to enable MULTILINE tabs.
See also TABSBAR and GETTABTEXT.


13.10.114: SETTABICON (Set icon in TAB for this session)


SetTabIcon(filename,index[,filename2,index2])

The TABSBAR command allows you to configure a TABs bar which shows a tab for every active session. Each tab can contain a text and an optional icon.
Every session can have its own unique icon.

IVT can supply a default CLOSE icon, which can be used to force a close on that session. A script can supply another icon using a filename and an index in that file to identify the icon, see SetIcon for details, The return value of this function is the same as described there.

IVT highlights the CLOSE icon when the mouse hovers over it. This is done by alternating between 2 icons: the normal one and the highlighted one.
Similarly, you can specify 2 icons using SetTabIcon, the optional 2nd one is displayed when the mouse hovers over the icon position. If no 2nd icon is given, IVT simply always displays the single icon for that session.

When a script sets an icon, it should also use ONTABICON to identify a script to start running when the user clicks the icon (or nothing will happen, since IVT does not know the meaning of your icon).

When you use different icons for different sessions, you can use the QuerySetting function with an "ICONTAB" parameter to find the name(s) of the icon(s) set for the session.

CLOSE icons are on by default, use TABSBAR with the NOCLOSE_ICON option to turn them off.

See also SetTabText to set an script-supplied text in the tab.
Some common type of strings can be set using TABSBAR.

See also SETICON, to set the default IVT icon.


13.10.115: SHELLEXECUTE (Run a Windows command)


SHELLEXECUTE(Operation,File,Params,Dir,Options)

The SHELLEXECUTE function performs a given operation on a given file, using the function of the same name in the Windows API.

It has the following parameters:

Operation:
A string, referred to as a verb, which specifies the action to be performed.
The set of available verbs depends on the particular file or folder. Generally, the actions available from an object's shortcut menu are available verbs.
The following verbs are commonly used:

edit Launches an editor and opens the document for editing. If File is not a document file, the function will fail.
explore Explores the folder specified by File.
find Initiates a search starting from the specified directory.
open Opens the file specified by the File parameter. The file can be an executable file, a document file, or a folder.
print Prints the document file specified by File. If File is not a document file, the function will fail.

If you set this parameter to the empty string, for systems prior to Microsoft Windows 2000, the default verb is used if it is valid and available in the registry. If not, the "open" verb is used. For Windows 2000 and later systems, the default verb is used if available. If not, the "open" verb is used. If neither verb is available, the system uses the first verb listed in the registry.

File:
A string that specifies the file or object on which to execute the specified verb. To specify a Shell namespace object, pass the fully-qualified parse name (see GetFullName).
Note that not all verbs are supported on all objects. For example, not all document types support the "print" verb.

Params:
If the File parameter specifies an executable file, Params is a string that specifies the parameters to be passed to the application. The format of this string is determined by the verb that is to be invoked. If File specifies a document file, Params should be an empty string.

Dir:
The name of the initial directory. Can be the empty string.

Options:
Flags that specify how an application is to be displayed when it is opened. If File specifies a document file, the flag is simply passed to the associated application. It is up to the application to decide how to handle it.

Valid values are one or more of the following words:

HIDE Hides the window and activates another window.
MAXIMIZE Maximizes the specified window.
MINIMIZE Minimizes the specified window and activates the next top-level window in the z-order.
RESTORE Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position.
SHOW Activates the window and displays it in its current size and position.
SHOWDEFAULT System default.
SHOWMAXIMIZED Activates the window and displays it as a maximized window.
SHOWMINIMIZED Activates the window and displays it as a minimized window.
SHOWMINNOACTIVE Displays the window as a minimized window. The active window remains active.
SHOWNA Displays the window in its current state. The active window remains active.
SHOWNOACTIVATE Displays a window in its most recent size and position. The active window remains active.
SHOWNORMAL Activates and displays a window.
SYNC Start the application and waits for it to finish. Normally, the program is started in the background.
WAITINPUTIDLE Waits until the program is initialised.

The function returns an instance handle (a value > 32) when the command is successful, a value less than 32 on errors.
Usually, it seems to return "42" for success. IVT currently provides no means to decode the error code, so simply assume it failed when a value less or equal to 32 is returned.

This function allows you to perform Windows defined actions on objects, i.e. the action performed on an object when you double-click it. Using the Operation keyword allows you to do other actions than the default.

For example, to start the editor on a ".doc" file (usually Word):


   x = SHELLEXECUTE("open","Somefile.doc","","","SHOWNORMAL")

When the "Somefile.doc" file exists, Windows will perform the "open" action on it (which is the double-click action). Normally, this starts MS-Word.
To print the same file:


   x = SHELLEXECUTE("print","Somefile.doc","","","SHOWNORMAL")

To open a URL using your default browser:


   x = SHELLEXECUTE("open","http://www.google.com","","","SHOWNORMAL")

To start your default mail program with a few defaults:


   x = SHELLEXECUTE("open",Concat("mailto:ruurdb@wxs.nl?subject=IVT", \
                            "&body=IVT%20rocks!"),"","","SHOWNORMAL")

To start NOTEPAD on a simple file and wait for the user to close the application, use:


   x = SHELLEXECUTE("open","Somefile.txt","","","SHOWNORMAL SYNC")

To run a simple executable:


   SHELLEXECUTE("open","$ENV_WINDIR\\system32\\ping.exe", \
            "-n 1 rohan","","SHOWNORMAL")

Note, that in this case, a successful return code does NOT imply that the ping was OK. It merely means the function successfully started the PING command.
If you want the exit code of a started program, use the SYNC option, which waits for the command to finish and returns the exit code:


   SHELLEXECUTE("open","$ENV_WINDIR\\system32\\ping.exe", \
            "-n 1 rohan","","SHOWNORMAL SYNC")

However, Windows does not always create a new process for all verbs. For example, using "open" on a ".doc" file while Word is already running will not start Word, but open a second document within the running instance. In such cases, no process is created and so there is nothing to synchronize with.
SHELLEXECUTE will just return TRUE in such cases when the execution of the verb was successful, FALSE otherwise (with $ERRNO set to indicate the error).

See also the SYSTEM function, which offers a more low-level function to start a process. See also COMMANDOUTPUT, which allows you to capture data printed by a command to be captured into IVT variables.


13.10.116: SNDMSG (Sends a datagram to an IP-address and port)


SNDMSG(HOSTNM,PORTNR,Message-string)

Sends Message-string to the host (or decimal dotted IP-address) and specified port number. This uses UDP/IP (datagram) messages.

The function always returns success.


13.10.117: SOPEN (Shared open of a file)


SOPEN(file,omode,shflag[,openmode])

SOPEN is a SHARED open of a file, with an extra parameter shflag that specifies the way the file is shared between multiple processes. The standard OPEN call (in Unix) manages this with a single call. For unknown reasons, Windows uses a separate function for this.

See the OPEN function call for a list of valid omodes.
The shflag must be one of:


SH_DENYRW (0x10): Denies read and write access to file
SH_DENYWR (0x20): Denies write access to file
SH_DENYRD (0x30): Denies read access to file
SH_DENYNO (0x40): Permits read and write access

IVT does not define the symbolic constants, so you must use the explicit hexadecimal values (see example below).
Note that IVT supplies a default 0666 parameter when files are created, you optionally specify a fourth parameter to overrule this.
Note that the standard OPEN call defaults to SH_DENYRW, so SOPEN is required if you want to share a file for I/O between processes.

The result is -1 when there are problems opening the file, the IVT variable $ERRNO is set to indicate the reason for failure.

The descriptor can be used in subsequent READLN, WRITE and CLOSE statements to read/write data to and from the file.
See also CREAT, OPEN and EXISTS.
See also UNLINK, MKDIR and RMDIR.
Example:


   fd = SOPEN("somefile",2,0x40,0660)

Opens the file "somefile" for update (mode 2) and permits read/write access by other processes. The default 0666 openmode is changed to 0660.


13.10.118: SPLIT (split a string using separator characters)


SPLIT(SourceString,Separators,basename,type[,SkipMultiple])

This function splits SourceString into multiple strings, based on separators (like tabs or spaces). There are two ways to get the result:

The Separators expression must contain one or more characters that are used as field separators (for example a space and a TAB).

The Type variable must either be the string GLOBAL, SESSION or LOCAL and determines the scope of the variable(s) being created.

The SkipMultiple parameter can be either TRUE or FALSE (when not specified it defaults to FALSE) and determines what happens when the fields in SourceString are separated by multiple occurrences of Separators. When FALSE or omitted, multiple separators will be seen as empty fields. When given and TRUE, multiple separators are seen as a single separator. For example, words may be separated by multiple spaces and/or tabs, and fields by single tab characters.

The function returns the number of fields it has found.
Example:

New style interface:


   x = "1 22   33 44" # 22 and 33 have a space and a tab in between
   n = Split($x," \t","Flds[]","LOCAL",1)
   ECHO "0 = $Flds[0]\n"
   ECHO "1 = $Flds[1]\n"
   ECHO "2 = $Flds[2]\n"
   ECHO "3 = $Flds[3]\n"
   ECHO "4 = $Flds[4]\n"

Old style interface:


   x = "1 22   33 44" # 22 and 33 have a space and a tab in between
   n = Split($x," \t","Flds","LOCAL",1)
   ECHO "0 = $Flds_0\n"
   ECHO "1 = $Flds_1\n"
   ECHO "2 = $Flds_2\n"
   ECHO "3 = $Flds_3\n"
   ECHO "4 = $Flds_4\n"

This will produce identical output in both cases and be like:


0 = 1
1 = 22
2 = 33
3 = 44
4 =

Whereas:


n = Split($x," \t","Flds","LOCAL")

Produces:


0 = 1
1 = 22
2 =
3 =
4 = 33

In the first example, the multiple spaces and tabs are skipped.
In the second example, they result in multiple (empty) fields.

A common way to parse an unknown number of fields is:


   Split($Something," ","Flds[]","LOCAL",1)
   FORALL (VALUES Val Flds)
      ... $Val is now the i-th word from $Something...
   NEXT

See also SUBSTR, INSTR, REGMATCH and STRSTR.


13.10.119: SPRINTF (Format a string)


SPRINTF("Format expression",string-to-format)

This simply calls the C-runtime function "sprintf", which prints to a string.
Note that the standard function allows you to format multiple strings in a single call BUT IVT DOES NOT SUPPORT THIS! Only ONE string argument is supported. If you pass the wrong type of format string, you will CRASH IVT and lose all current sessions!

Having said that, you can use SPRINTF to format strings like so:


   SPRINTF("Value: %-20.20s: ",$SomeString)

This will format "$SomeString" in a left-adjusted, space-filled field of 20 characters, followed by a colon, and preceded by "Value:".

See the SPRINTF documentation of C for more details, for example by searching MSDN for "sprintf". As a simple example, the C function allows things like:


   printf("This %s two %s and a number: %d\n","is","strings",100);

And this would print:


   This is two strings and a number: 100

IVT does not support the variable number of arguments that this requires!

IVT will do a simple scan of the format string. When you are using a numeric format, the numeric value of the argument will be passed.
When you use a string format, the string value will be passed. So,


   x = SPRINTF("%04d","10")

Will produce "0010" (four long, zero-filled decimal value of the string, even though the argument is a quoted string).

When you need more multiple arguments to be formatted, CONCAT can be used to concatenate multiple SPRINTF results, like, for example, so:


   x = Concat(SPRINTF("%04d-",$Year), \
              SPRINTF("%02d-",$Month), \
              SPRINTF("%02d", $Day))


To format a typical YYYY-MM-DD date string.

See also ECHO and ECHO_LIT and VTECHO..


13.10.120: SQRT (Square root)


SQRT(number)

This function takes a numeric argument and returns the square root.
Since IVT does not support floating point numbers, this gives the INTEGER result of the square root (64-bit arithmetic).


13.10.121: STAT (Status/attributes of a file)


STAT(Filename,Base,Type)

This function uses the STAT(2) operating system call to query the attributes of the given Filename. This function has two ways of returning the results:

The Type determines the scope of the generated variable(s):

The function creates the following variables:

The function returns 0 on success and -1 on errors (in which case the $ERRNO variable is set to indicate the error).

Example (new):


IF STAT("$IVTDIR/ivt.exe","IvtDetails{}","LOCAL") == 0 \
THEN ECHO "The IVT executable is" $IvtDetails{'SIZE'} "bytes in size\n" \
ELSE ECHO "Cannot get status for IVT: error is $ERRNO\n"

Example (old):


IF STAT("$IVTDIR/ivt.exe","IvtDetails","LOCAL") == 0 \
THEN ECHO "The IVT executable is $IvtDetails_SIZE bytes in size\n" \
ELSE ECHO "Cannot get status for IVT: error is $ERRNO\n"

Note that the reference to the hash cannot be used inside a string, so the ECHO in the first (new-style) example must use extra arguments.

See also OPEN and FindFiles.
See also hashes and arrays.


13.10.122: SUBSTITUTE (regular expression based string replacement)


SUBSTITUTE(inputstring,pattern,replacement,options)

This function uses the Perl based regular expression engine to perform string substitution "Perl-style". See HIGHLIGHT for a primer on regular expressions.


The function returns the result of the replacement. Example:


   x = Substitute($x,'[ \t]+$','');


This removes all trailing spaces and tabs from $x.


   x = Substitute($x,'(\w+),\s+?(\w+)$','$2,$1',"i");


This swaps the first two words before and after the first comma in $x.
This match is case insensitive.

One more:


   x = Substitute($x,'([@%$])','\\$1','g');


This finds all @, % and $ characters in string $x and prepends them with a backslash.

See also REPLACE to replace simple strings.
See also REGMATCH to just match strings without replacements.
See also HIGHLIGHT to highlight regexps on screen.
See also WAIT REGEXP to wait for data from the host based on regexp.


13.10.123: SUBSTR (Take part of a string)


SUBSTR(inputstring,startoffset,length)

This function can be used to extract part of a string.
The inputstring specifies the source string to be operated upon.
The startoffset is the starting place in inputstring. A value of 0 denotes the start of the string.
The length parameter says how many characters are to be taken from inputstring.

Illegal values for startoffset and length are silently adjusted to sane values.

A negative length is taken to mean the maximum string length.

The result of the function is the substring, which can be empty.
Examples:


   Part = SUBSTR("abcdefg",0,1)   # Part is "a"
   Part = SUBSTR("abcdefg",3,2)   # Part is "de"
   Part = SUBSTR("abcdefg",1,-1)  # Part is "bcdefg"
   Part = SUBSTR("abcdefg",10,1)  # Part is ""

See also LEFT and RIGHT.
See also STRSTR, INSTR, UPPER, LOWER and LENGTH, and REGMATCH.


13.10.124: SRAND (Seed the random number generator)


SRAND(seed)

The srand function sets the starting point for generating a series of pseudorandom integers. To re-initialise the generator, use 1 as the seed argument. Any other value for seed sets the generator to a random starting point. The RAND function retrieves the pseudorandom numbers that are generated.
A given seed results in a fixed sequence of generated "random" numbers.

The value returned by TIME("MILLISECS") is a good value to use if you want unpredictable numbers, optionally modified by other unpredictable things such as the current seconds, hours, directory, user ID, environment strings, and other stuff with high entropy.

The SRAND function always returns zero.


13.10.125: STRICMP (Case insensitive string compare)


STRICMP(arg1,arg2)

This function does a case insensitive string compare of the 2 arguments.
It returns 0 when both arguments compare as equal.
A value less than zero is returned when arg2 < then arg2; A value greater than zero is returned when arg2 > then arg2;

It is more efficient to use this than to use either LOWER or UPPER on both arguments of a normal compare.

See also REGMATCH, SUBSTR, STRSTR and INSTR.


13.10.126: STRPTIME (Convert data/time string to numbers)


STRPTIME(InputString,Format,Destination[,Type])

This function converts an input string that contains some form of date and/or time (as decribed by the Format string) and converts it to numbers giving year, month, day, hour, minute, seconds, etc.
The output is stored in the Destination hash. The type of that hash is LOCAL by default, but can also be specified using Tp as 'SESSION' or 'GLOBAL'.
The output hash will contain the result in the following members:

The function returns 0 (false) when there is a problem, 1 upon success. A description of the Format string can be found on the internet, the strptime is a standard implementation of that function.

Example:


   if (strptime("2023/03/14 15:50:20","%Y/%m/%d %T","Hash","SESSION")) then {
      x = Call Dumper($Hash);
      echo "$x"
   }


Would produce:


   Hash = {
       'EPOCH' => '1678805420',
       'HOUR' => '15',
       'ISDST' => '0',
       'MDAY' => '14',
       'MIN' => '50',
       'MONTH' => '3',
       'SEC' => '20',
       'WDAY' => '1',
       'YDAY' => '72',
       'YEAR' => '2023',
   }

See also TIME.


13.10.127: STRSTR (Find a string in another string)


STRSTR(substring,targetstring)

This function looks for substring in targetstring and returns the offset of the start of that string when found, and -1 if the substring is not found in targetstring (see C-function of the same name).
For example:


   STRSTR("abc","xxxabcdefxxx")         returns 3
   STRSTR("abc","abcabc")               returns 0
   STRSTR("abc","abdxabd")              returns -1

See also SUBSTR. STRSTR is often used in conjunction with a CAPTURE statement. For example:


   CAPTURE LoginSequence
   WAIT "ogin:"
   SEND "$USER\r"
   WAIT "assword:"
   SEND "$PASSWORD\r"
   CALL WaitPrompt
   CAPTURE off
   if STRSTR("You have mail",$LoginSequence) == -1 THEN RETURN
   SEND "mailx\r"               # Start Unix mail program

This sequence uses the CAPTURE statement to capture all output that is produced during login into a variable. A Unix host will usually print the message "You have mail" when you have unread mail. When this string is detected among all other output, the login-script automatically starts the Unix mail program.

See also SUBSTR, INSTR and REGMATCH.


13.10.128: SYSTEM (Run a command on the PC)


SYSTEM("host command")

This function can be used to run any operating system command as a sub-process of IVT. The contents of "host command" is passed to the command processor of the PC that IVT runs on. The result is the value returned by the command processor. Note that this can take a long time to run, and the call to SYSTEM will not return until the command finishes. This can block ALL of IVT, all sessions!
Also note, that in spite of this, it is not considered a blocking command and thus can be used anywhere, anytime, even in STARTUP scripts. So, handle with care...

If you want to start a command without waiting for it, and want to pass arguments that contain spaces, do something like:


   Word = "c:\\Program Files\\Microsoft Office\\Office\\Winword.exe"
   File = "c:\\Documents and Settings\\RBeerstra\\My Documents\\x.doc"
   SYSTEM("START \"Word\" /B \"$Word\" \"$File\"")

The Windows START command takes a window title (Word), the /B will not create a new window, the backslashes and quotes are required because the other arguments contain spaces. The example fires up Word on the specified file.
Note: The newer ShellExecute is a lot more convenient for this task.

The START command does not wait for Word to finish (leave /B out if you want to wait for the command to finish, or add a /WAIT parameter).

The function returns, according to the Windows documentation, the value returned by the command processor (CMD.exe in Windows NT). The command processor returns the exit status of the program you start, but Windows programs are not exactly careful in returning meaningful exit codes. For example, the following does NOT work:


   x = SYSTEM("ping -n 1 some_host")

One might expect that PING would show the success of the operation in the exit state (as it does on Unix), but the Windows PING.EXE always returns zero. So, the function DOES return the exit code of the started program, but it is not always meaningful.

If you want to examine the output of the program, you will have to redirect the output to a file, then read the file (see OPEN, READLN and CLOSE).

See also SHELLEXECUTE, which is a better way to start Windows programs.
See also COMMANDOUTPUT, which is an easier way to capture output from a windows program into IVT variables.


13.10.129: THREAD (Start an asynchronous thread)


Pid = THREAD ScriptName([parameters]...)

IVT supports the concurrent execution of multiple SCRIPTs in a single session.
This means, for example, that multiple WAIT statements can execute simultaneously on a single session. All those WAIT statements will parse the same data. TIMEOUTS, SLEEPs and USLEEPs are all designed such that they do not block other threads or other scripts.
A "normal" CALL to a script is synchronous, if you want to create a new thread, all you have to do is to use THREAD instead of CALL.

You can pass values BYVALUE or BYREFERENCE and so on, with the only limitation that you cannot pass a LOCAL value BYREFERENCE to a thread (because that data can cease to exist when the local value goes out of scope). Session and global data is okay.

The return value of the THREAD function is the PID (Process ID) of the newly created thread (or -1 when something fails). This PID can be used as a parameter to a WAITTHREAD call if you want to wait for a specific thread to exit. For example:


   ...
   IGNCHILDREN on
   Pid1 = THREAD WaitMail()
   Pid2 = THREAD WaitDown()
   # Execution continues normally
   ...

Script WaitMail
   HIDDEN
   SECRET
   WAIT "You have mail"
   ...
   # Do something with the knowledge that the user received new mail
END

Script WaitDown
   HIDDEN
   SECRET
   WAIT "System is going down"
   # Do something with the knowledge that the system is going down
END

This will start two threads. All data received on the session is continually inspected for "You have mail" and "System is going down".
The efficiency of IVT is such that this will hardly cause a notable difference in speed.
Note: This example is not terribly realistic, as a single WAIT can also wait for multiple different strings. It is for demonstration purposes only.

The WAITTHREAD can be used to wait for the termination of a thread. Just like in Unix, a process (thread) cannot die completely until its termination code has been received by its parent. If the parent wants to start threads and forget about them (it does not intend to do a WAITTHREAD for them), it should issue an IGNCHILDREN (ignore children) before it creates new threads with FORK or THREAD.

You can use DETACH to create scripts that no longer belong to a specific session, but perform some continuous task not related to a particular session.

If the parent (the scripts that creates a THREAD) has died (or returned normally), any orphaned threads will be cleaned up by IVT when they terminate.
Their return values, if any, are discarded.

See also the example at $WAITPID.
See also DETACH.


13.10.130: TIME (Get current date/time in various formats)


TIME()
TIME("MILLISECS")
TIME("DATE",seconds,"format string")

This function simply returns the number of seconds since 1970 (standard Unix time format) when invoked with zero parameters.

When the MILLISECS qualifier is used, the number of milliseconds that have elapsed since the system started is returned. This can be used to time things in scripts.

When the DATE qualifier is used, the next argument must be a numeric value specifying a number of seconds since 1970. The format string will format this date/time into any required format.
The format string can contain any text (which is copied to output) and special conversion characters which are introduced by a %-sign (see below for examples). The following conversion characters are recognized:


%m - Month (01 - 12)
%d - Day (01 - 31)
%y - YY (00 - 99)
%Y - YYYY (1900 - 2038)
%D - MM/DD/YY
%H - Hour (00 - 24)
%M - Minute (00 - 60)
%S - Seconds (00 - 60)
%T - HH:MM:SS
%j - Day number in year (000 - 365)
%w - Day number in week (0 - 6, 0 = Sunday)
%a - Day name (Sun, Mon...)
%h - Month name (Jan, Feb..)
%r - HH:MM:SS [AM|PM]
%A - CTIME format (example "Sun Sep 09 19:58:22 2018")

Because the DATE format accepts any valid input parameter, date calculation becomes possible, as in:


   now      = TIME()
   tomorrow = $now + (24 * 3600)
   ECHO "Now      is" TIME("DATE",$now,     "%A or %m/%d/%Y day %j\n")
   ECHO "Tomorrow is" TIME("DATE",$tomorrow,"%A or %m/%d/%Y day %j\n")

When run, this produces:


   Now      is Sun Sep  9 19:59:40 2018 or 09/09/2018 day 251
   Tomorrow is Mon Sep 10 19:59:40 2018 or 09/10/2018 day 252

By playing with the value added or subtracted to the current date, it is possible to obtain any representation of any past or future date (within the limitations of the operating system).


13.10.131: TOASCII (Translate from numeric to ASCII)


TOASCII(number)

This function will generate a string of one byte long that contains the ASCII character specified by number.
See also FROMASCII.


13.10.132: TOTRAY (Minimize IVT to tray)


x = ToTray(OnOff, [tiptext][,balloontext])

This function can be used to minimize IVT, hide the button on the taskbar, and add a (small) icon to the notification area (also known as "the tray area").
This moves the IVT application out of the way as much as possible.
When OnOff is TRUE (ON), IVT minimizes and moves itself to the tray.
The tiptext and balloontext are used to attach messages to the tray icon.
When OnOff is FALSE (0), any existing tray icon is removed and IVT restores itself to normal operation. In this case, tiptext and balloontext are ignored and can be omitted.

The return code reflects the success of the operation: on versions of Windows that do not support the required functions, ToTray returns FALSE.

This function is intended to be used by a script that has arranged (for example) a number of SSH tunnels, port forwarders or other services that no longer require human interaction: it just needs to continue to run.
Such an instance of IVT only clutters up the screen and taskbar of Windows.
By default, newer versions of Windows will also hide the mini-icon in the notification area. To restore IVT visibility, the icon in the tray must be clicked either left or right. There is currently no other functionality for the tray icon.

The optional tiptext will appear when the user hovers the mouse over the icon.
The option "balloontext" will appear as a text balloon for a number of seconds to let the user know what happened. The balloon will disappear after a number of seconds, or when the user acknowledges it by clicking on it.

The menu bar of the IVT has an item in the "Extra" menu called "minimize to tray" that is equivalent to:


x = ToTray(1,"Click to restore", \
               "IVT is minimized to tray, click to restore")

See also WIN_MINIMIZE, WIN_MAXIMIZE, WIN_SHOW and FULLSCREEN.


13.10.133: TYPEOF (Determine type of a variable or part of a hash)


Result = TypeOf(object)

This function returns the type of the object passed as a parameter.
It will return a string that is one of:

That gives the type of the object you pass. This function is intended to be used in combination with hashes and arrays.
A hash can have multiple dimensions, each dimension can store a SCALAR value (a plain string or number), be the key to a further dimension ("HASH") or can be the key to a list of values ("ARRAY").
When the given key does not exist, "UNKNOWN" is returned.
Time for an example:


   MyHash{'one'}{'one'} = "1/1"
   MyHash{'one'}{'two'} = "1/2"
   MyHash{'two'}        = "Just 2"
   PUSH(0,MyHash{'three'},"3/1", "3/2", "Something Else")

This creates a hash with various objects on various levels. The TYPEOF will return:


   Typeof($MyHash{'one'})         => "HASH"
   Typeof($MyHash{'one'}{'one'})  => "SCALAR"
   Typeof($MyHash{'two')          => "SCALAR"
   Typeof($MyHash{'three')        => "ARRAY"
   Typeof($MyHash{'four')         => "UNKNOWN"

Using this function allows you to write scripts that take arbitrary complex hashes and process them in a generic way.
See the Dumper script for an example.

If you need to know the type of an object of which you do not know the name in advance, you need to use IvtEval, to make an indirect call to TypeOf.
For example:


   FORALL (Variables Nm LIKE ".")
      IvtEval("Tp = TypeOf($Nm)");
      IF ($Tp != "SCALAR") THEN {
         IvtEval("x = Call Dumper(\$$Nm);");
         ECHO_LIT "$FORALLTYPE $Tp $x";
      } ELSE {
         x = Expand("\$$Nm");
         ECHO_LIT "$FORALLTYPE Variable $Nm = $x\n"
      }

Would be a simple way to dump all variables to the screen.
A plain "TypeOf" of "$Nm" would tell you "Nm" was a scalar...

See also HASHES and ARRAYS.
See also NAMEOF and GETVALUE.


13.10.134: UNLINK (Remove a file)


UNLINK(filename)

This function removes the specified file (expression). It sets $ERRNO.
When the remove is successful, it returns TRUE.
In case you wonder about the name, UNLINK is the name of the (Unix) system call that removes an object...

See also REMOVE, which is supplied as an easier to remember alias.
See also RMDIR, to remove an (empty) directory.
See FINDFILES to find objects in a directory.


13.10.135: UPPER (Translate to upper case)


UPPER(string)

The result of this function is the uppercase version of string.
See also LOWER. Can be used to build case-insensitive IF statements.
See also STRICMP.


13.10.136: VARDEF (Test if a variable exists yes/no)


VARDEF(variablename)

This function is passed the name of a variable. It returns TRUE (1) when a variable with that name exists, and FALSE (0) if it does not.
This can be very useful when the difference between an empty variable and a non-existent variable matters.

All existing variables can be enumerated using the FORALL loop. That also gives you the type of variable (global, session or local).

See also STRICT_CHECK VARIABLES which can be used to turn references to undefined variables into errors.
See also DEFINED, which does the same for functions.
See also EXISTS, which does the same for files.
See also TYPEOF, which tells you what kind of variable it is.


13.10.137: VLINES (Query/change VERTICAL_LINES on session)


VLINES("QUERY"|"ON"|"OFF")

This function queries or changes the current setting for VERTICAL_LINEs.
The VERTICAL_LINE statement allows you to define lines that are on the screen all the time to indicate a particular position (such a column 80) on wide screens. Once defined, they will appear on all sessions. Sometimes, depending on what you use the session for, they are just in the way, and you'd rather have them turned off temporarily.
The 'Extra' menu bar menu will allow you to turn them on and off manually as desired. If you know beforehand that you will not want them for a particular session, you can also turn them on or off under script control.

The QUERY parameter will return 1 when VERTICAL_LINEs are defined and visible, 0 otherwise.
The ON and OFF will function only when lines are defined (and return TRUE (1)), and will return FALSE (0) when no lines are defined.

See also QUERYSETTING.


13.10.138: WAIT_ONCONNECT (Wait for an ONCONNECT to finish)


x = WAIT_ONCONNECT(scriptname[[,package][,"NOWAIT"]])

ONCONNECT is a great way to start a script to configure a session for a specific purpose, based on anything a script can figure out, or do.
When you have multiple ONCONNECT scripts, IVT will start them simultaneously, so all of them are running in parallel, and this can give conflicts.
For example, one common script is SetUnixEnv, which configures a Unix shell to have decent erase and line-kill characters, VI settings and so on.
Another ONCONNECT like AutoPrompt wants to configure the shell prompt.
There can be other scripts that want to start certain programs from the shell prompt.

The trouble with this is that there is no easy way to make sure all this happens in the right order. First you want the decent environment, THEN you want to configure the prompt, THEN you want to start the programs. If the order is wrong, actions don't happen or cause problems because they happen at the wrong time.

Without WAIT_ONCONNECT there is no easy way to synchronize the actions of ONCONNECT scripts. The SetUnixEnv does not know (or care) about the other scripts, so it does not advertise its existence or the fact that it is ready in any way.
By setting variables in one script and testing those elsewhere may work, until the configuration changes, some ONCONNECT script is no longer used, and others wait for completion of something that is not going to happen anymore.
Messy.

This is what WAIT_ONCONNECT is for: It returns TRUE when scriptname is ready, or never existed in the first place, so it gives a reliable way to find out if a particular ONCONNECT script is ready.

When a session is created and all ONCONNECT scripts are started, IVT creates a list for that session, with all running ONCONNECT scripts. Each entry in the list has a "ready" indicator. When a script ends, its indicator is set.

If you specify a package parameter (the name of a PACKAGE), only ONCONNECT scripts that are part of the given package are checked. If you do NOT specify a package (or use the empty string), only the name of the script itself is used (so you do not need to know the name of the package the script is a part of).
An empty package string is required if you want to pass NOWAIT and no package.

If you call the WAIT_ONCONNECT function in your ONCONNECT script, it will return 1 when it cannot find a matching entry in the list at all (so there was no ONCONNECT script started with that name on that particular session).
It will return 2 when the name exists in the list and the "Ready" indicator is set (the script has run and is done).
When the script exists and is still running, the function will normally block, waiting for that script to finish.
When you pass a third parameter with the value 'NOWAIT', the function will not block but return 0 (FALSE) instead. When the script has finished, the function will return 2.

Example:


   WAIT_ONCONNECT("SetUnixEnv");

Will block until the SetUnixEnv script is ready (or never existed in the first place on the current session for whatever reason).

See also ONCONNECT.
See also QueryScript which does similar things for normal scripts.


13.10.139: WAITTHREAD (Wait for a thread to exit)


ReturnValue = WAITTHREAD([pid])

Wait for the specified thread-id to exit. Return value of this function is the exit status of that thread. If no PID is specified, this will wait for ANY child (of the currently executing script).

The process (or thread) ID is returned by the FORK and THREAD functions.
If there are no (more) children that can be waited for, the function returns a value of -1 immediately.
When an IGNCHILDEN on was in effect when the child was created, it will not be noticed by a WAITTHREAD.

The PID of the process that ended is stored in $WAITPID (which is the only way to find out WHICH process ended if you are waiting on multiple PIDs).

Notice that one session CAN wait on a thread created by ANOTHER session if it somehow knows the PID of the process (a GLOBAL variable, for example).
PID's are globally unique in IVT. A WAITTHREAD without parameters only detects threads created by the CURRENT session, of course.


13.10.140: WRITE (Write to a file)


WRITE(Fdexpr,String)

This writes the data in String to the file identified by Fdexpr.
The FD (file descriptor) must have been obtained from a valid OPEN, CREAT or SOPEN function. The function returns the number of characters successfully written. It returns -1 and sets $ERRNO in case of trouble.

See also EXISTS, RENAME, OPEN , LSEEK and READLN.
See also UNLINK, MKDIR and RMDIR.


13.10.141: WINDOW_ATTR (Query attributes of a WINDOW)


WINDOW_ATTR(name,attr)

A text popup can be created using the WINDOW statement. These can be given a title, color, position, text and so on. Sometimes it can be convenient to query certain attributes of these windows for use in a script (for example in combination with MOUSE_KEYLOC when you click on a window).

The name argument must be the name of a valid WINDOW (a string).
The attr argument (also a string) must be one of:

ROW     - Returns the row number of the current top line of the window.
COL     - Returns the column number of the current left border of the window.
HEIGHT  - Returns the height in lines of the window (includes borders).
WIDTH   - Returns the width of the window in characters (includes borders).
VISIBLE - Returns TRUE (1) when the window is visible, FALSE (0) when hidden.

When an invalid window or attribute name is given, the function returns -1.

Example:


  Col = WINDOW_ATTR("MY_WIN","COL")
  Row = WINDOW_ATTR("MY_WIN","ROW")

See also WINDOW, CURSOR_COL, CURSOR_ROW and MOUSE_KEY.


13.10.142: WINEXISTS (Test status of a WINDOW handle)


WINEXISTS(name[,IgnoreTimeout])

When windows are created and destroyed with the WINDOW statement, it is sometimes convenient to test whether a specific window exists or not.
This function returns TRUE (1) when the specified window handle exists, FALSE (0) when it does not.

The IgnoreTimeout is a boolean value that determines how a window that has a timeout set is treated. Since the window will be destroyed after the timeout has expired, it can be argued that it exists no longer (you can create a new window with the same name),
Since it is currently displayed, it can be argued that it DOES exist.
When IgnoreTimeout is TRUE, a window in such a state yields TRUE.
When IgnoreTimeout is FALSE, a window in such a state yields FALSE.

Example:


   WINDOW MyWin
   x = WINEXISTS("MyWin")       # Returns TRUE (1)
   WINDOW MyWin KILL
   x = WINEXISTS("MyWin")       # Returns FALSE (0)


14: X/Y/Zmodem file transfer

IVT supports file transfer by means of the XMODEM, YMODEM and ZMODEM file transfer protocols. The first two are rather old, but ZMODEM is based on X/Y modem and available on a wide variety of platforms.
New in 16.4 is the option to transfer a file in plain ASCII mode, which just sends out the file as fast as it can as if it were typed by the user.

Files can be transferred over any IVT built-in protocol (even TELNET and RLOGIN, though you will usually have FTP or shared disks in a networking environment as a better way of sharing files).

Originally, X/Y/Zmodem was introduced after adding serial line support to IVT, because, in that case, it is a very necessary feature to have.

IVT supports auto-recognition of a ZMODEM file transfer. If you use the sz/rz tools commonly available on Unix platforms, IVT will start the receive automatically in case of a 'sz', and prompt you for a file in the case of 'rz'. When you want to transfer files using X/Ymodem, you type ALT+F9 to get to the file-transfer screen of IVT (or use the 'Sessions' menu on the menu bar).

First, you have to choose a protocol and a direction to do the transfer in.
When the protocol supports the transmission of filenames, you will not be prompted for a filename (Y/Z modem) when RECEIVING files.
Clicking on CANCEL will abort the procedure (which sometimes implies that a CANcel sequence is transmitted to the remote end), clicking on ABORT will ALWAYS explicitly send a CANcel to the remote end.

For XMODEM, you are prompted for a local filename to store received files.
You are always prompted for filenames to SEND. You can use wildcards in the names of files to send. Also, IVT will first look in the DOWNLOAD directory to find files to send. When zero matches are found, it will interpret the typed name as a full path name and try again. This allows you to specify a download directory that is used as an exchange area for both sending and receiving files.

The progress screen will show some statistics on ongoing transfers.
Especially important is the speed (characters per second) in relation to the size of the file. IVT calculates a "Time remaining" based on this.

When the transfer finishes, the BELL is sounded and you have to use ESC to return to the session screen.
Of course, IVT handles file transfers asynchronously. So while a file is being transferred, you can use session management keys to switch to other sessions, create new ones, etc.
An ESC can be typed to abort the transfer prematurely.

If, for example, you type:


   $ sz MyBigFile

everything should start automatically.
Files are received into the DOWNLOAD directory. Files can be sent from any directory, too.
When you type:


   $ rz

You will be prompted for a name. Whatever file is transferred will be stored in the current directory on Unix, since IVT does not send the full pathname of the file.
Make sure the receiving end is ready to receive a file. For a plain ASCII transfer, you would (on Unix) typically do something like:


   $ x=`stty -g`; stty -echo tabs -opost -icrnl; cat - > file; stty $x

This will save the current terminal settings in variable x, turn off echo, tab-expansion and CR-to-NL translation, receive the file and reset the terminal settings. When the transfer finishes, you have to type an EOF character to tell CAT to stop (usually ^D).
The ASCII file transfer just sends out the file as fast as it can. Echoes from the host are displayed but that will significantly slow down the transfer, so this works best with connections that do NOT echo the file. On Unix, it is easy to turn this off (the stty -echo above).

New in version 12.1 is the ability to transfer files under control of a script.
See the FILE_RECEIVE and FILE_SEND function calls and the examples there.


This is an important feature, others are prev/next


15: Kerberos V5 authentication/encryption

15.1: Introduction to Kerberos

This version of IVT supports Kerberos V5 authentication (see licence).
NOTE: It does NOT support the (older) Kerberos V4 protocol.
NOTE: IVT will detect and use credentials from Gradient DCE for Windows, this can be disabled explicitly using the NO_DCE32 keyword.
NOTE: IVT does support session encryption.

For the uninitiated, Kerberos is an MIT protocol which features:

Kerberos is based on a "shared secret". Somewhere in the network you have to have a "trusted Key Distribution Server", or KDC. This KDC knows your password. When you login on a Kerberos network, you do not send the password to the KDC, but some sly cryptography is used and the result is that you simply PROVE that you know the password without actually SENDING it to the KDC (so the password cannot be sniffed from the network).
Simply put, the KDC encrypts its replies, using your password as the key, and only you are able to decrypt this. For everybody else it is just a meaningless jumble of bits.

The KDC issues a "ticket", which proves your identity to servers. Every service in the network (telnet to a server, FTP, rlogin, etc) requires that you provide it with a "service ticket". Such a ticket grants a particular user (principal) access to a particular resource (server). These tickets are obtained automatically by the Kerberos software (after all, you have already proven who you are) and sent to the server automatically, too.

The upshot of this is that you login ONCE only, and are automatically logged on to all the participating TELNET servers, FTP, rlogin or whatever.
The disadvantage is that all that network software on the host has to be modified (kerberized) to accept the Kerberos tickets. Similarly, all the client software has to be modified, too.

IVT is such a modified, kerberized client program. What it does is:

Of course, before you can use automatic Kerberos login, you first have to authenticate yourself to the Kerberos KDC. For this, you first have to install and configure Kerberos on your PC (next chapter).
Then, you use the KRB5.EXE program for initial login. After that, IVT will automatically use that identity for further logins.

NOTE: Alternatively, you can use the Gradient DCE client software and use dce_login to obtain credentials from the DCE security server. IVT will read the registry entries created by Gradient, create the KRB5.INI file in the Windows system directory with the name of the realm and security server and set the KRB5CCNAME environment variable. The upshot is that you can use IVT in a Gradient environment without any explicit action. IVT will use your DCE credentials to authenticate you. See also the DCE32 keyword.
IVT is capable of using the DCE32.DLL routines to query the login context.

You can disable the Kerberos process temporarily by using the NO_KRB5 keyword or by using this setup screen.


15.2: Install and configure Kerberos on your PC

This IVT is integrated with MIT Kerberos for Windows.
It can be downloaded from https://web.mit.edu/kerberos/dist

IVT will detect the software on your PC and automatically use the login program to detect or obtain credentials from a KDC (Key Distribution Center).

Since you need lots more Kerberos things besides IVT (a KDC machine and Kerberized software on your servers) I won't spell out all the details here.
NOTE: If you use Gradient DCE for Windows, IVT will work with the DCE security server instead.
The upshot is that if you install the Kerberos for Windows, you can seamlessly login to Kerberized telnet servers.

See also KRB5_LOGINPROG as a convenient way to start a Kerberos login and synchronize with its operation.


15.3: Kerberos ticket forwarding

As explained before, the Kerberos ticket that proves your identity can be transmitted to a host and stored on that host in your credentials cache.
This implies that your identity follows you around the network, which allows you to have single (or at least reduced) sign-on.
You use IVT to create a TELNET session to a host, the KRB5_FORWARD option will allow you to forward the credentials and the klist command on the host will show you these. When the IVT connection is terminated, the telnet daemon will delete the forwarded credentials.

When you use Kerberized software on the host (for example to telnet to yet another host, or to use FTP or RLOGIN) it will use the forwarded credentials and not ask for a password or userid.

When forwarding is not supported by your host the NO_KRB5_FORWARD option can be used to disable ticket forwarding. It is turned on by default.

Also, forwarded tickets can themselves be either forwardable or not, see the KRB5_FORWARD keyword for details.


15.4: Kerberos based encryption/decryption

When Kerberos authentication is used during session establishment, a secret key is generated by the KDC and stored in the service ticket in such a way that both IVT and the TELNET daemon it connects to know the secret, but nobody else does (it is only transmitted in encrypted form).
IVT can use this key in two directions:

Both directions can be encrypted simultaneously. Currently, IVT supports two ciphers:

These algorithms can be enabled or disabled using the KRB5_ENCRYPT function call. When this is done from a STARTUP script, the global IVT defaults can be set. When done from a script on an active session, the current session is altered.

The Kerberos setup screen can be used to inspect and modify settings, too.
When click here, a popup will show the current status of encryption and decryption on the session.

The availability of the cryptographic algorithms can be determined in the same setup screen. Every cipher can be available for:


Input/Output : This is the default
Input        : Only for decryption (from host to IVT)
Output       : Only for encryption (from IVT to host)
None         : Cipher disabled.

If you disable too many ciphers, yet demand auto-encryption or decryption, you will receive an error message.

I have gone through considerable lengths to make the implementation of the encryption efficient and trouble free. On a modern PC, the overhead caused by the encryption and decryption should not be a problem. If you do experience delays, turning the encryption off and on (to protect only sensitive parts) is possible using either the KRB5_ENCRYPT function in a script or the setup screen.

See also KRB5_CRYPTDEBUG.


15.5: Kerberos & SSH licence

When you download and install a version of IVT with support for Kerberos or SSH, IVT will install a 30-day evaluation licence by default. When that expires, the security features will be disabled.

Licence files are installed and maintained from the HELP menu, choose the LICENCE item there.

Alternatively, you can specify a (central) licence file using the LICENCE keyword in an IVT.RC file.
If you copy a licence file into the installation directory of IVT under the name of "IVT.LIC", it is found and used automatically.

A licence can be obtained from http://ivtssh.nl/downloads, and can be limited in time and/or the number of workstations they can be used on.
Details of a licence can be viewed by clicking on the menu bar HELP menu, choose "Licence".
Also, that licence dialog allows you to visit the web shop, and passes some information about the local environment to the web shop. This is meant to make it easier to obtain a correct licence file for your environment.

A licence can be bound to up to 5 DOMAINS (named networks) or to a single hostname (PC). The first form is meant to be used by PC's attached to a fixed network. The licence can be used by any PC on that network, up to the maximum number of simultaneous instances specified in the licence.

When your PC is not attached to a fixed network, you can either specify:

The first form is intended for machines that dial in to a limited number of different networks. The second form is intended for machines such as laptops that get plugged into many different locations and networks, and are not bound to a specific network at all. Such a licence works for the specific PC only.

See here for the full text of the licence agreement.
See also SHOWLICENCE.


16: IVT Escape sequences

16.1: Standard VT220 sequences in IVT

This chapter lists all escape sequences that are recognized by IVT. Most of these are standard VT220 escape sequences. Where IVT differs from the standard, this is (of course) noted. There is also a list of IVT-only escape sequences (which do not conflict with the VT220 standard). These are described here.
The sequences are split into various parts:

Control codes and escape sequences are only interpreted when IVT is not in DEBUG mode.
Another way that can cause escape sequences not to be interpreted is when a SCRIPT uses a DISPLAY off command in combination with WAIT statements to catch characters transmitted by the host.

Lastly, the session can turn the printer in controller mode, which will result in every character being transmitted straight through to the printer without further action taken (except for the end-of-print-through escape sequence...)

However, in all other cases the incoming characters are processed according to the rules detailed in the topics below.


16.1.1: IVT Control codes

Control codes are single-byte characters that perform special functions.
Control codes can occur anywhere in the stream of characters that gets transmitted by the host. Many VT220 terminal emulators fail miserably in this respect, but the DEC standard dictates that a sequence such as:

        ESC [ 1 ; 1 H

which will home the cursor, may be interspersed with control codes such as new lines, tabs and so forth without altering the meaning of the escape sequence. So there might be a LineFeed in the middle of the above example, like:

        ESC [ 1 LineFeed; 1 H

And this should perform the LineFeed control function (which might scroll the screen) AND home the cursor!
IVT of course implements the correct functionality :-) Another bizarre item in VT220 compatibility was brought to my attention by Andy Langdon. A true VT220 will accept the following sequences and IGNORE them:

   ESC [ - 6 X
   ESC [ 6 ; - 2 X
   ESC [ - - 6 - ; - 2 X

The 'X' command is just an example, all commands behave this way.
In other words, a hyphen (minus sign) anywhere in an escape sequence causes the sequence to be turned into a no-operation, but it is parsed entirely until a command character (the X in the examples above) is seen. Older versions of IVT would treat the hyphen as an unexpected character, abort the parsing of the sequence and display the rest of the data as normal characters (so IVT would display the "6X" on screen in the first example. IVT 16.2 and later will accept the hyphens and ignore the resulting command. Incidentally, it also accepts and ignores NULL characters in escape sequences.

Note that the number of hyphens does not matter, nor their position in the command sequence. For example, the 'X' (erase) command only uses one parameter, but when a second parameter is sent with a hyphen in it, the entire command is ignored. When two hyphens are sent, they do NOT cancel each other out.
They can occur before, in between and after the decimal digits. They seem to have no use or logic, but I have verified this behavior against a genuine VT220 terminal and copied the observed behavior in IVT....

IVT knows the following control codes (see also 8-bit commands):

All other characters will be processed as any normal displayable character, except for the 8-bit commands.
Depending on the selected character set, this will display various interesting characters (or not :-).


16.1.2: VT220 8-bit control codes

A VT220 terminal supports a number of 7-bit single byte commands and a number of 8-bit single byte commands which are (relatively) rarely used.
Every 8-bit command code has a 7-bit equivalent.
See also the CODEPAGEMOD statement, which can be used to disable these 8-bit commands one-by-one, and BIT8COMMANDS which can be used to disable them all together.

Below is the list of 8-bit command characters recognized by IVT and their seven bit equivalents:


16.1.3: VT220 escape sequences

IVT implements the full set of VT220 escape sequences. Listed below you will find them all, in all their nauseating detail :-) Over and above these standard ones, there are also IVT specials, which you'll find listed in this chapter.

Escape sequences start with either an ESC (ASCII 0x1B character) or with a thing that DEC calls a CSI. This CSI is normally a two byte sequence ESC[ (ESCAPE followed by a square-bracket-open), but when IVT is operating in 8-bit mode, this can be abbreviated to 0x9B (an ESC-character with the high bit turned on). This saves bytes-on-the-wire, but also causes many problems with software that cannot adequately handle a VT220 in eight-bit mode (this 8-bit mode also alters the codes generated by keystrokes).
Also see CODEPAGEMOD which can turn these commands into displayed characters.

To complicate things further, some sequences ALWAYS start with just an ESC character. And to complete the fun, typing a single ESC key will generate a sequence that will confuse many hosts because function keys start with an ESC character (followed by codes that identify the key being pressed). This means that a host has to rely on timing to differentiate between a lone ESC key and a function key... Many people have cursed Unix because leaning on one of the cursor keys can cause all sorts of things to happen when you are connected on a slow line. This is however, caused by the brain-dead design of the VT220 function keys.

Anyway, the ESCAPE sequences recognized by IVT are listed below. The ones that are preceded by the CSI lead-in are in the next section.


16.1.4: VT220 CSI sequences

These sequences are started with the CSI lead-in. The general format is:


        CSI [parameter;]... COMMAND [option]

Parameters are numerical values, separated by semicolons. The COMMAND is a single character. As an example:


        ESC[10;20H

is a command to position the cursor.
Below is the complete list of all such sequences understood by IVT. Other special sequences are described in this chapter.

Below is a list of CSI commands without the question mark.


16.1.5: IVT VT420 extensions

Some applications will ignore the current type of terminal and send escape sequences to IVT that are part of the VT320 or even VT420 command set.
To make some of these work, IVT implements a subset of the VT420 commands.
I intend to extend these as the need arises.

Rectangular Area Operations:

Others:


16.2: IVT-only special escape sequences

Besides the standard VT220 escape sequences IVT also supports a number of interesting extra features. They all start with ESC<space> (where <space> is a space-character) and are:

This list is expandable upon request.


16.3: VT52 mode

IVT VT52 (a very old VT terminal) compatibility commands:

Furthermore, the cursor keys and function keys emit different values in VT52 mode. It knows about application and numeric mode, too.
I don't know if this is truly complete, but it is sufficient to pass the VTTEST compatibility test for VT52 features (7 points!).


16.4: IVT XTERM escape sequence support

The "ESC ]" sequence introduces an OSC command (Operating System Command).
These sequences implement various features of an XTERM terminal.
The general form is "ESC ] options; parameters; ST".
The ST (String terminator) is usually an "ESC \", but a BELL is is also valid.

The current list of supported OSC commands by IVT is:


16.5: SCO ANSI compatibility mode

SCO ANSI compatibility mode is a late addition to IVT. It recognizes a number of extra escape sequences. See SCO_ANSI for more information.
The extra commands are ignored in normal VT220/VT52 mode of operations.
The commands are:

The FormFeed character, which causes a normal new line operation in VT220 mode will cause a clear screen operation in SCO ANSI mode.

When an erase operation is performed, the background color of the erased positions depends on the setting of the SCO "Background Color Erase" option.
When set to 1, erased positions get the current background color.
When set to 0, erased positions get the default background color.


17: What the users say...

Here are some opinions from users I received over the years. If you would like to be added to this list, mail me! :-)

Mark Sohmer (June 2018)
I've been using IVT for 15+ years and I wouldn't use anything else. It's far superior to anything else, and the Developer is outstanding for support issues. I worked over a decade as a Senior Network Administrator for a very large financial company, and IVT was the only SSH client I wanted to use. It sped up my productivity A LOT!

Peter Oostrum (June 2018)
Still my Secure Shell client of choice!


Anonymous (January 2013)
I had to use putty, and it was a real pain to get it to work the way I wanted it to. I had to create a ton of startup scripts for each host I regularly connected to (about 100 of them) and the startup scripts referenced a plain text file on my PC with the login and password info. Not very secure. And when I had to upgrade machines and type the exact same commands in 20 windows at the same time, something IVT does so easily, it was a chore with Putty.


Seij Larsen (June 2012)
Your IVT software has been a great help with my everyday work.


Editors review at www.fiberdownload.com.
If you talk to most people about VT220 emulation, you are pretty much guaranteed to be met with a blank expression and almost be able to see the huge red question mark appear over their heads. In fact, unless the person is "of a certain age" and from an IT background, it is quite likely that he or she has never seen or touched the infamous DEC VT220 terminal. Most of them are in landfills or gathering dust in a museum. The DEC VT220 terminal was in its heyday in the '80s and '90s when the personal computer was in its infancy and most business systems were running on mainframes or UNIX boxes. No computing power was needed at the desktop so all the user needed was a keyboard, monitor and a connection to the mainframe or UNIX box either by direct cable or modem connection.

Today, VT220 emulation is more common that most people realize. If you've ever been to a travel agent to book a flight or visited your friendly local bank to apply for a loan, then you may have seen the customer service representative click a few times with a mouse then start feverishly hammering away at the keyboard. Whilst most front office applications have a graphical user interface (GUI) such a Microsoft Windows, many back office applications are still running on mainframes and UNIX machines. Why? Because the back end applications focus on what they need to do - crunch numbers or perform searches, etc. on massive databases. Back end applications are not designed to be pretty to look at, they are designed to be fast and efficient and the best way to achieve that is with a simpler text based user interface.
VT220 emulation can also be used for more "modern" activities such as file transfer and performing tasks more suited to the command line. Webmasters and technical support staff will use a VT220 emulator on their computer to establish a secure, encrypted connection to a remote computer to complete tasks that require them to get down and dirty with the operating system. This is where the IVT VT220 Emulator (IVT) shines. Not only does it provide the time honored serial cable style connection to a remote server, it also provides TelNet, Secure Shell (SSH), Remote Login (RLOGIN) and NetBios (Windows Networking) connectivity.  Unlike the practically obsolete HyperTerminal utility buried in the depths of Microsoft Windows Accessories, IVT provides a modern generation terminal emulation complete with color support, multi screen capability and a tabbed interface which allows you to make multiple connections to one or more remote servers without cluttering your desktop with multiple terminal screens.  To make your life easier, IVT also allows you to customise the keyboard and set different color schemes for each tab so you never lose track of which remote server you are working on. You can keep a record of what activities you have done, perhaps for client billing or audit purposes, courtesy of IVT's ability to keep a log of commands entered in each session and save all the detail including screen shots to a real printer or to a file. Get speed and efficiency in the modern computer world with the IVT VT220 Emulator.


Peter Hartland (May 1, 2011)
Very useful tool which I used to connect to a dozen or so Linux servers.
I found the auto-login feature extremely useful: just start IVT and it automatically creates all the sessions and logs you in as well!


Win7Dwnld site (September 2011)
My name is Maia Irimia and I represent the Win7Dwnld Team. Our main activities are software analysis, listing, classification and rating. The subject of this email is your software product named IVT VT220 released by your company and added on our database on Sep 07, 2011. Since testing and classifying software products is our main activity, we found your product as being one of the software products that captured our attention; so it has been tested by some of our best colleagues under more circumstances and it has passed some important criteria that we use in classifying such products (ease of use, features, user interface, help&support, customization, speed). For all these results that your product obtained, I decided to grant your software product with 5 stars Award, the highest ranking that we carefully grant.
Listed on http://ivt-vt220.win7dwnld.com


Rob Lowe, Creative Impulse Limited, March, 2011.
As a professional Freelance Software Developer, reliability and correct rendering of received communications is critical. Providing solutions for significant international CMM and ISO accredited organisations, any tool recommended has to be of a standard we can rely on. We have found the IVT product to be reliable, comprehensive in functionality and well supported. The GUI is simple and intuitive, as professional tools should be.


Laszlo Magyar (February, 2011)
I just found your amazing artwork, the IVT emulator. I'm experimenting with it as a possible user interface for uP debugging (RS232 interface). I've done it for years with simple DOS based emulators like Term90. Stayed with those because I haven't find any Windows terminal emulators with predictable behaviour. This has changed with your IVT.


Olli Laukkanen, August 27, 2009.
Thanks Ruurd for the new [tabbed] version of IVT. Just what I need. Easy jumping from host to host, great!


Sam Ferencik, March 3, 2009.
IVT is great, I could not do without it. Together with vim (the mighty Dutch Duo :-), they are the most enviable pieces of software I have.


Brown, Mason - (Turner) [mbrown@tcco.com], May 10, 2006.
I want to say that I love IVT. I'm running 19.0b build 17147 on Windows XP SP2 with the SSH license. It's the best thing that's happened to terminal emulation on the Windows platform ever...


John Wilkins [jdw242b@yahoo.com], April 19, 2006.
I tell everyone that uses anything like IVT about the benefits it delivers on, instead of empty promise. We've started our upgrade from wIntegrate to IVT. It's been super easy.


Alan Lodge, October 13, 2005.
What can I say but Thanks, IVT is a very nice piece of software and as I have just found the support is second to none...


John [hulleyj@hotmail.com], August 19, 2005.
IVT is the best telnet software I have found on the net after searching and testing for many hours. If you haven't tried it, try it now, it has loads of features and is as user friendly as any software could be. I thoroughly recommend it to anyone.


Bhatt, Avinash, August 17, 2005.
I am quite impressed by the simplicity of the software, and it offers a lot of convenience. I love this tool. I love the auto login feature, the password protection for auto login, the ability to switch between multiple sessions, the copy/paste, and the list goes on...


Bill Wire, June 23, 2005.
My name is Bill Wire and I recently downloaded your IVT 19a program.
I appreciate all of the hard work and thought that went into it, and there are some really nice features I'm just crazy about. Host groups and the autologin features rule!  I'm still learning how to use it efficiently, but IVT is superior in every way to any of the other terminal emulation packages I've used. That includes ones that cost over $150 USD per license! (No, I didn't buy that, the company did. I prefer IVT by far.)


John Hulley [hulleyj@hotmail.com], May 5, 2005.
...firstly congratulations on a brilliant piece of software (and free) I have found NO better anywhere but many far far worse and loads of pay ones that are rubbish. Thank you very much for all your help I am very VERY impressed with your support, patience and help, not that the software needed any alterations in the first place.


Chris Barr [Chris.Barr@marketmax.com], March 1, 2005.
Thank you Very Much for IVT Telnet.
It's flat-out wonderful - a solid, robust, fast and full-featured tool.
Re-connect, mouse copy & word-highlight and Auto-Login are big features.
Gradually, I've used more and more functionality, e.g. black background, "yellow" foreground.


Ruud Hanegraaf [r.hanegraaf@laurus.nl], February 28, 2005.
We're the second largest supermarket chain in the Netherlands. Last summer we made the move from an expensive terminal emulation program to IVT. IVT has all the capabilities of the commercial program, and then some more. Using scripting and encryption, we've created a completely locked-down environment, custom made to all our needs. With over 500 active users our entire retail logistics is now running on IVT. Without any malfunction. No crashes, no desperate calls to the helpdesk, no beepers waking me up in the middle of the night. This is really what they call 'set and forget'.
And an excellent super-fast top-notch support by Ruurd!


Frans Geerts, March, 2005.
IVT works great, much better than stuff like telnet or hyperterminal.
It has been a great help, thanks very much.


Jan Bymark [Jaby@Q8.DK], February 9, 2005.
It's great product you have made. Flexible, great functionalities and very nice to work with. Thanks again for your quick response. Great support, many other companies could learn from you (IBM, HP, Microsoft etc).


Colin Raven [duiker@haggis.nl], December 18, 2004.
I was searching for a reasonable alternative to Hyperterminal which would handle serial connections in a more elegant manner. Then following a lot of searching, I stumbled across IVT. Now I have serial, telnet, *and* ssh sessions open in *one* instance of *one* client. Woo Hoo!!! I'm a happy camper - I am!!! This is outstanding software. It's functional to the n_th degree, and isn't even ugly!! Many beers for Ruurd! graag gedaan! Whiieeeeeeeee!


Toby Titone [otobyt@iastate.edu], December 7, 2004.
Allow me to say thanks for this great tool that you've made available.
In several of my classes, I've frequently used the PuTty software for logging onto systems at my university. I've always missed the ability to scroll between terminal sessions, so IVT is much appreciated in this area. I think you are correct when you say that it is the fastest emulator out there... there is a noticeable difference in connection speed / lag time between using Putty and your software.


Alain Hache [ahache@mail.mobistar.be], August 19, 2004

Just GREAT !!!
A SMOOTH and EFFICIENT environment just as expected.
Multiple sessions on various equipment reacting simultaneously at the tip of a finger. The very best Telnet tool I ever used.


Arthur Yeung [arthuryeung198@hotmail.com], August 5, 2004.
Thanks for creating IVT, a wonderful telnet emulator. I have been using it for over 2 years already, everyday from 9-5!


Stephen Dennis [stephen@digital-knowledge.com.au], July 30, 2004.
After much yelling and screaming at XP's broken Telnet client I stumbled across your IVT telnet client.
WOW! What a pleasant surprise.
I work with both Sun and DEC Alpha servers as a unix sysadmin (but have to have XP for my stock trading software).
Your IVT is such a pleasure to work with. Well done.


Jonas Martinsson [jonas.martinsson@ecitele.com], July 29, 2004.
IVT- WOW!
I just wanted to drop you a note and tell you how pleased I am with your IVT telnet terminal. I am using it for automating a UNIX build environment from Windows together with Visual Build. The scripting possibilities are really amazing. Thanks a lot, it's saving me a lot of effort and time!


Fernando Toledo, July 20, 2004.
Let me dispel the myth that this is not for "casual use by newbies". This is a fantastic tool and it has helped me tremendously in my everyday job. I’m a web developer/designer for an investment bank in NYC. While I don’t know much about Unix commands, I’m responsible for uploading and transferring files over Unix servers. Your program has helped me tremendously to ease the pain of having to type repeated commands.


Daniel Cioconea [daniel_cioconea@yahoo.com], April 23, 2004.
I was searching for a SSH terminal emulator and this is how I found out your good tool IVT. On a scale from 1 to 10 IVT is a 10+! Thank you for your time and congratulation for your work.
Greetings from Bucharest!


Peter Ottis [pottis@shaw.ca] April 16, 2004.
[...] it works perfect! The IVT is a really good product and has an outstanding support. I appreciate your work!


Peter Kaplan [pkaplan@navis.com], September 13, 2003.
On a more general note, I would simply like to thank you for IVT. One of my primary duties is to develop solutions for GUI and text-based wireless data terminals that interface with our software and are used to direct the actions of container handling equipment and personnel at container terminal facilities.
I've worked with a wide variety of client programs in this capacity, from freeware to professionally developed solutions specific to the task, and IVT is one of the best that I've seen, even though I'm only using the DOS version.
As a testament to the durability of well-designed software, IVT will play an operational role at the largest container terminal in Europe, even, as you say, in this brave new year of 2003.


Peter Klar [pklar@robert-schulz.de], September 7, 2003.
You have helped me very much! Only 3 hours after sending my question I received your answer with full explanation and more than one useful solution! This is really perfect service which makes your Emulator even more valuable. I have not experienced a similar quality with commercial hotlines !!! Thank you again.


Marcello.Missagia@comune.treviso.it, September 2, 2003.
I recently tried your IVT program and I find it really well done; it has a lot of useful features that makes it really good for our needs. We appreciate very much the functionalities of your program, we have tried many terminal emulators, but we find that your program works better than any other.


Mondragon, Todd [ToddMondragon@ca.slr.com], August 22, 2003

I love your IVT program! I've been hired at a company that has no tools to speak of and your program has helped me tremendously. Your right about it being for professionals, my brother complained loudly about the lack of bells and whistles. I'm so impressed I'd like to see what the other programs you've written are like. I think I'll recommend your commercial version to our company for inclusion to our environment. Great job!


Gerald Newell, Quality Manager, July 30, 2003.
I found IVT on Tucows. I have been searching for a terminal emulator for XP to use at work, and this one is great, especially for free! I am using it on a serial port connection to a SCO Unix box running almost-20-year-old MAI Basic Four business software (don't ask).
IVT does everything I need. Unlike many (not free) programs, it displays special characters correctly (like showing pop-up box borders as lines instead of garbage). IVT also handles printing very well, copies and pastes easily, and even offers block and line selection choice! I really needed the block select option in my work. (The only other program I ever used that had block selection was the MAI terminal emulator that MAI supplied us on floppies in the 1980's. But that program is crap under NTVDM, using almost all CPU cycles.) Congratulations and thanks for providing this excellent piece of software!


Kramer, Monte [MKramer@guaranty-bank.com], July 3, 2003.
Just a note to let you know how much I enjoy your IVT telnet program. I have been using IVT about 2 weeks and each day I find some invaluable feature.
Being able to cut and paste with just the mouse buttons is perhaps my greatest time saver; you see my typing skills are still in the improving mode. IVT is a wonderful tool for connecting to our UNIX server from my XP workstation. I truly believe it is a better product than what our company uses; ProComm Plus.
...
Thank you for building a very nice telnet product.


Sotiris Papageorgiou [Sotiris.Papageorgiou@bodyline.gr], July 8, 2003.
Hi, i am evaluating you awesome terminal program ... Thanx in advance and keep up the good work it is unbelievable such a good terminal program to be found as a freeware! Congratulations


Andy Verbunt [andy@nexar.be], July 3, 2003.
Congratulations with IVT! I like it very much; especially the fact that you can switch between different sessions within one window, and the password learning feature because I usually have a lot of sessions on different machines that fill up my desktop.
I've been working quite a while with PuTTY, but I like this much more......
One more feature that would make this tool absolutely perfect is SSH-support !


Peter Klar [p.klar@robert-schulz.de], June 10, 2003.
your Terminal emulator is sensationell! Thank you for that master piece.
I love the quick switching between different sessions.


Paul Yeh [ppyeh@yahoo.com], May 29, 2003.
Congratulation!! Great!! Excellent software!! Currently, we are installing a LAN and your excellent software really helps ease the pain of transition. My boss is extremely happy about the cost of the software. I am extremely happy about the flexibility and stability since I have to support it. Also, the software documentation is excellent.
Thanks for your help and for an excellent piece of software.


Julian, march 31, 2003.
Thankyou thankyou thankyou for IVT!
It has made my editing task a whole lot easier than my previous emulator.
I particularly benefit from the correct handling of screen resizing in emacs as the screen used to go choppy in my other terminal emulator.


Alejandro Dinamarca [Alejandro.Dinamarca@py.cl], February 14, 2003.
I'm actually using version 16.2c build 10669 of IVT since 4 months ago in Win2K and I can say: Thanks for this product!! It's very good.
-- Jefe de Informatica, Chile.


Andries Venter <andries@sun.ac.za>, November 6, 2002.
I am using IVT to configure switches and routers on our network using the scripting capabilities of this program. I am really impressed.
Well done and thank you for providing it for free! -- Stellenbosch University, South Africa.


Langdon, Andy [andrew.langdon@eds.com], October 2, 2002.
I've just discovered IVT and I think it is a great piece of software and better than most of the commercial packages we've used.


Ben Lees [ben.lees@mps.com.au], June 20, 2002.
I have been fiddling around with your IVT software and I really like it! I am running WinXP and it seems to work flawlessly ... keep up the good work, it is not often you find something coded with so many useful features in the right spot. The software really is fast -- we tested it here on our Aix server and it was over 6 times faster than the commercial emulator we are using at work ... I think IVT behaves better as a DOS based program under NT than something like 98 which is quite ironic I think. I have programmed in both DOS and Windows - and was extremely impressed with what you did in IVT.


Aleksandar Stapar [astapar@gmx.co.uk], June 10, 2002.
I downloaded IVT yesterday and I just want to congratulate you on a very well thought out telnet client. Unfortunately it's not very often that you find a flexible yet easy to use product (Leech FTP comes to my mind as an excellent product).
Keep up with the good work!


Warren Humphreys [Warren.Humphreys@EVGL.com], February 19, 2002.
Just thought I'd drop you a quick mail to say thanks for IVT. I've been using it for a couple of months now and it's fantastic. The officially supported telnet program that we use in the office (Hummingbird Exceed) is hopeless compared to IVT. I log into about 12 unix boxes every morning and it used to take me ages, and when I did the terminal emulation wasn't very good, but now with IVT's scripted autologin and excellent terminal emulation all of my problems have disappeared.
I'm a consultant and a sysadmin and I'll certainly be recommending IVT as the telnet client of choice in the future.
If you ever produce a full gui version it'll take over overnight!!!! Many thanks for an excellent product.


Rimmi Juha [Juha.Rimmi@elsacom.com], March 8, 2002.
We have used IVT at our company for a half years now. IVT script language is superb! Thank you Ruurd for this SW! Our company have saved huge ammount of money by utilizing IVT.


Frank Schmautz [schmautz@hotmail.com], November 4, 2001.
I just started using IVT and LOVE IT!


Javier Laiz, Telefonica Sistemas [jlaiz@ts.es], October 2, 2001.
IVT Rules!
Hi, I'm a programmer in Spain, and my colleagues and I would like to thank you your effort for IVT. After testing some telnet emulators, we choose IVT because it is simple, easy, and very fast.
Your work is very good.


Dagoss@ra.rockwell.com, May 2, 2000.
I am very impressed with your software (IVT) and would like to implement it throughout our office...


Oscar Aviles [oscar.aviles@usa.net], Apr 28, 2000.
Hey! What a great piece of software this IVT terminal is! Congratulations!!! If you accept a little contribution$ in the shareware fashion, I'd gladly do it, if I could be able to skip the splash screen. Anyway, thanks!


Tom Maes [tom.maes@expandedmedia.be], July 28, 2000.
I am truly impressed with IVT, which seems to be developing quite a 'cult' following. First brought to my attention by a friend about a year ago, I have since introduced it to many clients and colleagues.
Even though I hardly use more than 5% of IVT's capabilities, it really shines as a software masterpiece in my toolset.
Programmers like yourself continue to provide my young career with a guiding light and a strong source of motivation.


Ellis Pritchard, ellis@nuke.dircon.co.uk.

Cool! Just when I thought I'd never find a decent telnet client on Windows, I came across IVT; bags of features, fast as hell and rock solid.


Oscar Rodriguez, Madrid, Spain [orod@bigfoot.com], May 13, 2001.
I've been searching for a terminal emulator like this for a couple of months!! We have a linux box as our home server and I needed a terminal emulator with scripting capabilities, and yours is GREAT!! I really love your terminal (and is the only one which allows me to use Midnight Commander without a glitch!)
Thank you very much for your hard work!!!!


Darian Sharp [kafiend@cyberspace.org], May 19, 2000.
I am writing to you to express my thanks to you for providing to the on-line community with your fabulous program IVT. it is a program which i use every day and enjoy using everyday. [...]
I also sometimes use it at work to communicate with our website server (or have it minimised so that I can bbs when co-workers aren't looking) Thank you very much for this wonderful program, I have recommended it to all of my friends who have shell accounts and will continue to install it on every windows computer that I use. the telnet program which comes included with windows is so awful to use that I know why most people in canada don't even know what telnet is and have never used it.
I have benefited from your program very much. Thank you.


Juan Lupion [juan@lupion.com], Telefonica, Spain, Oct 26, 2000.
Hi, I've downloaded and given IVT a try... it rocks! I have been looking for a console telnet client, most of them were crippled compared to their full GUI cousins, but IVT has *anything* I need.
It is such a great piece of software I will recommend to anyone. Thank you for that beast!


Kiril Karagiozov [Kiril@web.de], Nov 26, 2000.
Thank you for the great program you have shared with us. i have just tried it out (after having had enough of the windows telnet and other would be terminals) - it is exactly the way it should be. i am sure that after reading the manual pages and getting accquainted with the full features of the program i will love it even more. i can only recommend it to anyone.


Larry Kahler [larry.kahler@bull.com], May 25, 2000.
Your Telnet Client software is great and as far as I am concerned it is the best one available. I also love the price ...
Thanks for the Telnet software.


Benedikt Hochstrasser [bhoc@pentagroup.ch], Feb 17, 2000.
Subject: ivt - whoahh!
Just installed IVT on my NT box to access my Linux machines. Once I found out how to add it to the termcap file and to compile a terminfo file, I am absolutely enthusiastic. This is definitely what I've been looking for a loooong time. Thank you for this great application! I fully agree with you about the GUI stuff. While character-mode seems to be somewhat esoteric to some users, it has many many advantages over Point-and-shoot and plug-and-play and drag-and-drop. Keep up that spirit! PS: If I'd found it in NONAGS (www.nonags.com), I'd give you six duckies right away. (Please consider submitting it to NONAGS)...


Chris Johnsen [chris_johnsen@yahoo.com], Apr 13, 2000.
...some praise for IVT: IVT is the best Windows telnet program I've ever used! When I changed jobs and had to use Windows for my desktop I went through I-don't-know-how-many Windows telnet programs before I finally found IVT. I started using it at version 11.3c and recently upgraded to 12.0.
Primarily I like IVT for its xterm-like cut and pasting and for its multi session support (using "screen" on a UNIX-like system under IVT is a kick!).
I think it is great that you allow people to use your wonderful software for free. [...] thanks for the great software!


Gert Leerdam [Gert.Leerdam@getronics.com].
  x     x       IVT - I love it!
x   x x   x
 x   x   x
  x     x
   x   x
    x x
     x


Goocher [goocher@goocher.com], Sept 12, 2000.
Thanks a lot for giving away your excellent telnet client. Very nice. I have used other Windows telnet clients (my current favorite is an SSH client by Data Fellows... but costs moola!). This is hands-down the best freeware telnet app I have encountered, especially with all the cool features you have built in, like multi-session capability w/in the same window. Yea.
Yours is better, easier to use, and more robust than 99% of the telnet apps out there on the market -- commercial, shareware or freeware. :o) Thanks again! I intend to use IVT for all Perl 5 script development on my site.


Alexander McKenna [alex@alexmckenna.com], March 25, 2000.
Thanks for IVT, it is such a wonderful telnet program, I am sure I will be learning about its many features for months to come. I am very interested in the BR program now that I have seen the quality of IVT.


philippe.beillas@free.fr, June 9, 2000.
Thank you for your program. I will recommend it around. Too bad it is not more advertised (I downloaded lot of #@!! telnet client before trying yours).
It works fine (colors+keys...) for telnetting old sun running different flavors of sunos and sgi machines... Great utility. Thanks again.


Jose De Leon, of InVision DSL, Sept 15, 2000.
At first I thought IVT was another a cheesy telnet program (sorry).
But after giving it a whirl, I find it is the *ONLY* windows telnet program that I have used that actually understands how to send all the non printable key codes such as function keys to the unix server.
Definitely one of the best telnet programs out there.


Preston, Chris (CCI-San Diego) [Chris.Preston@cox.com].
This is a fabulous program, a definite improvement over the telnet that comes with windows. Thank you for your efforts to create and continue to refine this product.


Tad Marko [tad@earthling.net] Dec 13, 1999.
I just downloaded IVT looking for something better than Windows Telnet to log into my Linux machine which acts as my gateway here at my house. IVT is very nice. Thanks for making such a great program free!.



Todd Peterson [tpeter@mcs.net], Oct 31, 1999.
Greetings from Chicago! I came across your excellent IVT telnet program one day a week ago. I immediately installed it and absolutely love it! I very much like that you are keeping it a console application - I don't need the GUI stuff for a telnet application.

Garry P. Cramins [gcramins@cramins.net] Feb 4, 2001.
I've been using IVT for about a year now to administer a few FreeBSD boxes and love it. Thanks for a wonderful product.


Philippe, philippe.beillas@free.fr.
Really good for people using telnet a lot.
No useless graphical interface. Lots of useful features (multisession, password file,...). A lot better than all other telnet clients I tried (<- a lot).


Paolo Ciceroni [jclksh70@yahoo.com], Jan 9,2001. ... now I just want to say that I consider IVT not just a product of choice, but a tool of distinction since it doesn't use the standard Windows application look-like (just to mention the less important of its features).
I don't know where to start to tell you about how good is your work (apart of this I think you know better than me its features).
I just want to say it's enough to let you know that you are (quite...) right to be proud of it. I used IVT for a short amount of time since I converted my PC to a Linux machine soon after I started using it, so I didn't had the time to fully explore its capabilities, but I'd like to show you I have noticed things as serial port multiplexing and the facts that it is sophisticated though reliable and easy to use, fast and secure to be installed and removed, requires almost no machine resources to run, comes with source code, and last but not least, it is completely free...


Benjamin T. White, MD [bewhite@wfubmc.edu], Sept 18, 1999.
I've just started using IVT, and am very happy with it, given the other telnet clients available for Windows! [...] Thanks again for IVT!


Carlos Jorge dos Santos Sousa [greenisleazores@netc.pt], Oct 21, 1999.
I've been trying out your software and everything I need of a terminal emulator is there except [complaint deleted :-] Other than that it is severely cool! Thanks for a great piece of software.


Magnus Hjorth [magnus.hjorth@home.se].
Hi! I downloaded IVT for Win95 a couple of days ago and I must say it is one of the best telnet clients I have ever seen!


Tommy Sundling [tommy.sundling@ams.amv.se] I'm evaluating your IVT VT220 emulator program for my company and I'm pleased with what I've seen of the program so far, your program is more advanced than many other commercial programs out there.


jp [dabman@home.se].
IVT is very nice, thank you for taking the time to write it.
------------
That is it for now...


18: PWDLEARN.IVT: The password learning & autologin system

18.1: Introduction

The password learning & autologin system is written entirely in the script language of IVT (see also this example code). It features:

People sometimes object strongly against any form of password storage in a product such as IVT that claims to be "secure". However, in all the years that I have been working on Unix systems, 99.9% of all sessions was on development hosts, with publicly known passwords, and no security whatsoever.
The password learning system automates the login of groups of sessions, and the automatic starting of my development environments.
A purist standpoint would have meant that I'd have to type many thousands of dull passwords like "welcome" or "secret" over the years, and I prefer not to.

If you have security considerations, simply disable the entire script by NOT using the "INCLUDE" in the IVT.RC file. Also, the installation wizard offers the choice to disable it.
Also, you can use the script but configure it to be off by default, or off for most hosts, or store passwords in memory only, and so on...

Click on any of the links below for more information:


Password learning: Security
Password learning: No save to disk
Password learning: Configuration
Password learning: Using IvtLogmeIn in your own scripts
Password hooks   : Change the default behavior


18.2: Password learning: Security

Let's be honest: any system that stores passwords and allows you to login automatically is less secure than a system where you have to type passwords manually. Having said that, I have gone through some lengths to prevent anybody from making the passwords in the little password database visible.
For example:

If you want absolutely no password snooping, simply comment out the line in your ivt.rc file that says:

INCLUDE "$IVTDIR/IVT/PWDLEARN.IVT"

An alternative is to use it to learn innocent accounts, then disable it by starting a session with the "Automatic login" checkbox unchecked. When the "Recording" window appears, press F9 (to disable all password learning).
Autologin will work for the known accounts, but no further passwords will be snooped or stored.

You can similarly disable password learning for a particular host.
You can disable the entire system using the installation-configuration wizard that IVT automatically starts during install. This can be restarted at any time using the menu bar, Setup -> Re-run initial setup script.

Also, the system is very configurable: Setup->Password learning.


18.3: Password learning: Configuration

The auto-login and password leaning system comes with a configuration utility that is invoked using the menu bar: Setup->Password learning.

Older versions of IVT had a text-based configuration system using only cursor and ENTER keys. In December 2007, this was rewritten to take advantage of the new DIALOG script statement that gives IVT scripts access to the GUI-dialog generator that IVT uses itself for all dialogs.

The essential parts of the actual script are copied automatically into these manual pages to serve as example code, since it shows the power of IVT scripts.

Click on any of the items for more information:



Auto-login                 : [On   ]
Password learning          : [X]
Show help window           : [X]
Learning for current host  : [X]
Store passwords on disk    : [X]
Meta-system hostname       : [ACME        ]
Meta-system user name      : [root        ]
<   Set/alter password on database  >
<Delete selected users from database>
<    Add users/passwords manually   >
<   Fine tune the learning system   >
< Change default user for this host >


18.3.1: Enable/disable auto-login

This option allows you to (temporarily) disable all automatic logins. When set to "Off", all known passwords are kept, but they are not used anymore.
If you want to prevent auto-login for a single session, you can simply disable the "Automatic login" checkbox (or start a session with Ctrl+PageUp key, or start IVT with the -n command line option.

When set to "Uninstall", the whole system shuts itself down. The menu-entry to configure this will be greyed-out. One way to undo this is by re-running the installation wizard (Menubar->Setup->Re-run initial setup script).
Another is through explicit script execution (F4, X, double click the password learning system).

In the Uninstall state, no passwords are learned, stored, or played back. It is functionally equivalent to removing the "INCLUDE" of the pwdlearn.ivt script from the main IVT.RC configuration file.
When you use F9 during password learning (i.e. "Disable ALL password learning NOW!"), the effect is the same as using "Uninstall".


18.3.2: Enable/disable password learning

This option allows you to (temporarily) disable all password snooping.
All known passwords are kept (and used, depending on the setting of the AUTOLOGIN option) but no new passwords are learned.
Every time a session is established and a password is not learned because you have disabled it, a window with a reminder message is shown.
If you want to disable that window as well, set the "Show help window" off, too.

There is also the option to disable the current session only (with F7), or all password learning for a particular host (with F8).

In a script, you can use the variable $IvtPwdCfgLearn for this purpose.


18.3.3: Enable/disable help window

Normally a help window is displayed during auto-login (green-on-black in the right-hand lower corner of the screen). The window is used to display information about the goings-on of the auto-login and learning process.

If you want to use auto-login and password learning, but dislike the windows, turn this option to off. You can also change the colors of the window by using the "Fine-tune password learning system" button.


18.3.4: Disable/Enable learning for current host

Perhaps you work in an environment with many hosts, some of which are important production machines and some of which are relatively unimportant test and development machines. In this case you might want to disable password learning for the production machines (so you have to login manually every time for extra security). The test and development machines will use auto-login and password learning.

Every time you make a connection to a machine for which IVT does not know the password, it will display a window giving the option (among others) that allows you to "Disable learning for this host". If you do, the next time you connect to that host a window will display a message that says that password learning is disabled. This option can be turned off from the maintenance menu.


18.3.5: Store passwords on disk

When this is set to "On" (default), IVT will learn passwords and store them in an encrypted file. When set to "off", IVT will just keep them in memory. This implies that all learned passwords will be lost when IVT exits.
Use this when you (or your company) explicitly forbids to have passwords stored in digital form on disk, encrypted or not.
See also the $IvtPwdToDisk variable.

If you only have a few systems, IVT will simply learn the passwords for the sessions you create and when you create more and/or new sessions, it will log you in automatically. When you have many systems with the same password, check out the meta-password system.


18.3.6: Auto-login meta system

When you have many systems that you regularly log in to, you probably have the same password for all your accounts on those systems (you shouldn't, but I do, and I'm sure I'm not the only one).
When you administer the machines, you probably have a personal account and the 'root' account that you use regularly. When you have to modify the password, you will have to change the password on all the machines and then teach IVT the new passwords for all the machines. This can be time-consuming when you have many systems (I work in places with many hundreds of Unix hosts).

The password-meta-system was invented to address this.

When no meta-system name or username has been set, nothing special happens.
When a meta-system name is set - which is meant to be something like your organization name, say "ACME" - then the system will first try to find an explicitly learned username/password for the host you are trying to login to.
When not found, it will attempt to find a password set for the meta-hostname for the specified user. When no username is specified, it will use the meta- username. When found, it will attempt to login with that account.

Perhaps this is best explained with an example:

When you change the password for root and jsmith after a few months, you only have to go into Setup->Password Learning->Add users manually and teach IVT the new passwords only once.
The passwords for root on ACME and jsmith on ACME have to be added manually to the database because IVT can never learn them the normal way.


18.3.7: Set/alter password on database

The user-id and password combinations are stored in an encrypted file. By default, that file is encrypted with the default IVT password so it can be read at start-up time without prompting for a password.
That implies, of course, that anybody with access to the computer that runs IVT can use auto-login for all accounts that are stored in that file.
If you do not want this, you can protect the file with a password. When IVT is started, it will prompt for this password. If the correct password is not given (the dialog is cancelled), the password database is not loaded and IVT will disable all password learning and auto-login.

If you have set a password on the database and want to remove it, this is also possible. You will be presented with a menu that is self-explanatory when you choose this option.

If you want to prevent abuse of your passwords it is also wise to enable a keyboard lock with a password and a lock timer.


18.3.8: Delete selected users from database

This option simply displays all known hostname/user-id combinations in a list and allows you to select them and delete them one by one.

It is not necessary to do this if the password changes for a specific user, the password learning system will automatically update a password if the auto-login process fails (or you use Ctrl+PageUp to create a session and log in with a user-ID already in the database).

The button "Delete all passwords for THIS host" uses the hostname of the current session to delete all accounts that it knows about on that host.


18.3.9: Add users/passwords manually

This option allows you to enter host/username/password combinations in the database manually. This is useful if you want to call IvtLogMeIn from your own scripts to log in to hosts that you cannot connect to directly.
Also, you need this to teach IVT the meta-passwords.

For example, if you have to connect to a specific host to be able to use a particular network to reach a faraway host that you want to log in to automatically, you have to perform multiple logins. IVT will automatically learn the first one, but has no knowledge of the second one.

In this case, you have to write your own script that calls IvtLogMeIn at the appropriate point to perform the next login.

The dialog asks for a hostname, username and password.
Whatever you enter there is stored in the password database.
Such entries can be removed again when necessary using "Delete accounts".


18.3.10: Fine-tune the learning system

This is accessible from Menubar->Setup->Password learning->Fine tune system.

This allows you to edit some low-level features of the password learning system. They are:

Click on any of the above links for more detailed explanations.


18.3.11: Change default user for this host

Whenever the system discovers that you have more than a single account on a host (for example 'root' and your own ID) it will prompt you for the one to use by default. Whenever you make a connection without specifying a user, the default account will be used. With this menu option, you can change this default.


18.4: Password learning: Using IvtLogMeIn in your own scripts

The password learning system builds a table of hostnames, user-id's and passwords. The system sets an:

ONCONNECT * IvtLogMeIn

This script uses the global $HOSTNAME and $USER variables as default, but the script can take two parameters overruling these defaults.

So if you say:

   CALL IvtLogMeIn("SomeHost","SomeUser")

the script will handle the login/password dialog for you. There is no check to see if the session is actually connected to "SomeHost".
Note: It also handles kerberos, SSH, password-less accounts and so on...

This form could be used if you hop between systems (in complex networks where you cannot contact a host directly). The "standard" autologin of IVT would get you to a shell-prompt of the first system. Using PwdAddLoginScript allows you to define a script that takes over from there. Such a script could use TELNET or SSH or RLOGIN or whatever, and an explicit call to IvtLogMeIn can be used to answer the login dialog of the remote system.

The hopper example makes use of this.


18.5: Password learning: Hooks in the IvtLogMeIn system

There are a number of ways in which a script can influence the login performed by the IvtLogMeIn procedure.
These are:


18.5.1: Hooks: The IvtWaitLoggedIn function


x = Call IvtWaitLoggedIn()
IF !$x THEN RETURN

This function can be called from one thread while another thread is performing an IvtLogMeIn function (this could be caused, for example, by having more than one ONCONNECT statement for the same host).
The function will return when IvtLogMeIn has finished. The return value will be TRUE (1) for a successful login and FALSE (0) for failed login.

In other words, you can be sure the session is logged in and looking at the prompt when IvtWaitLoggedIn returns success. If a PwdAddLoginScript has been defined (see below) then this is called before IvtWaitLoggedIn returns.

See also WAIT_ONCONNECT.


18.5.2: Hooks: The PwdAddLoginScript function


Call PwdAddLoginScript("functionname")

This function can be passed the name of another function. This function will be called by IvtLogMeIn after a successful login. The PwdAddLoginScript can be called multiple times for a single session - all the scripts that are set up this way be will be called after login succeeds in the order they were defined.  This is handy if you have no control over the actual call to IvtLogMeIn, for example:


   PRECONNECT SomeHost Prepare
   Script Prepare
      Call PwdAddLoginScript("DoSomething")
   END
   Script DoSomething
      HIDE
      ... Called when logged in at SomeHost ...
   END

The PRECONNECT calls the PwdAddLoginScript function.
The password learning & autologin system will log you in to 'SomeHost' whenever you make a connection to SomeHost automatically.
When the login has succeeded, the DoSomething script is called, presumably to start some specific application on SomeHost...
It can also be used to do yet another login to yet another host. To the user, that would be seen as one logical login sequence. If, for whatever reason, the action performed by a PwdAddLoginScript fails, it can indicate this to the auto-login system by returning the string "FAIL". Any other return value is taken as success.


18.5.3: Hooks: The PwdAddFindScript function


Call PwdAddFindScript("functionname")

This function can be passed the name of another function. This function will be called by IvtLogMeIn when it cannot find a password for a given user and host. The given function receives two parameters (the host name and the account on that host, see example below).
The PwdAddFindScript can be called multiple times for a single session.
All the scripts that are set up this way will be called in the given order until one returns a password. The function should return the empty string when it does not know the password, or the actual password when it DOES know it. Example:


   ...
   Call PwdAddFindScript("myspecialpwd")
   ...

   Script myspecialpwd host user
      IF $host == "myhost1" && $user == "user1" THEN RETURN "secret1"
      IF $host == "myhost2" && $user == "user2" THEN RETURN "secret2"
      RETURN ""
   END

This can be used in rare cases where you do not want to use the standard password learning system to store the passwords. For example, systems that change their passwords based on some algorithm, or share passwords between multiple users, or any other scheme that does not match the standard system.


18.5.4: Hooks: The IvtLogMeInWait variable


$IvtLogMeInWait

This variable is set to 1 whenever the IvtLogMeIn procedure is waiting for the 'login:' prompt. This is for debugging and development, really. I use it for a thread that fakes a 'login:' on my modem even when I am not connected to any network or remote system. This way, one thread can feed the IvtLogMeIn script the proper prompts, so I can test it without an actual connection.

It can be used by other scripts that want to monitor, or time things.


18.5.5: Hooks: The IvtPwdCfgAutoLogin variable


$IvtPwdCfgAutoLogin

This variable is tested by IvtLogMeIn as one of the first actions. When 1, the system is enabled. A 0 value disables the entire auto-login and password learning code for the current session.
When set to -1, the system behaves as if did not exist. The menu-items for it are greyed out, and it does not interfere with logging in at all. It can be set to -1 by the installation wizard (the Uninstall choice).
It can also be re-enabled this way - by running the installation wizard again.

This variable is turned on and off on a GLOBAL level through the configuration menu, but can be set on a local level if for some reason you do not want the auto-login to show. For example:


PRECONNECT ImportantHost NoAutoLogin
Script NoAutoLogin
   IvtPwdCfgAutoLogin = 0       # Disable system for this session
   IvtPwdShowWin      = 0       # Do not even show the windows.
END

This pretends the auto-login system does not exist for ImportantHost only.


18.5.6: Hooks: The IvtPwdCfgLearn variable


$IvtPwdCfgLearn

When this variable is 1, the password learning system will switch into learning mode when a password is not known, so future logins will be automated.
A value of 2 is used to indicate that the CURRENT session will not be allowed to record the password, overruling any global default configured by the password setup system.
Any other value will prevent the password learning system from learning and/or recording any password.

The value for this variable is changed by the option in the "Create session" panel (Learn/store passwords). The user can use that option to change the default setting for the session he is about to make.

Also, the password configuration system can set this to "On" or "Off".


18.5.7: Hooks: The IvtPwdAlwaysSendUser variable


$IvtPwdAlwaysSendUser

When this variable is set to 1, the PWDLEARN system will always send the username as entered in the "Create session" dialog as a response to anything that looks like a "login:" prompt, even when $AUTOLOGIN is turned off.
This is because most users expect the information in that dialog to be used, even when automatic login has been turned off. The default behavior, therefore, was to ignore the username and let the user login manually (the autologin script simply did nothing when it was disabled, which is the "logical" thing to do).

By setting this variable, you may end up logged-in anyway (even when $AUTOLOGIN is turned off) because SSH may not ask anything else when keypairs are in use, and even TELNET accounts can be without a password...

The default value for this variable is ON, it can be changed using the password configuration script (Fine-tune button).


18.5.8: Hooks: The IvtPwdSkipMetaSearch variable


$IvtPwdSkipMetaSearch

The meta system can be very handy, but in some cases you want to prevent a specific host, user or session from using the meta-passwords.
By setting this variable to any non-empty value, the automatic login system will not attempt to search for a meta-password.


18.5.9: Hooks: The IvtPwdDebug variable


$IvtPwdDebug

Set this global variable to "1" and the PWDLEARN system will print debug on the session screen showing where it gets the information from, which users, hosts, meta-hosts and so on are tried. It will, of course, never show any password values, only information about them being present or absent in the system. Use this when you have complex setups which you want to troubleshoot.

The best place to set this is in an ivt_start.rc file (very early in the startup sequence of IVT).

The password meta-system also looks at this variable and prints debug.
So do the AutoPrompt and AllSessions scripts, which also try to do complex things and have to synchronize with the login-system and each other.
Every line of debug is prefixed with the name of the module that produces it, and shown in reverse video.

In the "util.ivt" module there is a script called IvtPwdToggleDebug that can called from the "Extra->Execute scripts" dialog, to facilitate debugging of the setup. It attempts to show you what is going on beneath the covers.
Warning: Output may be a little overwhelming.


18.5.10: Hooks: The IvtPwdLoginRS232 variable


$IvtPwdLoginRS232

In the days of yore, IVT would expect to find a modem on a serial line that it could use to dial out to remote systems.
Today, hardly anybody will use a Hayes modem to dial out over serial connections, and most users that still use serial ports with IVT will have other equipment installed on those ports.
The default for IVT is to try and login on a serial line. This hook variable can be used to prevent it. When $IvtPwdLoginRS232 is not set to "1", the login system will simply not do anything.

The variable can be set using the fine-tune option of the password learning system, and was added to IVT in version 23.1.


18.5.11: Hooks: The "TERM =" prompt handler

Some (usually older, or misconfigured) systems will prompt the user during login for a terminal type using a "TERM =" prompt.
The user is supposed to type something like "vt220", or "sco-ansi" or whatever emulator is being used. The answer will end up as the TERM environment variable which tells Unix the properties of the terminal being used.
Many full-screen programs use this to find out how to clear the screen, position the cursor, use colors and many other details of the terminal.

This "TERM=" prompt is wrong for many reasons:

If IVT sessions are using IvtWaitLoggedIn, this question can pop up and needs to be answered by IVT. In version 22.3, functionality was added to the pwdlearn script to deal with this. The value of TELNET_TTYPE is used to answer the question. That is normally set to something like "ivt,vt220,vt100,dumb".
Normally, hosts that get an invalid answer (like "ivt" and not having the definition of IVT on the system) will issue an error and try again. On the next try, IVT will answer with the next item in the list.
Normally, that should make you end up with the proper value.

If you are plagued by a system that prompts for the terminal type and accepts "ivt", but then starts complaining afterwards about not knowing what "ivt" is, you can set TELNET_TTYPE to a string like "vt220", so THAT becomes the one and only answer to this silly question.


18.5.12: Hooks: The custom login prompt variables


$IvtPwdCustomLogin
$IvtPwdCustomPasswd

The password learning script must recognize the "login:" and "password:" prompts of the system you are logging in to. However, depending on language, local configuration and so on, this can look like "Username:", "Userid:" "Password for root:" and so on. The standard system recognizes about 95% of all prompts, but that still leaves some that are unrecognized, and in that case the whole automatic login and password learning system fails to function.

Therefore, there are 2 variables that can be set to whatever prompts apply to the CURRENT session. These are added to the set of recognized prompts. The variables to use are:

IvtPwdCustomLogin  - The prompt string for a user name.
IvtPwdCustomPasswd - The prompt string for a password.

If all your systems share a possible alternative prompt, you can use the configuration system (fine-tune button) to set them. You can also use a STARTUP script and global variables to set them in your IVT.RC file like:


   Script STARTUP
      GSET IvtPwdCustomLogin  = "Kindly type your name : "
      GSET IvtPwdCustomPasswd = "Our little secret: "
   END

You can also override or set these variables in a per-session script to make sure you recognize the prompt of some exotic host:


   PRECONNECT some.exotic.host ExoticPrompt
   Script ExoticPrompt
      IvtPwdCustomLogin  = "Who are you? "
      IvtPwdCustomPasswd = "Prove it:"
   END

This sets LOCAL variables, for the current session only.
The PRECONNECT script is called before a session is initiated to the specific host mentioned in the PRECONNECT statement.


18.5.13: Hooks: The IvtPwdCustomQuestion variable


$IvtPwdCustomQuestion
$IvtPwdSawCustQuestion

One of the goals of the password-learning and autologin system is to recognize the fact that the login succeeded, and that you are now looking at a shell prompt of some kind.  This is hard :-)
Some accounts start some other type of program, or ask a question before showing a shell prompt. Example:

ORACLE_SID = [DATABASE]?

When this happens, login WAS successful, but if you use IvtWaitLoggedIn you cannot start sending commands to the session yet because you have to get past the question first. Because IVT cannot know in advance what those questions are (and some are easily mistaken for a Shell prompt), the new variable $IvtPwdCustomQuestion was added to the system (May 2004). The idea is the same as the previous 2 custom variables, you set it to some question that may occur during login. Like this:


   Script Startup
      GSET IvtPwdCustomQuestion = "ORACLE_SID = ["
   END

Note that the part after the square bracket may differ (it is a database name) and is not specified. If IVT logs in under script control, it checks for the string to appear. If it does, it does NOT presume to know how to answer it, but instead concludes that login was successful, and a waiting IvtWaitLoggedIn script will return success. To make it possible for your own scripts to differentiate between looking at the shell prompt and looking at the custom question, the script will set the $IvtPwdSawCustQuestion variable to 1. This allows you to have script to run after login like so:


   Script MyEnv
      LOCAL x

      x = Call IvtWaitLoggedIn()
      IF $x == 0 THEN RETURN   # Login failed
      IF $IvtPwdSawCustQuestion != "" THEN \
         SEND "DATABASE\r" : Call WaitPrompt

      ... Now looking at the Shell prompt ...
   END

When the script finds itself looking at the custom prompt after login, it is answered. When it never happens, the script will immediately start sending whatever you program to the shell ($IvtPwdSawCustQuestion is empty in that case).


18.5.14: Hooks: Various look and feel variables


$IvtPwdColor
$IvtPwdShowWin
$IvtPwdLoginWait
$IvtPwdShellWait
$IvtPwdPopWait
$IvtPwdDelay
$IvtPwdToDisk
$IvtPwdMetaSystem
$IvtPwdMetaUser
$IvtPwdNoShellQuiet

These variables are saved in the password configuration file stored alongside with the encrypted password database. When the file does not exist, the system will create it with default values. Most of them can be changed using the "Fine-tune" button in the password learning system.
You can also override them in a PRECONNECT script.
The current values are saved in a file is called PWDCONFG.IVT.
That file is pointed to by the $IvtPasswdCfg variable, which defaults to $IVTTMPDIR/PWDCONFG.IVT, but that can be overridden in a STARTUP script.

This list is expandable upon request...


19: Thycotic: IVT plugin for integration with SecretServer

19.1: Introduction

SecretServer is a commercial product to maintain passwords and other secrets in a central place for use by administrators, allowing them to gain access to assets without the need to type (or even know) passwords.
It used to be owned by Thycotic, but is now owned by Delinea.

Access to the secret is typically using an HTTPS request that requires authentication, so the secrets are protected. The SecretServer plugin of IVT allows you to configure the address of the server and other details so IVT can obtain the secrets in a secure way (see next chapter for details).

Sessions can be initiated either from within a SecretServer session by clicking on a "Launcher" icon, or from within IVT itself using "Create Session".
SecretServer can launch a local program (like RDP, IVT or Putty) and pass it the hostname, username and password so the program can login on the designated host without needing to type those details.
SecretServer people have created a specialized version of Putty to make this possible, IVT only requires a plugin script to enable the same.

There are 3 ways to use SecretServer with IVT:

1) Configure the plugin (Setup->Password learning->Configure SecretServer)
   and tell it how to obtain secrets. This is the preferred interface.
   Create sessions normally. When IVT needs a password that it cannot find
   elsewhere, it will query SecretServer and obtain the password.
   The AddressBook of IVT can contain an EXTRA clause like TSS_KEY=x,
   in wich case IVT will ask for that specific secret instead of using a
   default scan. See here for details.
   Once properly configured, the communication with SecretServer is almost
   entirely hidden, except for a few progress messages on-screen when IVT is
   talking to SecretServer.

2) Configure a launcher in SecretServer to start IVT like so:


      IVT -B -u ivt://Thycotic;SecretName=$SecretName

   The "$SecretName" in there is SecretServer syntax for the name of the
   currently selected secret. By passing it on the command line of IVT, it will
   create an IVT variable of the same name and value.
   IVT will use that name to query SecretServer and obtain the password in such
   a way that it is never visible on the network or on a command line.
   The secret must contain the "systemname" and "username" attributes, and
   optionally a template name like SSH:P2022.
   The systemname will be used as $HOSTNAME in IVT, the username becomes the
   $USER in IVT, the port number mentioned in the template name is used to
   connect to that specific TCP port.
   The "-u ivt://" will result in a new TAB in an existing IVT, or start IVT
   when it is not yet running.
   To always start a new instance of IVT from the Launcher use:


      IVT -B SecretName=$SecretName Thycotic

   That will create a new IVT window with a single session to the proper host,
   user and port.
   The preferred way is to have a single IVT instance with many sessions, but
   if you prefer the "Putty way" with multiple windows, that is of course
   supported, too.

3) Configure a launcher in SecretServer to start IVT like so:


      IVT -B -u ivt://$MACHINE;SecretUser=$USERNAME;SecretPasswd='$PASSWORD'

   Here the machine, user name and password to use are all SecretServer
   variables which are passed directly from SecretServer to IVT on the command
   line, which IVT will use this to create a new tab with a session to the
   given host and user.
   The advantage is that IVT does not have to connect back to SecretServer to
   obtain the password (which requires credentials and time).
   The disadvantage is that the password is on the commandline of IVT, so
   more visible than ideal..
   Also, a single quote is not valid in the password in this case, since it
   does not survive being passed on the command line.

   If you would rather not have a new tab, but want a new window instead,
   configure the launcher like so:


      IVT -B SecretUser=$USERNAME SecretPasswd='$PASSWORD' $MACHINE

   But that way you may end up with many windows and miss out on many IVT
   features to manage multiple sessions and many tabs easily.

See also Configuring the SecretServer plugin.
See also Integrating SecretServer with IVT address book.


19.2: Configuring the SecretServer plugin

The SecretServer plugin can be configured as follows:

The idea of the plugin is that, once it is configured, you can almost forget about it since it designed to flawlessly integrate with SecretServer.


19.3: Integrating SecretServer with IVT address book

The address book of IVT (as used in PROJECTS files) is essentially one or more HOSTLIST statements in an IVT configuration file.
It fills the address book of IVT (accessible using the notebook icon in the create-session dialog) with the names and characteristics of the hosts in your organization. It can contain a description of the host, the accounts available on it, information about the OS, and arbitrary other characteristics of a host using the EXTRA attribute.

The SecretServer plugin of IVT installs handlers for two such attributes:


Notice that these two handlers also allow you to configure arbitrary naming schemes, using the scripting capabilities of IVT.

Suppose that, just to make things hard, the naming scheme of all the accounts in SecretServer are not nice "host:user" or "user@host" named secrets, but


   Acme_ssh_hostname+user

Where Acme is your company name, 'ssh' for SSH related secrets, the hostname is the name of the host you are trying to connect to, and user is the name of the account. This scheme is not suported by the SecretServer plugin, but this bit of scripting solves that:


   PRECONNECT * MyTSSNames
   Script MyTSSNames
      LOCAL SecretName;

      SecretName = "Acme_ssh_${HOSTNAME_ONLY}+${USER}"
      Call IVT_Handler_TSS_KEY($SecretName);
   END

That says: Before a connection is made to any host, call my script.
Generate the proper name of the secret in SecretServer and act as if every host had an EXTRA entry in the address book that says "TSS_KEY=ProperNameOfSecret".

This can easily be adapted to arbitrary naming schemes.


20: Support programs for IVT

Over the years, a number of support files and utilities were developed for IVT. Currently, these are:

PRIVT Print Unix files on any IVT printer
socks4FW A socks-4 server and port forwarder for IPv4 and IPv6.
termquery Querying a terminal from Unix.
EMU_TYPE Determine type of emulator used at login-time
CLICK.C Mouse interface for Unix scripts!
LOGINC IVT Challenge/Response protocol client for Unix
KEYP Program your (IVT/VT220) keys from Unix
IVT.TIC Terminfo file for IVT
IVTCOM A Unix script to run commands on your IVT PC.
IVTUPGRADE A Windows program to upgrade IVT.

Click on any of the above links for more information.


20.1: PRIVT: Print Unix files on any IVT printer

The PRIVT.C program is distributed as part of the IVT kit. It can be compiled with any ANSI C-compiler on any Unix-like system.
The program can send Unix files to your IVT printers. This is extremely convenient if you have many Unix machines without printers attached to them, and you access those Unix machines using IVT from a PC that has one (or more) (network) printers accessible. PRIVT means you do not have to transfer the files to your Windows environment for formatting and printing, all you have to do is to type:

$ privt -f filename

and the file will be formatted and printed on the currently selected IVT printer (which defaults to your Windows default printer).

Formatting means:

This formatting is built into the privt.c program. Note that using '-t tablength' you may specify an alternate tab length to PRIVT. Tabs in the source file are expanded to the number of spaces specified, which defaults to 8. Using -o topmargin and/or -o leftmargin you can tweak the margins on the printout.

PRIVT is IVT specific - it sends a command to enable binary 8-bit transmission between IVT and Unix (-r flag only). This prevents nasty things happening to your CR/LF/TAB etc. characters that might be in the file. Also, there is a special protocol to negotiate parameters on the command line of PRIVT to the printing sub-system of IVT. This means you cannot use PRIVT in combination with another terminal emulator.

Starting with IVT version 23.1 (December 2012), PRIVT now works as an advanced spooling program to any printer attached to the PC that runs IVT.
You can pass the name of the printer you want to use, and many options to select fonts, orientation and so on. See below for a full list.

The privt program also accepts a '-r' (for Raw mode) flag that disables all formatting and sends the file directly to the printer. In this case, everything is simply sent straight to the printer.
This means that if your Unix box can generate data for a type of printer that is connected to your PC, it can be printed directly! Example:

  $ troff -Thplj -man somefile... | hplj | privt -r

would format the Unix file 'somefile' with troff for an HP LaserJet printer and send it to IVT (which, presumable, has such a printer as the default).
If you have a PostScript printer, I've used this successfully:

  $ pic -Tpsc file | troff -Tpsc -man | psdit | privt -r

The full usage of PRIVT is as follows:


Usage: privt [options] [-t<tab-length>] file[...]
-r   : Turns on raw mode (no formatting, straight print)
-s   : Use IVT as a printer spooler
-f   : Format files for pretty-print automatically
-o controller=raw    Pass data straight to printer
-o controller=cooked Format print according to all options
-o printer=name      Select this IVT printer
-o landscape         Force landscape
-o portrait          Force portrait
-o blackwhite        Force black & white print
-o color             Force color mode
-o bidi              Force bi-directional print ON
-o rtl               Force initial Right-to-left
-o ltr               Force initial Left-to-right
-o no_bidi           Force bi-directional print OFF
-o bidi-type=spec    See BIDI_TYPE in IVT manual
-o scaling           Allow font scaling
-o no_scaling        Forbid font scaling
-o topmargin=N       Force N blank line at top of page (default 1)
-o leftmargin=N      Force N blank positions on left (default 2)
-o font=description  Use this font (see IVT manual FONT)
-o codepage=name     Select this code page (see IVT manual CODEPAGE)
-o title=name        Name of job in Windows spool queue
-o rows=N
-o columns=N         When 'scaling' is allowed, 'rows' and 'columns'
                     are used to scale the font such that the page is
                     at least this size.

When IVT is used as a spooler (-s option), IVT will initialize the printer as it would do normally (like when you use F2 to do a print-screen). This means that all properties of the job will be the default of the printer (system or set by you). Then the parameters specified on the command line of PRIVT are applied, so you can override the defaults for every job.

When you use the option "-o scaling" in PRIVT, you can use the "-o rows" and "-o columns" to specify the minimum number of desired rows and columns.
IVT will the use the specified font and scale it such that the result fits the pages (given the selected paper size, topmargin and so on).
This can result in very oddly stretched fonts and ugly output, so a little experimentation may be required to achieve the best results.

Note the bidi, ltr, rtl and bidi_type options: they can be used to specify special left-to-right or right-to-left bi-directional properties for the single print job. Especially bidi_type can be used to override the treatment of particular characters in the current print job without affecting the normal treatment of these characters by IVT.

Also note that PRIVT uses any IVT printer, which can be a plain file.
This can be used as a file transfer method (if more conventional methods such as FTP or IVT file transfer fail) by doing:

The file will be transferred (during which a printer icon will show in the status line) into the file you typed in step 1. The transfer is ready when the icon disappears. It should be a byte-for-byte copy.

Example of IVT as a spooler:


$ date | privt -s -o landscape -o font="Facename=Courier New,points=15" \
         -o topmargin=5 -o titel="This is a test'

This prints the output of the "date" command in a large font on a landscape page (if the printer supports all that).


20.2: socks4FW.c: Socks4 server, client and port forwarder

IVT supports the use of a proxy server, which can be used to force connections through a proxy server to enhance security, but can also be used to play creatively with firewalls and networks (to bypass, connect or circumvent).

For example, the simple SOCKS-4 proxy server protocol can be used to implement a server on a machine with 2 network interfaces. IVT connects to the socks server using the first interface, requests it to connect to a server that sits on the second network, and makes it look like that remote server can be reached directly (the socks layer is almost transparent).

Strangely enough, I could not find an (open) source of a simple SOCKS-4 server, when I was looking for one on the Internet. The ones I could find all supported many proxy protocols with embedded authentication and security, thus requiring cryptographic packages with many dependencies. Also, such packages almost invariable forked a process for every incoming connection. I want to use this server on a proxying host for hundreds of simultaneous users, so lightweight, speed, single-process and single-threadedness are required.

Another function I missed was a program that can be used as a CLIENT for a proxy, usable by the OpenSSH suite of commands using "-o ProxyCommand".

So, I wrote my own, doing all this: Socks4FW.c (SOCKS-4 server and port ForWarder), and made it part of the IVT distribution.
NOTE: For version 23.0 of IVT, both IVT and this support program were updated to support IPv6.

The program can be compiled on any Unix like (AIX, Linux, HP-UX and so on) and functions as a simple, lightweight SOCKS-4A server (IVT can use it, of course).
It can also be a client for a socks server, so it can be used with a proxy command in OpenSSH (see example section below).

Another function that is very similar to the SOCKS protocol is port forwarding.
In that case, the server accepts connections on a particular port, and any incoming connection is immediately forwarded to a fixed host and port number.
The Sock4FW.c program implements that, too.

Lastly, it can do the same for UDP (datagrams), so it can accept UDP messages, forward them to some remote host and forward any SINGLE reply to the requestor.

An important feature is that the program supports both AF_INET sockets (which use an actual network) and AF_UNIX sockets (also called local domain sockets as these are used to communicate between processes on the same machine).
This feature allows the program to forward between external and internal traffic, this can for example be used to make a locally running OpenSSH ssh-agent program accessible from the network, or to make such an agent accessible by other users than originally intended (not necessarily a Bad Thing).

The usage of the program is (when started without any arguments):


Ruurd Beerstra's SOCKS4(a) and port-forwarder client/server.

Usage: ./socks4FW [-CDef64u] [-d lev] [-R retries] [-S port] [-F forw]
      [-U forw] [-h ProxyServerNm] [-p ProxyServerPort] [host port]...
-C         : Client mode (connect to a proxy server)
-R retries : Retry client connection attempts N times
-t secs    : Timeout for outgoing connection in client mode
-D         : Demon mode
-e         : Debug to stderr instead of /tmp/socks4FW.debug
-u         : Resolves hostnames using both IPv4/6 (UNSPEC)
-4         : Resolves hostnames using IPv4 only
-6         : Resolves hostnames using IPv6 only
-d lev     : Set debug level. Level 0 - 3
-f         : Fork into background
-S port    : Start SOCKS-4 server on named port
-F ...     : Start STREAM port forwarder on local socket
-U ...     : Start UDP port forwarder on local socket
forw       : Syntax is 'localaddress:remoteaddress'
             Local address is 'number'  (local INET socket)
                           or 'UN:name' (local UNIX socket)
             Remote address 'host:port' (remote INET address)
                         or 'UN:name'   (destination UNIX socket)
Examples:
./socks4FW -F 123:remhost:22 # Forwards local TCP port 123 to remhost port 22
./socks4FW -U 153:remhost:53 # Forwards local UDP port 153 to remhost port 53
./socks4FW -F UN:/tmp/SSHKEY:UN:$SSH_AUTH_SOCK # Proxy for SSH authentication

This version will automatically LISTEN on both IPv4 and IPv6 sockets for
connections.

The "-S port" option will cause the program to become a SOCKS-4 server on the given port (this option can be used only once, and works only on a INET type socket). The new version of the program will automatically listen on both IPv4 and IPv6 ports and offer the SOCKs service on both ports. IVT can be a client for this service, of course.

The "-F forw" option can be used multiple times. The 'forw' has two parts:

For a TCP/IP (AF_INET) connection, the first part is a port number, and the second part is a hostname:port.
For AF_UNIX local sockets, they take the form of UN:name.
The program will listen on the first address and forward all incoming traffic to the remote address (and replies back to the originator).

NOTE: The current setting of the -u, -4 and -6 parameters determine what protocol socks4FW will use for the outgoing connection. When the hostname is resolved, -u will use "Unspecified", meaning that whatever address is returned (IPv4 or IPv6) will be used. Version 4 can be forced using -4, and version 6 can be forced using -6. The default (-u) should work in most cases, but as the world is moving to IPv6, it can happen that IPv6 addresses are assigned but not in active use, causing connection failures. In that case, forcing IPv4 may help. Later, when IPv4 is being phased out and stops working, forcing IPv6 may help. There is no quick fix for this.
The -u, -6 and -4 options can be used multiple times. When a -F or -U option is used, the current setting is used for that particular channel.

The -U forw can be used multiple times too (and mixed with -F and the -S options).
It forwards UDP, so it listens for UDP messages, forwards them to the given address, waits for any reply (it is not required that there IS a reply) and forwards such a reply back to the originator. This can be used, for example, to proxy DNS. Currently, only ONE reply is forwarded. I'm not sure if this is The Right Thing to do, I can imagine that some protocols could send multiple reply packets given a single request packet. However, this would require that I wait for some arbitrary time before discarding the administration data of the original forwarded request, which also looks ugly.
If anyone reading this has suggestions on how to fix this, I'm all ears!

The -D option will start a server in demon mode (severing connections with the Unix terminal and so on), the -f option will automatically fork off a server into the background.

The -C option starts the program in client mode, it will connect to a proxy server specified using the -h and -p arguments (host and port).
It will the ask the proxy server to connect to the target host and port (given as last 2 arguments on the command line). This is designed to be used inside an OpenSSH command like:


ssh -o "ProxyCommand socks4FW -C -h proxyhost -p 222 %h %p" faraway

This would cause the SSH command to invoke socks4FW. The %h and %p parameters are replaced by SSH by the real hostname and destination port (in the example that would be 'faraway' and '22' respectively). So, socks4FW will connect to the proxyserver on host 'proxyhost', port 222 and request it to connect to host faraway, port 22.
When IPv6 is used, the socks4FW program can possibly resolve an IPv6 address, and send the ASCII representation of that address to the proxy server.
A proper SOCKS server implementation (like the socks4FW program running in server mode) will recognize that format and set up an outgoing IPv6 connection.
If the hostname cannot be resolved, the name ITSELF is sent to the proxy server, hoping it will have greater powers of name resolving and will succeed in connecting.

More examples:


socks4FW -Df -4 -S 5555 -u -F 2323:shitec:23

Starts a demon in the background that listens on port 5555 and provides socks-4A service on that port, using only IPv4 addresses.
It also listens on port 2323 and forwards all incoming connections to the host called shitec, port 23 (telnet), where the "shitec" is resolved using an UNSPEC mode (the -u) for resolving, so it will work with either IPv4 or IPv6, depending on what is returned by the resolver as primary address.

A local AF_UNIX example:


socks4FW -fD -F UN:/tmp/SSHKEY:UN:$SSH_AUTH_SOCK

This would start a server in the background (the -fD option). It creates a local UNIX domain socket (using the local file name /tmp/SSHKEY) and forwards all incoming connections to YOUR ssh agent (identified by a pathname stored in the environment variable $SSH_AUTH_SOCK). This can be used to make an agent accessible to others, which is normally impossible because the agent checks that connections originate from processes with the proper user-ID. Since all such connections now come from the socks4FW program, the user-ID is always the same and correct...

Another client example:


scp -o "ProxyCommand socks4FW -C -h proxyserver -p 222 %h %p" fl remhost:/tmp

The OpenSSH SCP command is passed a ProxyCommand option.
The proxy command substitutes '%h' and '%p' on the command line of the socks4FW command by the actual hostname and portnumber of the target (which would be remhost and port 22 in this example).
The socks4FW would connect to port 222 of host proxyserver and expect a proxy server there (like another instance of socks4FW running in server mode).
It would request a connection to remhost port 22, and the net effect will be that the file will be copied to the host on the other side of the proxy connection (assuming authentication and so on is successful).


20.3: TERMQUERY: Query a terminal from Unix

Terminal emulators like IVT can be sent various escape sequences that cause then to respond to the host. Such queries can be used to interrogate the type of terminal, various operating parameters and so on.
IVT has a few special commands that can be used to retrieve information about the host, user and environment that IVT runs on.

The problem with such commands it that it uses the same channel as the normal keyboard, so the responses to such queries look like keyboard input to the host doing the query. On Unix, this will normally be echoed back to IVT.
With a little bad luck, such an echo will look like a new query, triggering an endless series of queries and responses.
Another problem is that the user can be typing normal data while the query is performed, interfering with the process.

The termquery.c program that is part of the IVT distribution tries to solve these problems by reading the keyboard type-ahead buffer of Unix, sending the command and reading the response, followed by a restore of the type-ahead buffer. This works well, in practice. For example, the following snippet of shell script retrieves the value of the USERNAME environment variable of the PC that IVT runs on:


   Username=UNKNOWN
   PCname=UNKNOWN
   Resp=$(termquery "\1B\sVUSERNAME\n")
   [[ $Resp == +(1 *) ]] && Username=${Resp#1 }

   Resp=$(termquery "\1B\sVCOMPUTERNAME\n")
   [[ $Resp == +(1 *) ]] && PCname=${Ans#1 }
   

This first bit sends an ESC, space, V, "USERNAME", enter.
This is interpreted by IVT as a command to send the value of the environment variable USERNAME, preceded by a "1" and a space, and followed by a new line.
If the requested variable does not exist, only a "0" followed by a newline is sent. The second line of the script removes the "1 " and assigns the value of the username when the request was successful.
It then does the same for the name of the PC IVT runs on. Now the script knows the name of the Windows user and the PC being used, irrespective of firewalls, address translations, network hopping or whatever.

So the simple termquery.c program allows a Unix script to retrieve some essential information from the PC in a fast and reliable way. Note that you cannot use this for important security or access decisions: the responses can be manipulated!

Termquery does not just work for IVT, any terminal that can respond to queries can be handled this way.


20.4: EMU_TYPE: Determine type of emulator used at login-time

When you log in to a Unix system, the TERM environment variable needs to be set to the proper terminal type. The most effective way on TELNET sessions is to use the TELNET_TTYPE command of IVT. Most hosts nowadays support the proper RFC for this, and will query a list of terminal types and pick the first one they can support. So if you set this to ivt,vt220,vt100,dumb you will end up with something that works "best".
However, some hosts simply take the first one in the list, even when they do not know about "ivt". The SSH protocol does not support a list (only a single type).
The serial protocol does not have room for this information at all.

So, there can be various circumstances where you end up with the wrong terminal type set in TERM. The emu_type program is one possible solution. It runs on Unix and sends an identification request to the terminal. It analyzes the answer and prints the type of terminal on standard output, thus allowing you to write a line like the following in the login scripts:

  TERM=$(emu_type)

There are a few disadvantages to this scheme:

Having said all that, it may still work very effectively when you only use 1 or 2 different emulators at your place of work and can alter the emu_type program (or the configuration of the emulators) to make it work.

The emu_type.c program should compile on most flavors of Unix by just typing:

   make emu_type

Your Mileage May Vary.


20.5: CLICK.C: Mouse interface for Unix scripts!

The Unix program "click.c" is a tool that can be used to write shell scripts in Unix that respond to the mouse!
Terminal emulators that support XTERM mouse mode (such as PuTTY and IVT) can receive a command from the host to change the behavior of the mouse.
Instead of the normal cut/paste operation, IVT will start sending escape sequences to the host that identify the button being pressed or released and the current position (row, column). The click.c program does the following:

The upshot is that a shell script can receive notification of a keystroke or mouse event.

Its usage is as follows:


Usage: click [-uxe] [-t timeout] [PID]
Waits for a mouse/keyboard event.
-u: Also reports mouse UP event (discarded by default)
-x: XTERM mouse mode assumed - don't bother turning it on/off.
-e: Echo plain typed characters (not special keys)
-t: print 'TIMEOUT' and quit when nothing happens after timeout seconds.
When a PID is specified, CLICK will exit when that process dies.

For example, starting "click" and using the mouse to click in the top left corner of the screen gives:
MOUSE 0 1 1

Which means the mouse button 0 (left) was used to click on row 1, column 1.
The right-hand button is number 2, the middle button is 1.

When a key is typed, the output is:
CHAR 109 m

Which means a character was typed, the decimal code and the ASCII character.

When a ^C is typed, it will print SIGINT and exit.
When a ^D is typed, it will print EOF and exit.
When a cursor key is used, it will print the name (KCUD1 for Down 1, etc).
When a function key is used, it will print some of the names, the internal table of click.c is not quite complete at the time of writing.

The source of the program is part of the IVT distribution, so it can easily be adapted to suit any particular need.


20.6: LOGINC: IVT Challenge/Response protocol client for Unix

NOTE: This program is superseded by either SSH or GSSAPI.

The LoginC program is a drop-in replacement for most Unix machines /bin/login program. It implements a challenge/response protocol that prevents passwords from being transmitted in the clear over unsafe connections (such as provided by standard TELNET and RLOGIN connections).
The idea is to replace the /bin/login by the LoginC program, since all telnet servers, rlogin servers and other ways to login to the machine eventually call /bin/login to do the actual authentication.

LoginC is a wrapper around /bin/login. It checks if the TERM environment variable contains "ivt". If it does, it starts a challenge-response login which allows the user to login normally, using the Unix user-ID and the normal Unix password. However, the password is never sent to the remote host.
The "challenge" is a random string, which is sent from LoginC to IVT.
IVT prompts the user for a password, which is LOCALLY encrypted by IVT using the standard Unix password encryption algorithm.
The resulting encrypted string is what is stored in the /etc/shadow file on the Unix host. IVT then encrypts the random challenge string with the encrypted password, and sends the result to the host.
The LoginC can also use the encrypted password from the /etc/shadow file to encrypt the random challenge string, and compare the result with the response received from IVT.

When they match, the password typed by the user must have been correct.

An eavesdropper on the network never sees the same challenge, so replaying a previous sniffed response will not work. No useful knowledge is gained by sniffing the network, while the user can use a normal-looking Unix login procedure.

Advantages of the scheme are:

Disadvantages of this scheme are:

Rewriting the current LoginC as a PAM module instead of a wrapper around /bin/login would improve some of the disadvantages.
However, Kerberized login, or Secure Shell are much more robust methods to login securely and are preferred over LoginC. IVT supports these.


20.7: KEYP: Program your (IVT/VT220) keys from Unix

The keyp program can be used to program VT220 and/or IVT keys from Unix.
Its usage is as follows:


USAGE: keyp KEYNAME text...
   OR: keyp DEFAULT
   OR: keyp RESET
   OR: keyp SCAN_LOC Code1 Code2 text
   OR: keyp SCAN_ALL Code1 Code2 text

KEYNAME Can be any of the following:
F5 - F20       Standard VT220 keys
PF1 - PF4      IVT only (CTRL+F1 - CTRL+F4)
FIND           IVT only (HOME)
INSERT         IVT only (INSERT)
REMOVE         IVT only (DELETE)
SELECT         IVT only (END)
PRVSCR         IVT only (PAGE UP)
NXTSCR         IVT only (PAGE DOWN)

DEFAULT        IVT only (sets VT220 defaults)
RESET          IVT start-up defaults

Above are PER SESSION, SCAN is for ALL sessions.
SCAN_ALL       IVT only (program ANY key using scan code)
SCAN_LOC       IVT only (program ANY key using scan code)
               Use Keyboard Debug to obtain 2 Key-Codes.

Any VT220 understands escape sequences to program the standard function keys (F6 - F20). The keyp program generates these sequences, e.g.:

  $ keyp F6 "echo Hi there!\r"

programs the F6 key (for the current session only) to emit the given string.

The SCAN_ALL and SCAN_LOC functions allow you to program a key from the host based on the scan-codes of the PC keyboard (ctrl and alt combinations). This feature works for IVT only.


20.8: IVTUPGRADE: Automatically upgrade an IVT installation

As was explained in the topic about VERSION_SERVER, you can have a server in your network that contains a master copy of an IVT installation for your users.
When a new version comes out, you can update this master copy on the network.
Part of that installation must be that you configure a VERSION_SERVER for those users as part of the configuration, and that line points to a server (not necessarily the same as the one that holds the master copy of the distro).
The ivtversion server knows the IVT version of the latest IVT, the build number, and the location in the network where it can be downloaded from.
Also, it can contain text describing new features, or other reasons why the user should upgrade.

When a user starts IVT (or once every 24 hours thereafter), IVT will query this server to see if it has become outdated.
When the ivtversion server returns a newer build or a higher version number, IVT knows it is outdated and tries to convince the user to upgrade.
When the user clicks the "upgrade now" button, IVT starts the ivtupgrade.exe program (part of the distribution), passing it the name of its own installation directory ($IVTDIR), and the download location retrieved from the version server. Actually, before starting the IVTUPGRADE, it copies the IVTUPGRADE executable to the temp directory and executes it from there, so the upgrade program itself can be upgraded, too.

The IVTUPGRADE.EXE copies the entire directory tree from the given location to the (local) installation directory, testing for particular errors and trying to make sure that the user ends up with a valid, working copy.

When the UPGRADE.EXE program is omitted from the installation directory of IVT, the "Upgrade now" button is omitted and the user will have to make a manual copy.

The source of the IVTUPGRADE and IVTVERSION programs is part of the IVT distribution.


21: List of startup tips

This is the complete list of startup tips. When TIPS are enabled, IVT will choose a random one from the list below.

______________________________________________________________________
All sessions the same size
SIZE4ALL
All sessions can inherit the size of the foreground session automatically using SIZE4ALL.

______________________________________________________________________
Selecting words with the mouse
MOUSEADVCUT
You can use the mouse to quickly select words and/or lines by clicking on a word with the left-hand button, and WHILE KEEPING THAT BUTTON DOWN, click and release the RIGHT-HAND button. Every time you click the second button, IVT will select a 'wider' definition of a 'word' until the entire line is selected.

______________________________________________________________________
Toggling between sessions
SESMGT
When you use ALT+t, IVT will switch back to the 'previous' session, very handy to alternate between two sessions.

______________________________________________________________________
Clock in status line
STATMIDDLE
When you use the mouse to click on the position of the clock in the status line, IVT will alternate between clock, position of the mouse, position of the cursor and nothing.

______________________________________________________________________
Creating a session without autologin
SESMGT
Ctrl+PageDown creates a session and logs you in.
Ctrl+PageUp creates a session WITHOUT logging in.

______________________________________________________________________
Programming keys
KEYMACRO
Use the KEYMACRO command in an IVT.RC file to program the standard function keys. For example:

KEYMACRO "F12" "ls -lab\r"

______________________________________________________________________
Mouse click on session numbers in status line

When you click on the FIRST number on the status line you will move to the PREVIOUS session (equivalent to using Ctrl+CursorLeft.
The SECOND number moves to the NEXT session (equivalent to using Ctrl-CursorRight.

______________________________________________________________________
Click on session description
F4-S
When you click on the part of the status line that shows the session comment you can edit it directly.

______________________________________________________________________
Host can set comment via ESC<space>C

Your Unix login script can send a description of the session to IVT using a statement like:

     echo "\033 C$LOGNAME on"`hostname`

A string like "root on machine1" will appear in the status line.

______________________________________________________________________
F1 for immediate Hold Screen

F1 is an immediate 'hold screen'. The effect is more immediate than CTRL-s. A stop sign icon will appear in the status line.
Pressing F1 second time will free up the session again.

______________________________________________________________________
Disconnect from host using ALT+F4
SESMGT
When you use ALT+F4 IVT will forcibly disconnect the one session from the host.

______________________________________________________________________
F4-S for session overview
F4-S
Typing F4-S will give a session-overview screen that allows you to re-order, rename and group sessions.

______________________________________________________________________
F4-N for new features
F4-N
Typing F4-N will bring you to a news screen that describes new features in IVT (added in the latest release).

______________________________________________________________________
Ctrl+F6 for sub shell

Typing Ctrl+F6 will 'shell out' of IVT and give you a command prompt.

______________________________________________________________________
ALT+c for keyboard COPY operation
CUTPASTE
ALT+c will enter COPY mode, allowing you to copy areas from the screen to be pasted later.

______________________________________________________________________
Top-row of numeric keypad for PF1-PF4
NUMERICF1F4
IVT defaults to mapping the top row of the numeric keypad (Numlock, /, * and -) to the VT220 function keys PF1 - PF4.

______________________________________________________________________
Change speed with ALT+s ALT+q
SPEED
When output scrolls too fast to read you can use ALT+s to Slow it down. Use it a number of times to make it *very* slow.
ALT+q (Quicker) can be used to speed it up again.

______________________________________________________________________
Viewing data that scrolled from the screen HISTORY
Data that has scrolled from the top (or bottom) of the screen can be viewed by typing ALT+PageUp.

______________________________________________________________________
Turn off the CAPSLOCK key
CAPSLOCK
The NO_CAPSLOCK command in your IVT.RC file will prevent the CAPSLOCK key from having any effect within IVT.

______________________________________________________________________
Navigate the HELP system with the keyboard

Using the TAB key will select the next hyperlink, ENTER to follow the link, BACKSPACE to return.

______________________________________________________________________
Navigate the HELP system with the mouse

Any link can be clicked on with the mouse to follow that link. Right-hand mouse button returns one level of link in the manual pages.

______________________________________________________________________
Size of the cursor
CURSOR_HEIGHT
The size of the cursor can be set using the CURSOR_HEIGHT command in your IVT.RC file.

______________________________________________________________________
Mouse cut/paste
CUTPASTE
The left mouse button can be used to copy, the right-hand button does a paste.

______________________________________________________________________
Mouse in VI mode
MOUSE-VI
The mouse can also emit VI-cursor-positioning commands, so you can click in old-style VI text screens and move around with the mouse! See also MOUSE_KEY.

______________________________________________________________________
Multiple COPY buffers
CUTPASTE
If you select an area with the mouse, and press a key before releasing the mouse, the selected area is stored in a named buffer. Such a buffer can be pasted by keeping the right-hand button down while pressing the same key again.
Existing buffers can be viewed with F4-K.

______________________________________________________________________
Toggle COPYmode during COPY
CUTPASTE
When you press the F1 key during a COPY operation, IVT will toggle the mode between LINE-select and BLOCK-select.

______________________________________________________________________
Print area selected by COPY
printer
When you press the F2 (print) key during a COPY operation, IVT will print the selected area to the current printer.

______________________________________________________________________
ColorCut: Colors used during CUT operations COLOR_CUT
The COLOR_CUT keyword in the IVT.RC file determines the colors used during a CUT operation.

______________________________________________________________________
Multiple sessions
SESMGT
IVT supports multiple sessions in a single window, all of which are simultaneously active.

______________________________________________________________________
Switch sessions with ALT+1 ALT+9
SESMGT
When you have multiple sessions active, ALT+1 will switch to the first, ALT+2 switches to the second, etc.

______________________________________________________________________
TABs are draggable
TABSBAR
The tabs in the tabs bar can be dragged to a new position to re-order your session setup.

______________________________________________________________________
Switch to FIRST and LAST session
SESMGT
When you use Shift+Ctrl+Cursor-Left  IVT will switch to the FIRST session.
When you use Shift+Ctrl+Cursor-Right IVT will switch to the LAST session.

______________________________________________________________________
Background activity indicator
FRIEMEL
When you have multiple sessions, essential information about the background sessions (the ones you are not currently looking at) is displayed in the activity indicator in the status line.

______________________________________________________________________
Screen saver
Ex-SCRSAVE
IVT can be configured to blank the screen after a specified number of minutes.
Any key will make the session reappear.

______________________________________________________________________
Write your own screensaver script
Ex-SCRSAVE
When a script called SCREENSAVE exists, IVT will call that once per second while the screensaver is active. Click "More Info" for an example script.

______________________________________________________________________
Keyboard key click
CLICK
Specifying CLICK in your IVT.RC file will enable a key click.

______________________________________________________________________
Saving help with ALT+s

In the manual pages you can use ALT+s to save the current topic to a file (handy for examples).

______________________________________________________________________
Screen debug mode
F3-DEBUG
In setup (see "More Info") you can enable hex dump mode for the session. Incoming data will be displayed in hex-format and not otherwise acted upon by IVT.
This is handy when you want to know exactly what a host is sending you.

______________________________________________________________________
Keyboard macros via F3-L
LEARN
Keys can be programmed in LEARN MODE, which is invoked with F3->Keyboard Macros.
Programmed keys can be saved in a file which is (optionally) loaded at start-up.

______________________________________________________________________
Shift+Ctrl+End: Ends learn mode
LEARN
During keyboard macro definition you can end learn mode using Shift+Ctrl+End.

______________________________________________________________________
TCP/IP host name with HOSTNAME:PORT

You can connect to other ports than the default 23 (for TELNET) by specifying the port number after a colon as part of the hostname. Example:

        IVT www.wxs.nl:25

will connect to the SMTP port of that host.

______________________________________________________________________
TELNET_TRACE option
TELNET_TRACE
When TELNET_TRACE is active, IVT will display the complex protocol negotiation between host and IVT at the start of a TELNET connection.

______________________________________________________________________
Script language
SCRIPT
IVT supports an extensive scripting language that allows you to automate many tasks (session creation, logging in, common actions on the host, etc). The language is fully documented right here...

______________________________________________________________________
Switch to another session while in pager HISTORY
When you are viewing HISTORY data, you can still switch to another session.
The 'viewed' session will remain blocked until you exit the viewer.

______________________________________________________________________
Saving history data
HISTORY
When you view HISTORY data, you can save the entire history buffer for the current session to a file using ALT+s (for save).

______________________________________________________________________
Recording sessions
AUTOLOG
The AUTOLOG feature of IVT can log all sessions to a file, with optional date-stamps and hostnames in the filename.

______________________________________________________________________
Support for serial lines
SERIAL
IVT can also be used to access serial lines and dial out over a modem.

______________________________________________________________________
Modem indicator
MODEMIND
When you use IVT over a serial line, the modem indicator on the status line will show the state of the connection.

______________________________________________________________________
Table of contents
TOC
The manual pages have a table of contents that gives another way to quickly find information there.

______________________________________________________________________
Searching the manual for keywords
HELP
The manual pages can be searched by using the '?' command (or '/') for any phrase or keyword.

______________________________________________________________________
Variable screen size
WINDOW_SIZE
The number of rows and columns on your screen can be set using the WINDOW_SIZE command, or by Setup->Resize.
The new size is automatically communicated to the host.

______________________________________________________________________
Visual bell
BELL
You can use the BELL command to set a "visual bell".
Instead of making noise, the screen will flash - convenient for noisy applications...

______________________________________________________________________
Bell sound
BELL
You can set a more business-like sound for the BELL using the BELL BEEP command.

______________________________________________________________________
To BACKSPACE or to DELETE
BACKSPACE
Some hosts use the DEL character to erase typos (instead of BACKSPACE). You can use the BACKSPACE DELETE command or the
BACKSPACE BACKSPACE
command in your IVT.RC file.

______________________________________________________________________
Reset the terminal with F3-R
F3-R
When you do F3->Reset, IVT will reset the terminal.
Use this when the terminal is in a strange state (e.g.
after CATting a binary file).

______________________________________________________________________
ALT+a for ALERT mode
F3-ALERT
When you type an ALT+a, IVT will put that session in ALERT mode. Every time data arrives on the session, the BELL will ring. Handy when you have long running commands and you want to be woken up when something happens.
Typing another ALT+a will disable alert mode.

______________________________________________________________________
Status line session description
STATUSTXT
The session comment can be set from a script, the host, HOSTLIST command, or manually.

______________________________________________________________________
Show current location in this manual
INTRO
At any time in the help system, you can type 'w' (for 'where am i') and IVT will pop-up a description of the current page.

______________________________________________________________________
Setup screens
SETUP
Use F3 to view and modify many different attributes of the current session.
Every item has context-sensitive help (right-click).

______________________________________________________________________
Case sensitivity in searching manual

Searching the manual pages is by default case insensitive; this can be changed with the 'c' command.

______________________________________________________________________
Locking the keyboard
PASSWORD
The keyboard can be locked with ALT+L when you have set a PASSWORD for it.

______________________________________________________________________
Automatically lock keyboard
LOCKTIMER
The keyboard can be locked after LOCKTIMER minutes of inactivity. Unlock with a PASSWORD.

______________________________________________________________________
Creating groups of sessions
CREATEGROUP
VERY POWERFUL: Create groups of sessions with a simple mouse click with CREATEGROUP.

______________________________________________________________________
Shell prompt indicator
Exp-Green
The status line indicator for background sessions can be made GREEN (ready) by your shell prompt.

______________________________________________________________________
Reconnect lost sessions
RECONNECT
Normally, disconnected sessions cause the virtual terminal to disappear. Use RECONNECT to change this.

______________________________________________________________________
Host-specific actions
PRECONNECT
The PRECONNECT and ONCONNECT triggers allow you to customize sessions (anything you can script).

______________________________________________________________________
STARTUP scripts
STARTUP
You can have multiple scripts called STARTUP which can customize your environment when IVT starts up.

______________________________________________________________________
File transfer
FTP
IVT supports X/Y/Z modem file transfer. Can be under script control, too!

______________________________________________________________________
Drag & drop file transfer
ONDROPFILES
The ONDROP trigger allows you to write a script that processes objects dropped on the IVT window.
The default script sends those files to the host using zmodem!

______________________________________________________________________
Discarding garbage host data
F3-D
Typing F3-D will dump all incoming data until it becomes quiet. Handy when you CAT a binary file...

______________________________________________________________________
Customizing dialogs
IVT_DIALOGSTATE
Every item in a dialog, and every menu item that IVT can display can be either disabled or omitted using the IVT_DIALOGSTATE directive.

______________________________________________________________________
Choosing interface language
IVT_LANGUAGE
The language in which IVT displays the dialogs and menus can be chosen using IVT_LANGUAGE.
You can even write your own translation files to adopt IVT to a new language, or make your own custom interface.

______________________________________________________________________
Customizing keyboard
KEYMACRO
The KEYMACRO command allows you to program keys in combination with Ctrl, Shift, Alt, Capslock and Numlock to do just about anything.

______________________________________________________________________
Programming modifier keys
KEYMACRO
Keys like Ctrl, Shift and Alt can be programmed to execute some function when used by themselves.
For example, pressing both Ctrl keys together shows where the cursor is. Try it now!

______________________________________________________________________
Using built-in functions of IVT
IVTFUNCTION
The script function IVTFUNCTION allow scripts to access just about all internal features of IVT and execute them under script control, or bind them to a (mouse) key.

______________________________________________________________________
Window transparency
TRANSPARENCY
You can make the IVT window transparent using the TRANSPARENCY directive.

______________________________________________________________________
Changing font
FONT
The font can be changed from Setup->Change font or with the FONT keyword.

______________________________________________________________________
Extra window border room
VSPACE
You can change the amount of unused space between the window border and the window contents using the VSPACE and HSPACE keywords.

______________________________________________________________________
Drag & drop functions
ONDROPFILES
You can write scripts to process dropped files, for example to send them with the ZMODEM protocol.

______________________________________________________________________
Thin lines on screen
VERTICAL_LINE
The VERTICAL_LINE command can be used to have one or more thinly visible lines on the screen to indicate a certain position (such as column 80).
Handy if you want to keep line lengths within bounds.

______________________________________________________________________
Proxy servers
Proxy
IVT supports various types of proxy servers.
Allows various flexible ways to contact remote servers through firewalls and so on.


22: Examples

22.1: Introduction to examples

This chapter contains a number of useful examples of IVT configuration files, scripts and such. They are referred to from the main body of the text where appropriate, but you can also click on one of the items listed below.

Any item can be saved using ALT+s, so you can copy and paste it into your own script and configuration files.

Script to log on to a host automatically.
Script to maintain common passwords (shared between users).
Script to provide a context menu per host
Script to program the Unix PS1 prompt to pass info to tab, title and status.
Script to hop from one system to another.
Script to broadcast what you type to all sessions.
Script to process an arbitrary hash.
Managing projects.
Increasing/decreasing the current font.
ALT-Click on text, start URL
Script to dial out through modems.
Script to replace numbers on screen by human-readable versions.
Manipulate the registry in scripts.
Script to read line from keyboard.
Script to be used by the screen saver.
Waiting for any sort of prompt.
Starting and stopping IVT threads.
Keyboard watcher that translates what you type.
Sending files via escape sequences from PC to host.
Automatically set a proxy for some hosts and not others.
Keeping a session alive.
Intercepting 'Shell will timeout'.
Dropping files on the IVT windows.
Extending the escape sequence command set of IVT
Real-life example of programming a microprocessor board


22.2: Script to replace numbers on screen by human-readable versions

This script is handy on AIX systems that lack a Linux-like "ls -lh" to make big numbers easily readable. If you are like me and cannot instantly see that 4796313216 is about 4.4 GB and 72735346536 is 67.7 GB then you can assign the HumanReadable script to a function key. Example:


BIND F12 HumanReadable

When you press F12, all numbers on-screen will be replaced by readable versions (one decimal place, closest unit of KB, MB, GB, etc).
Pressing F12 again will restore the previous screen.
The script works by actually altering bits of the screen, remembering what is altered and restoring altered bits. That works only when the screen is not altered by the host (or you) between the two calls.
To make sure that restoring the screen does not corrupt anything, the script checks for such modifications. So, the script has its limitations, but can be a very convenient thing to have, which is why it is part of the standard distribution of IVT. This is the script, taken straight from the real source:


# This routine finds all numbers on the screen and turns big numbers
# into human-readable kilo, mega, giga or tera (etc) units, much like the
# Linux "ls -h" option does. if you do a:
# BIND F12 HumanReadable
# the F12 will act as a toggle to switch between human readable
# and original values.
# Also installs an entry in the 'Scripts' menu.
#
#  Author: Ruurd Beerstra
#  Date  : 08/02/2013
#
########################################################################
# Having a package allows me to have session variables like "Flip"
# without having to worry about name conflicts with other scripts
PACKAGE      "HumanReadable";
PUBLIC SCRIPT HumanReadable;    # Expose this interface
PUBLIC GLOBAL HumanReadableUnit;        # Set to 1024 or 1000.
########################################################################
Script ResetLanguage
   Call IVTRegisterPlugin( \
        CalledBy(0,"FILE"), \
        NLS("MN_1H","Make all numbers human-readable"), \
            "Ex-HumanRead", "HumanReadable");
END
########################################################################
ONLANGUAGE ResetLanguage
Script Startup
   # Because the script has an entry on the menu bar, that entry needs
   # to be updated to the proper language if the user chooses a
   different IVT_LANGUAGE.
   Call ResetLanguage()

   # For true K, use 1024. For K == 1000, set to 1000.
   GSET HumanReadableUnit = 1024;
END
########################################################################
Script Guard
   SECRET
   SHAREMODE SESSION            # Only ONE per session

   # When the human-readable strings are on-screen, and the CONTENTS of the
   # screen is altered by the host (scrolls) we can't restore the
   # original, so in that case, reset flip and leave as-is

   TRAP 1 Quit                  # When USER flips, stop guarding
   WAIT "\n" "\r" "\1B"
   Flip = 0;

LABEL Quit
END
#########################################################################
Script HumanReadable
   LOCAL r, c, Ln, l, i, n, OneLn;
   LOCAL Human, u;

   SECRET
   DESCR "Make all numbers human-readable"

   # When F12 is held down, an instance of this script can start before
   # the previous instance is ready, corrupting the screen. Typical case
   # for SHAREMODE SESSION: Only ONE instance of this script per session.
   SHAREMODE SESSION

   r = Cursor_Row();
   c = Cursor_Col();

   u = $HumanReadableUnit;      # Abbreviation

   # Ignore other values then 1K or true 1000.
   IF ($u != 1024 && $u != 1000) THEN u = 1024
   IF GetValue("Flip") == 1 THEN GOTO Restore

   # Store all changes in a multi-dimensional hash. Begin by
   # zapping any previous hash.
   DelHash($Change);

   Flip = 1;
   FOR (Ln = 1; $Ln <= $ROWS; Ln++)             # Scan screen
      OneLn = Rtrim(ScreenTxt($Ln,1,$COLS))             # One line
      n     = Split($OneLn," ()[]{}=","WORDS[]","LOCAL");       # All words
      Offs  = 1;

      FOR (i = 0; $i < $n; i++)                 # Scan all words
         # Skip short words. Mind: we need DISPLAY length here, not
         # the bytecount, as the screen can contain all sorts of stuff,
         # with various wide/narrow characters.
         IF ((l = DisplayLength($WORDS[$i])) > 4 &&  \
             RegMatch('^[0-9]+$',$WORDS[$i])         \
            ) THEN {
            # This is a number. Use built-in function, same length as original
            Human = HumanSize($WORDS[$i],$u);

            SETPOS $Ln $Offs    # display at the proper place
            ECHO_LIT $Human

            # Store the position of the original, and the original word. The
            # index in the hash are the line/position pairs.
            Change{$Ln}{$Offs} = $WORDS[$i];
         }
         Offs = $Offs + $l + 1;
      NEXT
   NEXT

   SETPOS $r $c                         # Restore original
   IGNCHILDREN on                       # Start guard
   GuardThread = Thread Guard
   RETURN

LABEL Restore                           # restore screen
   Flip = 0;
   IF $GuardThread > 0 THEN KILL $GuardThread 1
   GuardThread = 0                      # Guard is killed

   FORALL (KEYS y $Change)
      FORALL (KEYS x $Change{$y})
         SETPOS $y $x                   # Original position
         ECHO_LIT $Change{$y}{$x}
      NEXT
   NEXT

   SETPOS $r $c                 # restore original cursor pos
END
########################################################################


22.3: Manipulate the registry in scripts

Scripts can manipulate the Windows registry using the functions that are available in IVT called RegCreateKey, RegSetValueStr and RegQueryStr, among others. Using these can be slightly daunting, so the util.ivt file that comes with the IVT distribution comes with two functions to store and retrieve values (strings) in the Windows registry.
Thanks to these 2 scripts, YOUR scripts can do stuff like:


   Call IVTSaveRegSetting("YourKey","YourVar",$YourVar)
   ...
   YourVar = Call IVTGetRegSetting("YourKey","YourVar","somedefault")

The IVTSaveRegSetting function saves the YourVar value, the second function retrieves that value. The "somedefault" value is provided in case that the key is not found in the registry. The scripts themselves look like this:


########################################################################
Script_Redefine IVTSaveRegSetting (Key,Nm,Val)
   LOCAL Hive, KeyNm;
   HIDE

   Hive  = "HKEY_CURRENT_USER";
   KeyNm = "$IVT_INFO{'REGISTRY_BASE'}\\Scripts\\$Key"

   RegCreateKey($Hive,$KeyNm);
   RETURN RegSetValueStr($Hive,$KeyNm,$Nm,$Val);        # Save it
END
########################################################################
Script_Redefine IVTGetRegSetting (Key,Nm,Dflt)
   LOCAL Hive, KeyNm;
   HIDE

   Hive  = "HKEY_CURRENT_USER";
   KeyNm = "$IVT_INFO{'REGISTRY_BASE'}\\Scripts\\$Key"

   IF (RegQueryStr($Hive,$KeyNm,$Nm,"Val") == 0) THEN \
      RETURN $Val;

   RETURN $Dflt         # Default value when not found
END
########################################################################


22.4: Script to read line from keyboard.

This is an example of a fairly complex IVT script function. It prompts a question (passed as a parameter) and reads a line of input (not transmitted on the session). The return value of the CALL is the typed input.
Example of a call:


#  Ans = CALL KbdLine("Where do you want to go today? ")

#************************************************************************
Script KbdLine(Prompt)
   LOCAL Answer

   HIDE

   ECHO "$Prompt"
   ONKEY GotAKey UNIQUE         # Reset after every key...

   FOREVER
      PAUSE

LABEL GotAKey
      IF $ONKEYN1 == 0 FunKey   # It is a function key
      IF $ONKEYN1 == 8  BackSpace       # One way to backspace
      IF $ONKEYN1 == 13 THEN {
         ONKEY Off                      # Stop trap
         Echo "\r\n"                    # Echo new line
         RETURN $Answer
      }

      # Normal data key
      Answer = "$Answer$ONKEYS1"        # Append to answer
      ECHO "$ONKEYS1"                   # Provide echo
      CONTINUE

LABEL FunKey                            # Function key detected
      IF $ONKEYN2 == 75 BackSpace       # Cursor Left --> backspace
      ONKEY PASSKEY                     # treat as default
      CONTINUE

LABEL BackSpace                         # Erase 1 char
      # When Answer empty - do nothing
      IF Length($Anwser) == 0 THEN CONTINUE

      # Remove last char of Answer
      Answer = SUBSTR($Answer,0,Length($Answer) - 1)
      Echo "\b \b"                      # Erase on screen
   NEXT
END
#************************************************************************

This shows the keyboard handling from a script. If you want to have a more modern interface when interacting with the user, see DIALOG.


22.5: Waiting for any sort of prompt

When you work with Unix, it is sometimes very handy to have a script that will send a number of commands automatically. In such a case, it is necessary to wait for prompts of the operating system. A problem here is that there is the variety of prompts, which can vary between users, machines, etc.

As an example, the script "SaneEnv" below will set my favourite and most important settings on any Unix host:


#************************************************************************
Script SaneEnv
   Description "Set Korn shell, TERM and EXINIT"
   Send "exec ksh -o vi\r"
   Call WaitPrompt
   send "export TERM=vt220 EXINIT=':se ai sw=3 nows'\r"
END
#************************************************************************

This script is called from on ONCONNECT script that waits (IvtWaitLoggedIn) until the session is looking at the prompt.
Alternatively, I can invoke this with F4-X, or BIND it to a function key.

The WaitPrompt below can wait for prompts in general. Whether you have a prompt of "# ", "ruurd@serv01: " or just a "$ " - all these (and more) are recognized. Also note that during (for example) a login-sequence things can get sent by a host such as:

   Last login: Wed Jan  6 10:45 from...

The "Last login: " might be mistaken for a prompt. Timing is needed to check for cases like this. When nothing is sent for half a second after something that looks like a prompt, it is assumed that it WAS a prompt.


#************************************************************************
Script WaitPrompt(MaxWait)

   # Wait for some kind of (Shell) prompt. This is tricky, since a prompt
   # can take many forms and shapes, and a login sequence can easily contain
   # something like ": " that LOOKS like a prompt. The trick is that a prompt
   # is not followed by anything, especially a new line or a space. So, when
   # we encounter something that looks like a prompt, set a timeout and
   # when nothing shows up, it must have been a prompt.

   LOCAL PromptChars
   Hidden

   PromptChars = "#\$:>%]"              # Ends a prompt (spaces optional)
   IF $MaxWait == "" THEN MaxWait = 900

LABEL Retry
   Wait IN "$PromptChars"

   FOREVER
      TIMEOUT $MaxWait SeenPrompt       # Silence? Then it was a prompt

      WAIT ANYCHAR
      IF $ANYCHAR == " " THEN CONTINUE  # Space is allowed

      # Tricksy. I've seen hosts that have a VT220 init string ending in
      # in a >-sign, immediately followed by a "$ ". The > triggered the
      # first wait, the ANYCHAR is not valid, so things would hang...
      # Solution: When ANYCHAR is a possible prompt char, try again...
      IF INSTR($ANYCHAR,$PromptChars) != -1 THEN CONTINUE

      # If we get here, there is no prompt, and no login: prompt, but
      # other stuff...
      TIMEOUT 0
      GOTO Retry
   NEXT

LABEL SeenPrompt
   TIMEOUT 0
END
#************************************************************************


22.6: Sending files via escape sequences from PC to host

IVT supports a few home-brew escape-sequences called ESC<space>g and ESC<space>R (all 'ESC<space>' commands are non-standard, I just invented a few more).

These were added because sometimes a host needs to do something with files that are stored on the local PC and it is not always easy to get at those files. When a host sends a command like:


        ESC gc:/config.sys;\n
        ESC gV;c:/config.sys;\n

and IVT is not running in secure mode and the ESCGET command is in effect, then IVT will open the file and send the contents of it on the session.
The rules are as follows:

So, OK, it's a bit primitive, but it allows a Unix host to have a script like this:


########################################################################
#!/bin/sh

case $# in
0) case `basename $0` in
   msdos|ivtcom|os2) echo 'Usage: ivtcom MS-DOS or OS/2 command;'       ;;
   ivtget)     echo 'Usage: ivtget MS-DOS or OS/2 file (to stdout)'     ;;
   esac

   exit 0
esac

save=`stty -g < /dev/tty`
trap 'stty $save < /dev/tty; exit' 2
stty -echo tabs -opost -icrnl < /dev/tty

case `basename $0` in
msdos|ivtcom|os2)
   # Send the command "ESC<space>RcommandNewline" to IVT. Wait for response.
   echo "\033 R" $* "\n\c" > /dev/tty
   read line < /dev/tty
   ;;

ivtget)
   for i
   do
      # Use temp file so ctrl-s/q don't cause problems...
      echo "\033 gV;$i" > /dev/tty
      cat - < /dev/tty > /tmp/msd.$$
      cat /tmp/msd.$$
      rm -f /tmp/msd.$$
   done
   ;;
esac

# restore setting.
stty $save < /dev/tty
########################################################################

This file is called IVTCOM and is part of the IVT distribution.
When installed on Unix, a user might type:


   ivtget c:/config.sys

and the standard output of the 'ivtget' command would be the contents of the local config.sys file...


22.7: A custom SCREENSAVE script

When the screensaver is activated (either by timer control or by using the key combination SHIFT+ALT+s) and a script SCREENSAVE exists, IVT will not show the "standard" screensaver screen but will call the script 10 times per second for as long a no key, mouse or session activity is detected.
Also, the script can terminate the screensaver by returning a non-zero exit status.
Since the script is called every 10th of a second, it should do its work quickly and return.
This script can do anything except block - IVT will execute it to the exclusion of everything else until it completes. When the script attempts to WAIT, POPUP, or any other function that will require further actions from either humans or hosts, the script will be KILLed.
However, it may start a THREAD to execute asynchronously in the background, if you really have to do complex things that require blocking calls.
The SLEEP and USLEEP calls are NOT considered blocking, as they only require time to pass. However, using long sleeps will cause IVT to seemingly hang...
The script can reference the standard IVT variables, but exists in a "session" of its own (so it cannot reference variables that are local to the current session).

As an example (which you can save using ALT+s), a script which scrolls a message from right to left on the screen follows.

The following STARTUP script is called ONCE when IVT is started. It sets the default message.


########################################################################
Script STARTUP
   GSET SCREENSAVESTR = "Out for a coffee - back in five..."
END
########################################################################
Script SCREENSAVE
   # When no string is set, end screen saver
   IF $SCREENSAVESTR == "" THEN {
      POPUP "No SCREENSAVESTR set"
      RETURN 1
   }

   # Check for first call. Calculate center line of screen
   IF $ScrSaved == "" THEN {
      SC_R = $ROWS / 2
      SC_C = $COLS
      ScrSaved = 1
   }

   # Scroll from right to left
   IF (SC_C = $SC_C - 1) == 0 THEN SC_C = $COLS

   # Clear screen and display as much as will fit.
   CLS
   SETPOS $SC_R $SC_C
   ECHO SUBSTR($SCREENSAVESTR,0,$COLS - $SC_C)
   RETURN 0
END
########################################################################

And to enable you to set a different message:


Script SetIdleMessage
   DESCR "Sets message to be displayed by screensaver"
   GSET SCREENSAVESTR = PROMPT("Message:",60,1)
END

And (optionally) when you press F20 (shift F10) call the SetIdleMessage: BIND F20 SetIdleMessage
########################################################################


22.8: Logging in to a host automatically

The "password learning & autologin system" that is part of the standard distribution of IVT is written entirely in the script language of IVT.
Since the script is some 2200 lines of code long, it won't be reproduced here, but the examples below are generated automatically from the real source of the script. They demonstrate the key-features of this powerful system:

As such, the password learning system uses just about every feature of the IVT script language. It is very instructive to figure out exactly how it works if you want to write (similar) scripts.


22.8.1: General technical design

The entire "password learning & autologin system" is enabled by including the (encrypted) distributed PWDLEARN.IVT file from your main IVT.RC file.
In its turn, this file does the following:


#########################################################################
Script IvtPwdSaveCfg
   LOCAL x, fd, Lrn;
   HIDE

   if (fd = CREATE($IvtPasswdCfg,0666)) < 0 THEN RETURN

   # When a user enters this AFTER a session with no-login, value is 2
   # When that is saved, ALL future sessions will be disabled...
   # Prevent that by using local Lrn.
   IF (Lrn = $IvtPwdCfgLearn) == 2 THEN Lrn = 1

   WRITE($fd,"Script STARTUP\n")
   WRITE($fd,"   GSET IvtPwdCfgAutoLogin = \"$IvtPwdCfgAutoLogin\"\n")
   WRITE($fd,"   GSET IvtPwdCfgLearn     = \"$Lrn\"\n")
   WRITE($fd,"   GSET IvtPwdShowWin      = \"$IvtPwdShowWin\"\n")
   WRITE($fd,"   GSET IvtPwdLoginWait    = \"$IvtPwdLoginWait\"\n")
   WRITE($fd,"   GSET IvtPwdShellWait    = \"$IvtPwdShellWait\"\n")
   WRITE($fd,"   GSET IvtPwdPopWait      = \"$IvtPwdPopWait\"\n")
   WRITE($fd,"   GSET IvtPwdDelay        = \"$IvtPwdDelay\"\n")
   WRITE($fd,"   GSET IvtPwdToDisk       = \"$IvtPwdToDisk\"\n")
   WRITE($fd,"   GSET IvtPwdColor        = \"$IvtPwdColor\"\n")
   WRITE($fd,"   GSET IvtPwdAlwaysSendUser = \"$IvtPwdAlwaysSendUser\"\n")

   x = Call IvtPwdPrintable($IvtPwdNoShellQuiet)
   WRITE($fd,"   GSET IvtPwdNoShellQuiet = \"$x\"\n")
   WRITE($fd,"   GSET IvtPwdLoginRS232   = \"$IvtPwdLoginRS232\"\n")

   x = Call IvtPwdPrintable($IvtPwdMetaSystem)
   WRITE($fd,"   GSET IvtPwdMetaSystem   = \"$x\"\n")

   x = Call IvtPwdPrintable($IvtPwdMetaUser)
   WRITE($fd,"   GSET IvtPwdMetaUser     = \"$x\"\n")

   x = Call IvtPwdPrintable($IvtPwdCustomLogin)
   WRITE($fd,"   GSET IvtPwdCustomLogin  = \"$x\"\n")

   x = Call IvtPwdPrintable($IvtPwdCustomPasswd)
   WRITE($fd,"   GSET IvtPwdCustomPasswd = \"$x\"\n")

   WRITE($fd,"END\n")
   CLOSE($fd)
END
#########################################################################
Script IvtPwdPrintable (x)
   HIDE
   LOCAL Res, i, One;
   RUBOUT x, Res;

   # Make X something that can be printed as a string and survive...
   # Expand ALL into \XX where XX is a 2-digit hex character
   # Prevents nastiness with ()#$@"\[]{} etc etc...

   # Because we code the RESULT of this function in double quotes,
   # READING them back loses one level of backslashes, so we have
   # to start by doubling those.
   x = Replace($x,"\\","\\\\");

   Res = "";
   FOR (i = 0; $i < LENGTH($x); i++)
      One = SubStr($x,$i,1)
      IF $One == "\$"           \
      THEN Res = Concat($Res,"\\\$")    \
      ELSE Res = Concat($Res,"\\",sprintf("%02X",FromAscii($One)));
   NEXT
   
   return $Res
END
#########################################################################
Script IvtProcPwds
   HIDE
   # Dummy Placeholder
END
#########################################################################
Script STARTUP
   LOCAL CfgDir, CurErr;

   # Old default, use new one if available
   CfgDir = "$IVT_INFO{'APPDATA'}/IVTdata";
   if GetValue($IvtDataDir) != "" then CfgDir = $IvtDataDir;

   # The location for these file can be overruled.
   GSET IvtPasswdCanDoDisk = 1;
   IF GetValue("IvtPasswdFile") == "" THEN \
      GSET IvtPasswdFile = "$CfgDir/PASSWORD.IVT"
   SCOPE GLOBAL HASH PwdMustResetRetainSess;
   IF GetValue("IvtPasswdCfg") == "" THEN \
      GSET IvtPasswdCfg = "$CfgDir/PWDCONFG.IVT"

   # Skip reading the (encrypted, optionally password protected) file
   # during install.
   IF GetValue("IVT_INSTALL") != "" THEN GSET IvtPasswdFile = "NUL"

   # All these can be overruled by a STARTUP script
   IF GetValue("IvtPwdCfgAutoLogin")   == "" THEN GSET IvtPwdCfgAutoLogin   = 1
   IF GetValue("IvtPwdCfgLearn")      == "" THEN GSET IvtPwdCfgLearn  = 1
   IF GetValue("IvtPwdShowWin")       == "" THEN GSET IvtPwdShowWin   = 1
   IF GetValue("IvtPwdToDisk")        == "" THEN GSET IvtPwdToDisk    = 1
   IF GetValue("IvtPwdLoginWait")     == "" THEN GSET IvtPwdLoginWait = 60000
   IF GetValue("IvtPwdShellWait")     == "" THEN GSET IvtPwdShellWait = 10000
   IF GetValue("IvtPwdPopWait")       == "" THEN GSET IvtPwdPopWait   = 6000
   IF GetValue("IvtPwdDelay")         == "" THEN GSET IvtPwdDelay     = 250
   IF GetValue("IvtPwdAlwaysSendUser")== "" THEN GSET IvtPwdAlwaysSendUser = 1
   IF GetValue("IvtPwdLoginRS232")    == "" THEN GSET IvtPwdLoginRS232     = 1
   IF GetValue("IvtPwdCustomPasswd")  == "" THEN GSET IvtPwdCustomPasswd=""

   IF GetValue("IvtPwdCustomQuestion") == "" \
   THEN GSET IvtPwdCustomQuestion = ""

   IF GetValue("IvtPwdColor") == "" THEN \
       GSET IvtPwdColor = "GREEN BLACK HIGH"

   GSET IvtPwdNoDiskLrn   = 0;  # Nr of passwords learned in memory
   GSET PwdActiveLogins   = 0;
   GSET IvtPwdPromptChars = "#\$:>%])?" # Ends a prompt (space optional)

   # When disabled, do nothing except monitor login and AUTOPROMPT and so
   # on can work.
   IF $IvtPwdCfgAutoLogin == -1 THEN {
      GSET IvtPwdToDisk   = 0;
      GSET IvtPwdCfgLearn = 0;
   }

   # Set initial settings for password management, when not existing
   IF !Exists($IvtPasswdCfg) THEN CALL IvtPwdSaveCfg
   IF  Exists($IvtPasswdCfg) THEN ReadRC($IvtPasswdCfg,"STARTUP")
   Call IvtPwdDebug("Read configuration from $IvtPasswdCfg");

   # In case an encrypted file exists, ignore it, when the IvtConfig
   # script has disabled autologin altogether.
   IF $IvtPwdCfgAutoLogin == -1 || $IvtPwdToDisk == 0 THEN {
      GSET IvtPasswdFile = "NUL"
      RETURN
   }

   # When the password file does not exist yet, we're done
   IF !Exists($IvtPasswdFile) THEN RETURN

   # File exists, read, but carefully. When a syntax error creeps into
   # the script, ignore the file and do NOT overwrite it!
   DELSCRIPT IvtProcPwds
   CurErr = MyErrorCount()
   ReadRC($IvtPasswdFile)
   CurErr = MyErrorCount() - $CurErr
   IF $CurErr == 0 THEN {
      Call IvtPwdDebug("Read passwords from $IvtPasswdFile");
      RETURN
   }

   ECHO "~3 --- ATTENTION ---\n"
   ECHO "$CurErr errors in $IvtPasswdFile\n"
   ECHO "Which is a severe internal error. Please report\n"
   ECHO "this to support@ivtssh.nl!\n"
   ECHO "Password learning system is now disabled!\n\n"

   GSET IvtPasswdFile      = "NUL"
   GSET IvtPwdCfgAutoLogin = -1
END
#########################################################################
# The operative statement. Call this for every "Connection established"
ONCONNECT * IvtLogMeIn
#########################################################################

The STARTUP script is executed as soon as the END statement is read.
This checks if you have overruled the IvtPasswdFile and IvtPasswdCfg variables (by assigning values only if they are currently empty).
It then assigns global defaults to all sorts of configuration variables. If the configuration file did not exist yet, IvtPwdSaveCfg is called to save these initial settings to the configuration file. This file is read using READRC immediately afterwards, so now either the just-saved values or the values of a previous save are used.
It is important to prevent syntax errors in the generated script, so the IvtPwdPrintable function is used to make sure of that.

Snooped passwords are stored in an encrypted file, which is read here.
The READRC function is used (instead of an INCLUDE) so a check can be made on the number of syntax-errors in the generated script (very rare). When this happens, the file is ignored and a warning is issued.

When the file is encrypted with the default password, IVT can read it. If a non-default password is used, IVT will prompt for the password. When the user types ESC instead of a password, the READRC fails and the passwords are not read.

Either way, an ONCONNECT * IvtLogMeIn is used to make sure that the IvtLogMeIn script is called at the start of every session.
The IvtLogMeIn script checks to see if $AUTOLOGIN is TRUE. If it is, it checks whether $HOSTNAME and $USER yield a valid password. If so, it performs auto-login. If not, it tries to learn the password by snooping.


22.8.2: Snooping the user-id and password when you login

When a password is not known, or the user uses Ctrl+PageUp to create a new session (so $AUTOLOGIN is FALSE), IvtLogMeIn will call the LearnLogin procedure that does the following:


#########################################################################
Script IvtLearnLogin(OnPrompt,OrgLoginNm,DoLearn,SentUser,BYREFERENCE LoginOK)
   LOCAL LoginNm, x, l, CntNL, MetaOption;
   LOCAL SeenPwdPrmpt;
   RUBOUT Pwd, Nm;
   HIDE

   # Safety measure - Overrule when configured off
   IF $IvtPwdCfgAutoLogin == -1 THEN DoLearn = 0

   # Attempt to snag the user-id and password from the session. Do this
   # even when DoLearn is false, so we can detect a successful login and
   # run user-defined scripts when logging in thru Pageant, keypair,
   # account with no password, whatever. When DoLearn is false, be
   # quiet - no messages except when LOGIN is detected...

   IF $PROTOCOL == "Dummy" THEN RETURN ""
   SeenPwdPrmpt = 0;

   # If the 'complex/expire password' turned on RETAIN_SESSIONS, turn it off
   # again now (reset to default). Only once.
   if (GetValue($PwdMustResetRetainSess{MYSESSID()}) == 1) THEN {
        PwdMustResetRetainSess{MYSESSID()} = 0;
        NO_RETAIN_SESSIONS;
   }

   # Set to default
   IF $SentUser == "" THEN SentUser = 0;

   MetaOption = 0;
   IF $OrgLoginNm == "" || ($IvtPwdAlwaysSendUser != 1 && $AUTOLOGIN == 0) \
   THEN SentUser = 1

   IF $DoLearn THEN {
      CALL WinTxt(NLS("P004","~1F1~0: Explain password learning"),2)

      IF $IvtPwdMetaSystem != "" && $IvtPwdMetaUser != "" THEN {
         CALL WinTxt(NLS("P005","~1F6~0: Set this as the meta-password"),2)
         MetaOption = 1;
      }

      CALL WinTxt(NLS("P006","~1F7~0: Don't learn this password"),2)
      CALL WinTxt(NLS("P007","~1F8~0: Never learn passwords for THIS host"),2)
      CALL WinTxt(NLS("P008","~1F9~0: Disable ALL password learning NOW!"),2)

      IF $IvtPwdToDisk == 1 \
      THEN CALL WinTxt(NLS("P009", \
                "Recording userid & password for\nfuture auto-login."),1) \
      ELSE CALL WinTxt(NLS("P010", \
                "Learning userid & password,\nsave-to-disk is OFF!."),1)
   }

   TIMEOUT $IvtPwdLoginWait GiveItUp    # Allow X seconds for login

LABEL TryAgain
   ONKEY Fkey UNIQUE
   IF $OnPrompt == 1 DoLogin_F
   IF $OnPrompt == 2 DoPassword_F
   IvtLogMeInWait = 1

LABEL TryAgain2
   WAIT CASE_INSENSITIVE                                \
        VARIABLE_ASSIGN "SSH_PAGEANT_ACCEPT",SshPageant         \
        VARIABLE_ASSIGN "SSH_GSSAPI_USER",SshGssapi             \
        VARIABLE_ASSIGN "SSH_LOGIN_ACCEPT",SshOK                \
        VARIABLE_ASSIGN "SSH_FURTHER_AUTH_REQ",SshComplex       \
        VARIABLE_ASSIGN "SSH_CHANGE_PWD",SshComplex             \
        "login",DoLogin                                         \
        "username",DoLogin                                      \
        "userid",DoLogin                                        \
        "$IvtPwdCustomLogin",DoLogin                            \
        "$IvtPwdCustomPasswd",DoPassword                        \
        "password",DoPassword                                   \
        "Principal Name:",DoPassword                            \
        "Passphrase for key",SshPassphrase                      \
        "Access granted!",SshOK                                 \
        IN_UNIQUE "$IvtPwdPromptChars"

   x = CALL IvtPwdRealPrompt()
   IF !$x TryAgain2

   # Some host ask questions BEFORE login. Must be answered manually.
   IF $SentUser != 1 THEN {
      KEYBOARD "AUTHENTICATE_ON"
      GOTO TryAgain2
   }

   # Seen a prompt, not any of the ones above. Assume login OK
   # Especially when IVTmux is in use, we can be at a shell *fast*
   LoginOK = 1;
   IF $OrgLoginNm != "" THEN LoginNm = $OrgLoginNm
   IF $SeenPwdPrmpt     THEN GOTO Done

   # Nested logins, sudo, etc: Avoid misleading message
   IF GetValue("IvtLogMeInBusy") == 1 THEN {
      # And the multiplexer can get us to a shell *fast*
      IF $PROTOCOL == "IVTmux" THEN {
         CALL WinTxt(NLS("P046","Multiplexer login OK"), 3)
      } ELSE {
         CALL WinTxt(NLS("P012","Account does not seem to have a password"),1)
      }
   }

   GOTO Cleanup

LABEL Done
   TIMEOUT 0                            # Cancel timeout
   IF $LoginNm == "" Cleanup            # Filter out garbage

   # Determine if login successful. If not, a new LOGIN: appears.
   # Unfortunately, many systems have "Last login: " as part of the
   # login sequence. Deal with this.
   x = CALL IvtOtherLogin()
   IF $x == 1 THEN {
      OnPrompt = 1
      KEYBOARD "AUTHENTICATE_ON"
      GOTO TryAgain
   }

   IF $x == 4 THEN {
      OnPrompt = 2
      KEYBOARD "AUTHENTICATE_ON"
      GOTO TryAgain
   }

   IF $x == 3 THEN x = 0                # Logged in, no shell, is OK

   IF $x != 0 THEN {
      LoginOK = 0;                      # Failure
   } ELSE {
      LoginOK = 1;                      # Success
      IF $MetaOption == 2 THEN {
         GSET IvtPwdMetaUser = $LoginNm
         IF $DoLearn THEN {
            CALL IvtSaveNewPwds($IvtPwdMetaSystem,$IvtPwdMetaUser,$Pwd,"DFLT")
         }
      } ELSE {
         IF $DoLearn THEN {
            CALL IvtSaveNewPwds($HOSTNAME,$LoginNm,$Pwd,"DFLT")
         }
      }
   }

LABEL Cleanup
   TIMEOUT 0
   ONKEY off
   KEYBOARD "AUTHENTICATE_OFF"
   CALL IvtPwdKeybONOFF("ON")
   IF $LoginNm != "" && $USER == "" \
   THEN USER = $LoginNm # Updates tab bar

   RETURN $LoginNm

LABEL DoLogin
   x = CALL IvtPwdRealPrompt()
   IF !$x THEN GOTO TryAgain2   # Part of feedback, not prompt

LABEL DoLogin_F

   OnPrompt = 0;                # Only once
   IF $SentUser == 0 THEN {
      SentUser = 1
      Usleep $IvtPwdDelay
      SEND "$OrgLoginNm\r"
      LoginNm = $OrgLoginNm
      KEYBOARD "AUTHENTICATE_ON"
      GOTO TryAgain
   }

   Nm  = "LoginNm";             # Catch into this variable
   $Nm = "";                    # Start with empty string
   GOTO DoCatch

LABEL DoPassword
   x = CALL IvtPwdRealPrompt()
   IF !$x THEN GOTO TryAgain2   # Part of feedback, not prompt

LABEL DoPassword_F

   # In RLOGIN, USER can be set but is not transmitted by this script
   # but by the protocol module. Copy to LoginNm in that case.
   OnPrompt = 0;                # Only once
   IF $LoginNm == "" THEN LoginNm = $USER
   Nm  = "Pwd";                 # Catch into this variable
   $Nm =  "";                   # Start with empty string
   SeenPwdPrmpt = 1;
   GOTO DoCatch

LABEL GiveItUp
   IF $DoLearn THEN CALL WinTxt(NLS("P013","Timeout, nothing recorded"),3)
   GOTO Cleanup

LABEL DoCatch                   # Catch a line of input
   KEYBOARD "AUTHENTICATE_ON"
   ONKEY Catch UNIQUE

LABEL Looping
   PAUSE                        # IVT way of doing nothing

LABEL FieldComplete
   IF $Nm == "Pwd" Done
   GOTO TryAgain

LABEL Catch                     # Called once for every key
   IF $ONKEYN1 == 0 Fkey        # Catching a function key
   ONKEY PASSKEY
   IF $ONKEYN1 == 13 THEN {
      ONKEY OFF
      GOTO FieldComplete
   }

   # If a BACKSPACE or DEL is used in the LOGINNAME, correct it.
   # In the PASSWORD, a backspace is a valid part of the password!
   IF $Nm == "LoginNm" && ($ONKEYN1 == 8 || $ONKEYN1 == 127) LoginNmCorr

   # Add current character to the field (indirect assign!)
   $Nm = Concat(EXPAND("\$$Nm"),$ONKEYS1);
   GOTO Looping

LABEL LoginNmCorr
   x = EXPAND("\$$Nm")          # The Word Sofar
   l = LENGTH($x)
   IF $l != 0 THEN $Nm = Substr($x,0,$l - 1);
   GOTO Looping

LABEL Fkey
   IF !$DoLearn THEN GOTO FkeyNot
   IF $ONKEYN2 == 59 THEN HELP "PWDLEARN" : GOTO Looping
   IF $ONKEYN2 == 64 FkeyF6
   IF $ONKEYN2 == 65 FkeyF7
   IF $ONKEYN2 == 66 FkeyF8
   IF $ONKEYN2 == 67 FkeyF9

LABEL FkeyNot
   # When ^D is typed as first char of SSH password, try next method
   IF $IvtPwdSshMode == 2 && ($ONKEYN1 == 4 || $Nm == "") SshAgain

   # All other keys have their normal function
   ONKEY PASSKEY
   GOTO Looping

LABEL SshAgain
   ONKEY PASSKEY
   GOTO TryAgain

LABEL FkeyF6
   IF $MetaOption != 1 THEN GOTO Looping
   CALL WinTxt("This will become the meta-account",2)
   MetaOption = 2
   GOTO Looping

LABEL FkeyF7
   # Do not learn pwd for this particular session
   CALL WinTxt(NLS("P015","OK - Let's skip this one..."),3)
   GOTO Cleanup

LABEL FkeyF8
   # Do not learn pwd for this particular host, ever.
   CALL WinTxt(NLS("P016","Password learning disabled\nfor $HOSTNAME"),3)
   CALL IvtSaveNewPwds($HOSTNAME,"@@@@","@@@@","FORBIDDEN")
   GOTO Cleanup

LABEL FkeyF9
   # Do not learn passwords, ever.
   GSET IvtPwdCfgAutoLogin = 0
   GSET IvtPwdShowWin      = 0
   CALL IvtPwdSaveCfg()
   CALL WinTxt(ConCat( \
          NLS("P017","Password learning disabled.\n"), \
          NLS("P018","See 'SETUP->Password learning' for details.")),3)

   GOTO Cleanup

LABEL SshPassphrase
   x = CALL IvtPwdRealPrompt()
   IF !$x TryAgain2             # Part of feedback, not prompt

   KEYBOARD "AUTHENTICATE_ON"
   IF $IvtPwdNotDoneDone != "" TryAgain
   IvtPwdNotDoneDone = 1;
   IF $DoLearn THEN {
      CALL WinTxt(NLS("P019","Learning a passphrase is 'not done'..."),1)
   }

   Nm = ""
   GOTO TryAgain

LABEL SshOK
   CALL WinTxt(NLS("P020","SSH login succeeded as $SSH_LOGIN_ACCEPT"),3)
   LoginNm = $SSH_LOGIN_ACCEPT;

LABEL SshOK2
   TIMEOUT 0
   ONKEY OFF
   KEYBOARD "AUTHENTICATE_OFF"
   LoginOK = 1;
   x = CALL IvtOtherLogin()     # Wait for session to start
   IF $x == 4 THEN {            # Password: prompt. Expired? Too Complex
     LoginOK = 0;
     CALL WinTxt(NLS("P045","Manual mode (further authentication detected)"),0)
     IF (QuerySetting("RETAIN_SESSIONS") == 0) THEN {
        PwdMustResetRetainSess{MYSESSID()} = 1;
        RETAIN_SESSIONS
     }
   }
   GOTO Cleanup

LABEL SshPageant
   IF $SSH_PAGEANT_ACCEPT != "" THEN LoginNm = $SSH_PAGEANT_ACCEPT
   CALL WinTxt(NLS("P021","SSH login succeeded as $LoginNm using Pageant"),3)
   GOTO SshOK2

LABEL SshComplex
   CALL WinTxt(NLS("P045","Manual mode (further authentication detected)"),0)
   IF (QuerySetting("RETAIN_SESSIONS") == 0) THEN {
      PwdMustResetRetainSess{MYSESSID()} = 1;
      RETAIN_SESSIONS
   }
   GOTO Cleanup

LABEL SshGssapi
   LoginNm = Substitute($SSH_GSSAPI_USER,"@.*","");     # Strip domain

   # I can authenticate with ME@DOMAIN.COM and login as 'root'.
   # The 'root' rules, or else the 'me' will show up in tab/status.
   IF $USER != "" && strstr($USER,$LoginNm) < 0 THEN LoginNm = $USER;
   IF $USER == "" THEN USER = $LoginNm;
   CALL WinTxt(NLS("P022", \
         "SSH GSSAPI login succeeded as $LoginNm as\n$SSH_GSSAPI_USER"),3)

   GOTO SshOK2
END
#########################################################################
Script IvtOtherLogin
   LOCAL Result, AbsEnd, Now, WtTime, ShortTime, TermAns, x, i;
   HIDE
   SECRET

   IF (Wait_Onconnect("AutoPromptSetPrompt","","NOWAIT") != 0) THEN {
      # Zero means "Exists, running and not ready yet". Starting to type
      # must not interrupt the login or we fail in various ways.
      # In all other cases, a user that starts typing stops this function
      ONKEY IsTyping
   }

   AbsEnd = TIME("MILLISECS") + $IvtPwdShellWait; # Nothing for X Ms?

   # When IVT is very busy with many sessions, we get bad timeouts.
   # So, extend the time with 10 Ms for every ACTIVE session.
   ShortTime = ($PwdActiveLogins * 50) + 500;

   # Ancient system prompt for terminal type using TSET (modern ones use
   # ssh/telnet/rlogin whatever mechanism to reliably set TERM). When
   # tset does not know "ivt", it MAY prompt again. Unfortunately,
   TermAns = QuerySetting("TELNET_TTYPE");

   Call IvtPwdDebug("Wait for start session");

LABEL WaitStartSession
   Result = 0;

   # We restart this timeout every time. But we want a max time of 10 secs
   Now = TIME("MILLISECS");
   WtTime = $AbsEnd - $Now;
   IF $WtTime <= 0 NoShell              # Already expired
   TIMEOUT $WtTime NoShell              # When NONE of this happens, no shell?

   # The ORDER is important, longest match first, makes sure they match,
   # so "Last login: Thu ..." is not mistaken for a login prompt.
   WAIT  CASE_INSENSITIVE                               \
        VARIABLE_ASSIGN "SSH_CHANGE_PWD",SshChangePwd   \
        "Last login",WaitStartSession                   \
        "successful login",WaitStartSession             \
        "3004-312 All available logi",InUse             \
        "$IvtPwdCustomLogin",SawLogin                   \
        "login",SawLogin                                \
        "username",SawLogin                             \
        "Userid",SawLogin                               \
        "$IvtPwdCustomPasswd",SawPwdPrmpt               \
        "$IvtPwdCustomQuestion",CustQuest               \
        "TERM = ",AskTerm                               \
        "Principal Name",SawLogin                       \
        "password",SawPwdPrmpt                          \
        "Passphrase for key",SawPwdPrmpt                \
        IN "$IvtPwdPromptChars"

   # A prompt char, not part of any of the above...
   x = CALL IvtPwdRealPrompt($ShortTime,$Result)
   IF !$x WaitStartSession
   Result = 0;
   GOTO RealSession

LABEL SawLogin                  # Saw "login" of some sort
   x = CALL IvtPwdRealPrompt($ShortTime,$Result)
   IF !$x WaitStartSession      # Not a real prompt. Try again
   Result = 1;
   GOTO RealSession

LABEL AskTerm
   IF $TermAns == "" THEN GOTO NoShell
   IF (i = INSTR($TermAns,",")) >= 0 THEN {
      x = SUBSTR($TermAns,0,$i)
      TermAns = SUBSTR($TermAns,$i + 1,-1)
   } ELSE {
      x = $TermAns
      TermAns = ""
   }

   USLEEP $IvtPwdDelay          # Short prompt delay
   SEND "$x\r"                  # One item from list
   GOTO WaitStartSession
   
LABEL SawPwdPrmpt               # Saw "Password" of some sort
   x = CALL IvtPwdRealPrompt($ShortTime,$Result)
   IF !$x WaitStartSession      # Not a real prompt. Try again
   Result = 4;                  # Learn a PASSWORD, not NAME!!
   GOTO RealSession

LABEL InUse                     # Saw "All sessions in use"
   Result = 2;
   GOTO RealSession

LABEl CustQuest                 # Treat as "No shell"
   IvtPwdSawCustQuestion = 1;

LABEL NoShell
   Result = 3;                  # No prompt seen, assume login is OK
   GOTO RealSession

LABEL SshChangePwd
   Result = 5;
   GOTO RealSession

LABEL IsTyping
   Call IvtPwdDebug("User started typing - login considered complete");
   ONKEY PASSKEY                # User started typing
   Result = 0;                  # Treat as valid session

LABEL RealSession
   Call IvtPwdDebug("Session detector: status is $Result");
   TIMEOUT 0
   ONKEY off
   RETURN $Result               # 0=OK, 1=login: 2=InUse, 3=Noshell
END                             # 4=See PwdPrompt, 5=ChangePwd
########################################################################

This begins with ignoring any dummy-protocol sessions.

Next, it fills the text WINDOW popup with information about what is going on.

Then, this sets a TIMEOUT that will expire in (default) 60 seconds. If no successful login is performed within that time, the procedure will quit.

The ONKEY statement is used to branch to the Fkey label every time a key is pressed. It then waits for either a "login:" or "password:" prompt, which can take many forms, including the custom prompts.

Because I want to use a single "snoop" routine to catch both the user-id and the password, the script "captures" the typed keys into an indirect variable, the name of which is stored in Nm (either LoginNm or Pwd, which are both LOCAL variables). The actual snooping is done at DoCatch.
This uses a PAUSE statement to block until the next key is typed.
The code at the Catch label is executed every time a key is typed. The variable $ONKEYN1 is checked to see if it was a function key. All other keys are passed to the host using ONKEY PASSKEY.
When a code 13 (RETURN key) is seen, control is passed to FieldComplete, which checks to see if both fields (user-id & password) are now known. If so, it transfers control to the Done label.

Now comes the difficult bit: If the login is successful, we want to store the user-id and password. However, if the login FAILS (another login: prompt appears), the process has to start again.
For this, the procedure IvtOtherLogin is called. This has to find out whether another "login" prompt appears. This sounds easy, but a successful login on many Unix machines will show a message like: "Last successful login: <date>".
This contains a "login:" which is easily mistaken for a new login prompt.
Some logins result in a program being started, sometimes long delays, sometimes another SECOND authentication is required, etc.

The question is: Can we find a "login" followed by a colon, optional spaces and NOTHING else? This is what the IvtOtherLogin procedure does.
The routine returns TRUE if it saw such a login.
Another use of this function is to wait until a prompt appears (i.e., if it is a VALID login, some type of prompt will eventually appear, or the user starts typing at some program which does not issue a clear prompt). In this case, the routine returns a zero (FALSE) value.


22.8.3: Storing passwords in an encrypted file

It is, of course, unacceptable to have plain ASCII files with passwords in them. IVT will encrypt the password database with either a default password, or with a user-supplied password. The former will allow you to start IVT without typing a password; the latter implies that IVT will have to ask for the password once during start-up. After that, all login is automatic (for accounts the system knows about, since you can disable password learning for specific hosts).

The security is based on the functions CRYPTFL and CRYPTFLPWD. Also, the CRYPTPWD statement is used to communicate a password that you type to the internals of IVT.

A snippet of code taken from PWDLEARN.IVT:


#########################################################################
LABEL WriteDone
   WRITE($fd,"END\n");
   CLOSE($fd);

   # Immediately after closing it, encrypt it (ex == 1 if file existed)
   x = 0
   IF $IvtPwdToDisk != 1 ReReadFile

   # When file existed, re-crypt with old password.
   # If file did NOT exist, and no password specified, crypt with default.
   # If password specified, use that.
   # The temp file gets the pwd from the real file. When in trouble, reset
   # default password.
   IF CRYPTFLPWD($FlNm,"INHERIT",$IvtPasswdFile) != 0 \
   THEN CRYPTFLPWD($FlNm,"DEFAULT")

   IF $ex != 0 THEN {
      x = CRYPTFL($FlNm,"REUSE","1WAY")
      GOTO TstRes
   }

   IF $CrPwd == "" \
   THEN x = CRYPTFL($FlNm,"DEFAULT","1WAY") \
   ELSE x = CRYPTFL($FlNm,"PASSWORD",$CrPwd,"1WAY")

LABEL BadCrypt
   IF $x != 0 THEN \
      POPUP "Warning: Trouble encrypting file!\nFile=$IvtPasswdFile\nStat=$x"

   COPYFILE($FlNm,$IvtPasswdFile);      # Copy encrypted across
   UNLINK($FlNm);                       # Ditch the temp file
   FlNm = $IvtPasswdFile;               # Continue with this file

LABEL ReReadFile

   # Now delete the old copy from memory and re-read encrypted file
   DELSCRIPT IvtProcPwds                # Delete current from memory
   READRC($FlNm)                        # Re-read the new one

   IF $IvtPwdToDisk != 1 THEN {
      UNLINK($FlNm)
      GSET IvtPwdNoDiskLrn = $IvtPwdNoDiskLrn + 1
   }

   RETURN

LABEL TstRes
   # Status 6 means "no password to reuse". Since the file existed and was
   # read, it must mean the file is unencrypted. Fix that! Stat!
   IF $x == 6 THEN \
      x = CRYPTFL($IvtPasswdFile,"DEFAULT","1WAY")

   GOTO BadCrypt
END
#########################################################################

This code is executed after the database file with passwords is updated.
It tries to make sure the file is never stored in any dangerous location in unencrypted form. Writing and encryption is done in the TMP directory for this reason, and the resulting file is copied to the real destination using COPYFILE.
See also the DELSCRIPT that is used to make sure the READRC does not result in a "Duplicate script name" error message.
This does not use the newer SCRIPT_REDEFINE because that would cause older version of IVT to throw a syntax error.

When save-to-disk is off, the file is written to the TMP directory, read back in using READRC and immediately deleted.


22.8.4: Managing the popup windows that document what is going on

The "password learning & autologin system" that is part of the standard IVT distribution shows what is going on by displaying a window in the lower right-hand corner of the screen. When passwords are snooped, used or stored this window is updated with numbered messages. When the user can use function keys, this is displayed in that window, too.
These popups are simple (but effective) text-based popups that IVT has had for many years. In 2007 the script language was extended with the DIALOG statement which allows a script to manage GUI dialogs, and the password learning system was adapted to take advantage of that. But simple messages to the user can still be handled adequately using WINDOW.

So this is managed by calling the procedure WinTxt.
This takes two parameters: NewTxt and Type.
The TYPE can take 4 different values:


0 - Add ordinary text to bottom of window;
1 - Add a numbered item to the bottom of the window;
2 - Add a function key definition to the window;
3 - Start again (clear all text, add NewText as type 0).

So, a typical call to WinTxt might look as follows:


   Call WinTxt("Stored password for user\n$LoginNm on $Host",3)

This would clear all previous text and display that message only.
See here for a few more examples of calls.
When the IvtLogMeIn procedure is done, it issues a:


   WINDOW HW TIMEOUT $IvtPopWait

This will make the window disappear after the specified time (customizable).
The WinTxt procedure itself is coded as follows:


#########################################################################
Script WinTxt(NewTxt,Type)
   HIDDEN
   SECRET
   LOCAL l, x, s, part;

   IF $IvtPwdCfgAutoLogin == -1 THEN RETURN

   IF WinExists("HW") WinOkNow          # Test if handle exists
   Call IvtPwdDebug($NewTxt);

   # Create the actual window
   # Initialise help window stuff (Window handle is HW for Help Window)
   WINDOW HW
   x = Nls("HW_TITLE","Autologin & Password Learning system")
   WINDOW HW TITLE "$x"
   WINDOW HW COLOR $IvtPwdColor
   WINDOW HW ROW -1
   WINDOW HW COL -1

   HelpWin  = FunKeys = "";
   HelpItem = 1;

LABEL WinOkNow
   # Type 3: Clear any current text, start again.
   IF $Type == 3 THEN {
      HelpWin = FunKeys = ""
      GOTO OrdiText
   }

   # Window exists. Display something.
   IF $Type == 0 OrdiText
   IF $Type == 1 Numbered
   IF $Type == 2 FunKey
   RETURN

LABEL FunKey
   # Add a line to the function key part.
   IF $FunKeys != "" THEN FunKeys = Concat($FunKeys,"\n")
   FunKeys = Concat($FunKeys,$NewTxt);
   GOTO DispIt

LABEL Numbered
   # Add a numbered item
   IF $HelpWin != "" THEN HelpWin = "$HelpWin\n"
   HelpWin = "${HelpWin}${HelpItem}: "
   s = $NewTxt;

   # Loop tru all lines in NewTxt, formatting/counting them...
   WHILE (x = INSTR($s,"\n")) != -1
      HelpWin = Concat($HelpWin,        \
                       Substr($s,0,$x), \
                       "\n","   ",      \
                       ($HelpItem >= 10) ? " " : "");
      s = Substr($s,$x,-1);
      s = Substr($s,++x,-1);    # Take remainder of message

   HelpItem++;
   HelpWin = "$HelpWin$s"
   GOTO DispIt

LABEL OrdiText
   IF $HelpWin != "" THEN HelpWin = "$HelpWin\n"
   HelpWin = "$HelpWin$NewTxt";

LABEL DispIt
   # Actual window contents is normal text + Function key text.
   # Either sets or re-sets the text
   WINDOW HW TEXT "$HelpWin\n$FunKeys"

   # The window is always created, but not always shown...
   IF $IvtPwdShowWin == 1 THEN WINDOW HW SHOW
END
#########################################################################


22.8.5: managing a complex dialog (the password maintenance menu)

When you use F4-X to execute the PwdLearnSys script, a nice menu appears that allows you to configure the password learning & autologin system.
This menu handling is all written in the IVT script language, using DIALOG.

Here is how it is done:


########################################################################
Script PwdLearnSys ()
   RUBOUT txt, x, y, t, MaxMenu, ex, Lhost, Lusr;
   RUBOUT Lpwd, t1, t2;

   DESCR "Configure the password learning & AutoLogin system"

   : (code snipped)
   :
   DIALOG CFG DESTROY
   DIALOG CFG
   DIALOG CFG TITLE "Password learning configuration"


   DIALOG CFG COMBOBOX_NL AUTOLOGIN "Auto-login" "Off" "On" "Uninstall"
   DIALOG CFG OPTION_NL PWDLEARN "Password-learning" $IvtPwdCfgLearn == 1
   DIALOG CFG OPTION_NL HOSTLRN  "Learning for current host" !$IvtPwdForbidden
   DIALOG CFG OPTION_NL SHOWHELP "Show help window"  $IvtPwdShowWin
   DIALOG CFG OPTION_NL STORDSK  "Store passwords on disk" $IvtPwdToDisk
   DIALOG CFG TEXTBOX_NL METSYS  "Meta-system hostname" \
              "LENGTH=20" "ANSWERLENGTH=100" $IvtPwdMetaSystem
   DIALOG CFG TEXTBOX_NL METUSR  "Meta-system username" \
               "LENGTH=20" $IvtPwdMetaUser
   DIALOG CFG NEWLINE_FORCE
   DIALOG CFG GROUPSTART
   DIALOG CFG BUTTON_NL  SETPWD   "Set/alter password on database   "
   DIALOG CFG BUTTON_NL  DELUSR   "    View/edit entire database    "
   DIALOG CFG BUTTON_NL  DELACC   "Delete all accounts for THIS host"
   DIALOG CFG BUTTON_NL  ADDMAN   "  Add users/passwords manually   "

   # If this plugin is loaded, add a button to configure it
   IF Defined("SecretServerConfig") THEN {
   DIALOG CFG BUTTON_NL  CFGTHY   "     Configure SecretServer      "
   }

   DIALOG CFG BUTTON_NL  TUNE     "  Fine tune the learning system  "
   DIALOG CFG BUTTON     CHGDEF   "Change default user for this host"
   DIALOG CFG (($IvtHostMatch > 1) ? ENABLE : DISABLE) CHGDEF
   DIALOG CFG GROUPEND CENTER BOXED NEWLINE
   DIALOG CFG LINE
   DIALOG CFG GROUPSTART
   DIALOG CFG BUTTON PWDOK "  OK  "
   DIALOG CFG ROOM "  "
   DIALOG CFG BUTTON_NL PWDCNC " Cancel "
   DIALOG CFG GROUPEND CENTER

   IF $IvtPwdCfgAutoLogin >= 0 \
   THEN DIALOG CFG COMBOBOX AUTOLOGIN "SELECT=$IvtPwdCfgAutoLogin" \
   ELSE DIALOG CFG COMBOBOX AUTOLOGIN "SELECT=2"
   
   IF $IvtPwdCfgLearn != 0 \
   THEN DIALOG CFG ENABLE  HOSTLRN \
   ELSE DIALOG CFG DISABLE HOSTLRN

   DIALOG CFG SHOW              # Actually show the dialog
   WHILE (Ev = DialogEvent("DIALOG","ITEM","KEY1","KEY2")) != "END"
      IF $Ev == "NOTHING" THEN CONTINUE
      IF $Ev == "ERROR"   THEN BREAK
      IF $Ev == "KEY" && ($KEY1 == 0 && $KEY2 == 59) THEN {     # F1 key
         HELP "PWDLEARN"
         CONTINUE
      }

      # Automagically jump to handler when defined.
      GOTO_OPT "${Ev}_${ITEM}"
      CONTINUE

LABEL HELP_AUTOLOGIN
      HELP "LRN-AUTOLOGIN"
      CONTINUE

LABEL HELP_PWDLEARN
      HELP "LRN-LEARN"
      CONTINUE

LABEL HELP_SHOWHELP
      HELP "LRN-HELPWIN"
      CONTINUE

LABEL HELP_HOSTLRN
      HELP "LRN-HOST"
      CONTINUE

LABEL HELP_STORDSK
      HELP "LRN-DISK"
      CONTINUE

LABEL HELP_METSYS
LABEL HELP_METUSR
      HELP "LRN-META"
      CONTINUE

LABEL HELP_SETPWD
      HELP "LRN-PASSWORD"
      CONTINUE

LABEL HELP_DELUSR
LABEL HELP_DELACC
      HELP "LRN-DELETEUSERS"
      CONTINUE

LABEL HELP_ADDMAN
      HELP "LRN-ADDUSERS"
      CONTINUE

LABEL HELP_TUNE
      HELP "LRN-TUNE"
      CONTINUE

LABEL HELP_CHGDEF
      HELP "LRN-DEFUSER"
      CONTINUE

LABEL CLICK_PWDLEARN
      if DialogQuery("CFG","PWDLEARN") \
      THEN DIALOG CFG ENABLE  HOSTLRN \
      ELSE DIALOG CFG DISABLE HOSTLRN
      CONTINUE

# Set/alter password on database
LABEL CLICK_SETPWD
      IF $ex == 0 NoLoad
      x = CRYPTFLPWD($IvtPasswdFile,"TEST","DEFAULT")
      DIALOG SETPWD DESTROY
      DIALOG SETPWD
      DIALOG SETPWD TITLE "Set startup password"

      DIALOG SETPWD TEXTBOX    PWDCR "Current password" "LENGTH=12" NOECHO
      DIALOG SETPWD ROOM       "   "
      DIALOG SETPWD BUTTON_NL  VALDT "Validate"
      DIALOG SETPWD TEXTBOX_NL PWDN1 "New password"     "LENGTH=12" NOECHO
      DIALOG SETPWD TEXTBOX_NL PWDN2 "Retype password"  "LENGTH=12" NOECHO
      DIALOG SETPWD NEWLINE_FORCE
      DIALOG SETPWD GROUPSTART
      DIALOG SETPWD BUTTON     PWDAPPLY "Apply new"
      DIALOG SETPWD ROOM       "   "
      DIALOG SETPWD BUTTON     PWDREMOVE "Remove old"
      DIALOG SETPWD ROOM       "   "
      DIALOG SETPWD BUTTON     PWDCANCEL "Cancel"
      DIALOG SETPWD GROUPEND CENTER NEWLINE

      DIALOG SETPWD DISABLE PWDAPPLY
      DIALOG SETPWD DISABLE PWDREMOVE

      # When x == 0, there IS no password set
      IF $x == 0 THEN {
         DIALOG SETPWD DISABLE PWDCR
         DIALOG SETPWD DISABLE VALDT
         DIALOG SETPWD ENABLE  PWDN1
         DIALOG SETPWD ENABLE  PWDN2
      } ELSE {
         DIALOG SETPWD ENABLE  PWDCR
         DIALOG SETPWD ENABLE  VALDT
         DIALOG SETPWD DISABLE PWDN1
         DIALOG SETPWD DISABLE PWDN2
      }

      DIALOG SETPWD SHOW

      WHILE (Ev = DialogEvent("DIALOG","ITEM","","")) != "END"
         IF $Ev == "NOTHING" THEN CONTINUE
         IF $Ev == "ERROR"   THEN BREAK
         IF $Ev == "HELP"    THEN HELP "LRN-PASSWORD" : CONTINUE
         GOTO_OPT "${Ev}_${ITEM}"
         CONTINUE

LABEL CLICK_PWDCANCEL
         BREAK

LABEL CLICK_VALDT
        DialogQuery("SETPWD","PWDCR","t")
         IF CRYPTFLPWD($IvtPasswdFile,"TEST",$t) != 0 THEN {
            POPUP "Password is incorrect";
            t = "DISABLE";
         } ELSE {
            t = "ENABLE";
         }

         # Disable/enable fields and buttons
         DIALOG SETPWD $t PWDN1
         DIALOG SETPWD $t PWDN2
         DIALOG SETPWD $t PWDREMOVE
         DIALOG SETPWD SETACTIVE PWDN1
         CONTINUE

LABEL CLICK_PWDN1
LABEL CLICK_PWDN2
LABEL KEY_PWDN1
LABEL KEY_PWDN2
         # Test if both passwords are the same now
         DialogQuery("SETPWD","PWDN1","t1");
         DialogQuery("SETPWD","PWDN2","t2");
         IF $t1 != $t2 THEN x = "DISABLE" ELSE x = "ENABLE"
         DIALOG SETPWD "$x" "PWDAPPLY"
         CONTINUE

LABEL CLICK_PWDAPPLY
         DialogQuery("SETPWD","PWDN1","t1");    # Make sure
         DialogQuery("SETPWD","PWDN2","t2");
         IF $t1 != $t2 THEN CONTINUE

         CrPwd = $t1
         DialogQuery("SETPWD","PWDN1","CrPwd");
         CRYPTFLPWD($IvtPasswdFile,"PASSWORD",$CrPwd)
         GOTO Enter4Real

LABEL CLICK_PWDREMOVE
         # OK. Set the default one and rewrite database
         CRYPTFLPWD($IvtPasswdFile,"DEFAULT")

LABEL Enter4Real
         SEEKMODE = "REWRITE";
         CALL IvtSaveNewPwds("","","",$SEEKMODE)
         SEEKMODE = ""
         BREAK
      NEXT

      DIALOG SETPWD DESTROY
      CONTINUE          # With main dialog

LABEL CLICK_CFGTHY
      Call SecretServerConfig();        # Separate plugin config
      CONTINUE

# Edit password database
LABEL CLICK_DELUSR
      IF $ex == 0 NoLoad
      DIALOG DELUSR DESTROY
      DIALOG DELUSR
      DIALOG DELUSR TITLE "View/Edit entire database"
      DIALOG DELUSR TEXT_NL \
             Nls("EXPL3","Select an account and click DELETE to remove.")

      DIALOG DELUSR LISTVIEW_NL ACCOUNTS "REQHEIGHT=20"
      DIALOG DELUSR LISTVIEW    ACCOUNTS "HEADER=Host\tUser\tIndicator"
      DIALOG DELUSR LISTVIEW    ACCOUNTS "COLUMN=40" "COLUMN=10" "COLUMN=10"
      DIALOG DELUSR LINE
      DIALOG DELUSR GROUPSTART
      DIALOG DELUSR BUTTON DELSEL "Delete"
      DIALOG DELUSR ROOM "  "
      DIALOG DELUSR BUTTON DELCNC "Done"
      DIALOG DELUSR ROOM "    "
      DIALOG DELUSR BUTTON DELLST "List on screen"
      DIALOG DELUSR GROUPEND NEWLINE CENTER

LABEL FillDelWin
      IvtPwdEditCnt = 0;
      CALL IvtSaveNewPwds("@@@@@","@@@@","@@@@","EDIT")
      IF $IvtPwdEditCnt == 0 THEN DIALOG DELUSR DESTROY : GOTO NoLoad

      DIALOG DELUSR SHOW

      WHILE (Ev = DialogEvent("DIALOG","ITEM","KEY1","KEY2")) != "END"
         IF $Ev == "NOTHING" THEN CONTINUE
         IF $Ev == "ERROR"   THEN BREAK
         IF $Ev == "KEY"     THEN GOTO_OPT "${Ev}_${ITEM}_${KEY1}_${KEY2}"
         IF $Ev == "HELP"    THEN HELP "LRN-DELETEUSERS" : CONTINUE
         GOTO_OPT "${Ev}_${ITEM}"
         CONTINUE

LABEL KEY_ACCOUNTS_0_83         # DEL in ACCOUNTS list
LABEL CLICK_DELSEL              # DELSEL Button
        IvtPwdDelEntry = DialogQuery("DELUSR","ACCOUNTS")
         IvtPwdDelCurr  = 0
         # Rebuild the window (clear first)
         DIALOG DELUSR LISTVIEW ACCOUNTS CLEAR
         CALL IvtSaveNewPwds("@@@@@","@@@@","@@@@","EDIT_DEL")
         GOTO FillDelWin

LABEL CLICK_DELCNC              # Cancel/done
         BREAK

LABEL CLICK_DELLST              # List on screen
         ECHO "\n"              # Start on an new line
         CALL IvtSaveNewPwds("@@@@@","@@@@","@@@@","LIST")
         DialogAddEvent("CFG","CLICK",0,0,"PWDCNC")
         BREAK
      NEXT

      DIALOG DELUSR DESTROY
      CONTINUE

# Delete all accounts for THIS host
LABEL CLICK_DELACC
      IF $ex == 0 NoLoad
      IvtPwdEditCnt = 0;
      CALL IvtSaveNewPwds("@@@@@","@@@@","@@@@","DELHOST")
      DIALOG CFG HIDE
      WINDOW ERR
      WINDOW ERR NOBOX
      WINDOW ERR COLOR "WHITE RED BRIGHT BRIGHT"
      WINDOW ERR TEXT "\n $IvtPwdEditCnt accounts deleted for \n\n"
      WINDOW ERR MORE "\n $HOSTNAME \n"
      WINDOW ERR SHOW
      SLEEP 3
      WINDOW ERR KILL
      DIALOG CFG UNHIDE
      CONTINUE

# Manually add users
LABEL CLICK_ADDMAN
      #IF $ex == 0 NoLoad
      DIALOG ADDUSR DESTROY
      DIALOG ADDUSR
      DIALOG ADDUSR TITLE "Add user manually"
      DIALOG ADDUSR TEXTBOX_NL ADDHOST "Hostname" "LENGTH=40"
      DIALOG ADDUSR TEXTBOX    ADDHOST "ANSWERLENGTH=100"
      DIALOG ADDUSR TEXTBOX_NL ADDNAM  "Username" "LENGTH=40"
      DIALOG ADDUSR TEXTBOX_NL ADDPW1  "Password" "LENGTH=40" NOECHO
      DIALOG ADDUSR TEXTBOX_NL ADDPW2  "Retype"   "LENGTH=40" NOECHO
      DIALOG ADDUSR LINE
      DIALOG ADDUSR GROUPSTART
      DIALOG ADDUSR BUTTON     ADDOK   "Add entry"
      DIALOG ADDUSR ROOM       " "
      DIALOG ADDUSR BUTTON     ADDCN   "Cancel"
      DIALOG ADDUSR GROUPEND CENTER NEWLINE
      DIALOG ADDUSR DEFAULTACTION ADDOK
      DIALOG ADDUSR SHOW

      WHILE (Ev = DialogEvent("DIALOG","ITEM","","")) != "END"
         IF $Ev == "NOTHING" THEN CONTINUE
         IF $Ev == "ERROR"   THEN BREAK
         IF $Ev == "HELP"    THEN HELP "LRN-ADDUSERS" : CONTINUE
         GOTO_OPT "${Ev}_${ITEM}"
         CONTINUE

LABEL CLICK_ADDOK
         DialogQuery("ADDUSR","ADDHOST","Lhost")
         DialogQuery("ADDUSR","ADDNAM", "Lusr")
         DialogQuery("ADDUSR","ADDPW1", "Lpwd")
         DialogQuery("ADDUSR","ADDPW2","x")

         IF $Lhost == "" || $Lusr == "" THEN {
            POPUP "Hostname and username cannot be empty"
            CONTINUE
         }

         IF $Lpwd != $x THEN {
            POPUP "Passwords are not equal"
            CONTINUE
         }

         # All is well
         DIALOG ADDUSR DESTROY
         GOTO AddManReal

LABEL CLICK_ADDCN
         BREAK
      NEXT
      DIALOG ADDUSR DESTROY
      CONTINUE

LABEL AddManReal
      CALL IvtSaveNewPwds($Lhost,$Lusr,$Lpwd,"DFLT")
      CALL WinTxt(NLS("P044","Manual Add Finished"),1)
      WINDOW HW TIMEOUT $IvtPwdPopWait
      CONTINUE

# Change default user
LABEL CLICK_CHGDEF
      IF $ex == 0 NoLoad
      x = CALL IvtPwdChangeDefaultUser($HOSTNAME)
      IF $x THEN CALL IvtSaveNewPwds("","","","REWRITE")
      CONTINUE

# Finetune the system
LABEL CLICK_TUNE
      DIALOG TUNE DESTROY
      DIALOG TUNE
      DIALOG TUNE TITLE "Fine tune the system parameters"

      DIALOG TUNE TEXT_NL \
                  "TAG=TUNE_LOCATION" "LABEL=Location of passwd file: " \
                  "$IvtPasswdFile"

      DIALOG TUNE TEXTBOX_NL TUNE_LOGINWAIT \
                  "Seconds to wait for LOGIN to complete" \
                  NUMERIC $IvtPwdLoginWait / 1000

      DIALOG TUNE TEXTBOX_NL TUNE_SHELLWAIT \
                  "Seconds to wait for SHELL prompt" \
                  NUMERIC $IvtPwdShellWait / 1000

      DIALOG TUNE OPTION_NL TUNE_ALWAYSUSER \
                  "Always send user name" \
                  $IvtPwdAlwaysSendUser

      DIALOG TUNE OPTION_NL TUNE_BEQUIET \
                  "Be quiet when no shell after login" \
                  $IvtPwdNoShellQuiet != ""

      DIALOG TUNE OPTION_NL TUNE_LOGINRS232  \
                  "Attempt login on serial ports" \
                  $IvtPwdLoginRS232

      DIALOG TUNE TEXTBOX TUNE_POPWAIT \
                  "Helpwindow remains on-screen for" \
                  NUMERIC $IvtPwdPopWait
      DIALOG TUNE ROOM " (Ms)"
      DIALOG TUNE NEWLINE
      DIALOG TUNE TEXTBOX TUNE_PWDDELAY \
                  "Force delay after a prompt" \
                  NUMERIC $IvtPwdDelay
      DIALOG TUNE ROOM " (Ms)"
      DIALOG TUNE NEWLINE
      DIALOG TUNE TEXTBOX_NL TUNE_CUSTLOGIN \
                  "Custom 'Login:' prompt" \
                  "LENGTH=40" $IvtPwdCustomLogin

      DIALOG TUNE TEXTBOX_NL TUNE_CUSTPWD \
                  "Custom 'Password:' prompt" \
                  "LENGTH=40" $IvtPwdCustomPasswd

      Split($IvtPwdColor," ","CLR[]","LOCAL",1);

      # National translations prevent SELECT_TEXT option!
      x = CALL PwdTransColorNum($CLR[0])
      DIALOG TUNE COMBOBOX COLORFG \
         "Foreground color of the text popup" \
         "Black" "Blue" "Green" "Cyan" "Red" "Magenta" "Brown" "White" \
         "SELECT=$x"

      DIALOG TUNE ROOM "  "
      DIALOG TUNE OPTION_NL COLORFGB "Bright" \
         "STYLE=RIGHT" ($CLR[2] == "HIGH")

      x = CALL PwdTransColorNum($CLR[1])
      DIALOG TUNE COMBOBOX COLORBG \
         "Background color of the text popup" \
         "Black" "Blue" "Green" "Cyan" "Red" "Magenta" "Brown" "White" \
         "SELECT=$x"

      DIALOG TUNE ROOM "  "
      DIALOG TUNE OPTION_NL COLORBGB "Bright" \
         "STYLE=RIGHT" ($CLR[3] == "HIGH")

      UNSET CLR

      DIALOG TUNE LINE
      DIALOG TUNE GROUPSTART
      DIALOG TUNE BUTTON OK " OK "
      DIALOG TUNE ROOM "  "
      DIALOG TUNE BUTTON CNC "Cancel"
      DIALOG TUNE GROUPEND CENTER
      DIALOG TUNE SHOW

      WHILE (Ev = DialogEvent("DIALOG","ITEM","","")) != "END"
         IF $Ev == "NOTHING" THEN CONTINUE
         IF $Ev == "ERROR"   THEN BREAK
         GOTO_OPT "TUN_${Ev}_${ITEM}"
         CONTINUE

LABEL TUN_CLICK_CNC
         GOTO DoneTune

LABEL TUN_CLICK_OK
         DialogQuery("TUNE","TUNE_LOGINWAIT","x");
         GSET IvtPwdLoginWait = $x * 1000;
         IF $IvtPwdLoginWait < 5000 THEN GSET IvtPwdLoginwait = 5000

         DialogQuery("TUNE","TUNE_SHELLWAIT","x");
         GSET IvtPwdShellWait = $x * 1000;
         IF $IvtPwdShellWait < 5000 THEN GSET IvtPwdShellwait = 5000

         # Automatically does a GSET when that exists..
         DialogQuery("TUNE","TUNE_POPWAIT",   "IvtPwdPopWait"       );
         DialogQuery("TUNE","TUNE_PWDDELAY",  "IvtPwdDelay"         );
         DialogQuery("TUNE","TUNE_ALWAYSUSER","IvtPwdAlwaysSendUser");
         DialogQuery("TUNE","TUNE_CUSTLOGIN", "IvtPwdCustomLogin"   );
         DialogQuery("TUNE","TUNE_CUSTPWD",   "IvtPwdCustomPasswd"  );
         DialogQuery("TUNE","TUNE_LOGINRS232","IvtPwdLoginRS232"    );

         # Older installations can have ANY string in here...
         DialogQuery("TUNE","TUNE_BEQUIET","x");
         GSET IvtPwdNoShellQuiet = $x ? 1 : ""

         # Cleverly re-build the color spec...
         y = Call PwdTransColorNam(DialogQuery("TUNE","COLORFG"));
         x = Call PwdTransColorNam(DialogQuery("TUNE","COLORBG"));
         DialogQuery("TUNE","COLORFGB","b1");
         DialogQuery("TUNE","COLORBGB","b2");
         GSET IvtPwdColor = Concat($y," ",$x," ",               \
                                   $b1 ? "HIGH":"NOHIGH",       \
                                   " ",                         \
                                   $b2 ? "HIGH":"NOHIGH");
         UNSET b1 b2
         Call IvtPwdSaveCfg()
         BREAK

LABEL TUN_CLICK_TUNE_LOGINWAIT
         # Too short makes it unusable!
         DialogQuery("TUNE","TUNE_LOGINWAIT","x");
         IF $x < 5 THEN {
            BEEP
            DIALOG TUNE TEXTBOX TUNE_LOGINWAIT 5
         }
         CONTINUE

LABEL TUN_HELP_TUNE_LOGINWAIT
LABEL TUN_HELP_TUNE_POPWAIT
LABEL TUN_HELP_TUNE_PWDDELAY
         HELP "PWDHOOKVARS"
         CONTINUE

LABEL TUN_HELP_TUNE_ALWAYSUSER
         HELP "$IvtPwdAlwaysSendUser"
         CONTINUE

LABEL TUN_HELP_TUNE_CUSTLOGIN
LABEL TUN_HELP_TUNE_CUSTPWD
         HELP "PWDCUSTPROMPT"
         CONTINUE

LABEL TUN_HELP_TUNE_BEQUIET
         HELP "$IvtPwdNoShellQuiet"
         CONTINUE
      NEXT

LABEL DoneTune
      DIALOG TUNE DESTROY
      CONTINUE

# Function not applicable, no passwords loaded
LABEL NoLoad
      # A WINDOW is text, UNDER the GUI dialog! So hide it...
      DIALOG CFG HIDE
      WINDOW ERR
      WINDOW ERR NOBOX
      WINDOW ERR COLOR "WHITE RED BRIGHT BRIGHT"
      WINDOW ERR TEXT "\n No passwords loaded. \n\n"
      WINDOW ERR SHOW
      SLEEP 3
      WINDOW ERR KILL
      DIALOG CFG UNHIDE
   NEXT
   GOTO Esc

# End this menu
LABEL CLICK_PWDOK
   DialogQuery("CFG","PWDLEARN","x")
   GSET IvtPwdCfgLearn = $x
   LSET IvtPwdCfgLearn = $x

   x = DialogQuery("CFG","AUTOLOGIN")
   IF $x == 2 THEN x = -1       # Uninstall
   GSET IvtPwdCfgAutoLogin = $x

   DialogQuery("CFG","SHOWHELP","IvtPwdShowWin");

   GSET IvtPwdToDisk = DialogQuery("CFG","STORDSK")

   DialogQuery("CFG","METSYS","IvtPwdMetaSystem")
   DialogQuery("CFG","METUSR","IvtPwdMetaUser")

   CALL IvtPwdSaveCfg()         # Save the new settings.

   LocPwdForbidden = !DialogQuery("CFG","HOSTLRN");
   IF $LocPwdForbidden == 0 \
   THEN CALL IvtSaveNewPwds($HOSTNAME,"@@@@","@@@@","ENABLE") \
   ELSE CALL IvtSaveNewPwds($HOSTNAME,"@@@@","@@@@","FORBIDDEN")

LABEL CLICK_PWDCNC
LABEL Esc
   DIALOG CFG DESTROY
END
########################################################################


22.9: Script to maintain common passwords (shared between users)

This particular script should not be used, really...

It addresses a need seen "in the field": groups of sysadmins that administer groups of machines. All of the sysadmins log in with a functional account (such as 'root') and know the common password of the machines. Those passwords are changed on a regular basis but the mechanism by which everybody learns the new password is unsafe (mail) and/or unreliable, so it happens that accounts get locked because too many invalid login attempts are made (using the old password). The NICE solution would be to use SSH, GSSAPI and "sudo", so the sysadmin can login without a password (as himself), then use "sudo" (without a password when you configure SSH to accept password-less login only) and they would have the same powers without the need for shared passwords that are hard to maintain (both the sharing and the keeping-secret parts of it).

However: life being what it is, and procedures being hard to change, this script at least allows you to solve the sharing and secret-ness of the shared passwords. These scripts maintain an encrypted file that holds the passwords.

The owner of the file can grant access for certain passwords to certain users.
When a user tries to login to a host with an account for which the password is not known, the pwdlearn system will query the file and the password access rights. When the current IVT user is allowed to access the password, it is used to do the login.
Upshot: Shared passwords that are reasonably secure and centrally maintained.

The "metapwds.ivt" script is part of the standard distribution of IVT. To enable it, two things must be taken care of:

The default location for the first is the first "Project" directory that is configured and found to exist. The file there will be called common-meta-passwords.ivt. You may want to specify a better location, by doing a:


   GSET META_PWD_COMMON_PASSWORDS = "/some/dir/commonpasswords.ivt"


Note that the file must be accessible to all users of IVT that are going to be sharing these passwords.

The second thing is to arrange for the auto-login and password learning system to query the common-password database to see if the current IVT user has access to the shared password of the current host. There are two ways to do that:


Call MetaPwdSetFindHook("always")


  to be executed somewhere as part of the IVT startup code.

Call MetaPwdSetFindHook("once")


  to be executed.
 
Sessions that try to login with a password and for which the pwdlearn system does not know a password will try the common meta passwords to see if a password is known and authorized for the current user.

Now all that remains to be done is to actually store the passwords and their access rights in the common file. For this, call the MetaPwdManage function.
That will display a GUI dialog that allows you to create, modify and delete passwords and their access rights. The idea is that the dialogs explain themselves. If you cannot make it work, either view the source code below to understand what to do, or mail for support to: support@ivtssh.nl.

The functions to register shared passwords and their rights are all written in the IVT scripting language. The GUI dialogs, manipulation of files with secrets in them, hooking into the password learning system and so on provide a nice example of how to do clever & complex stuff with IVT scripting.

The code below is taken directly from the actual script that is part of the IVT distribution kit, except for a few small details that protect the actual secrets that you store when you use this package. That is also the reason why the script in the distribution kit is encrypted (just like the password learning system scripts).

Other than that, this is how it works:


########################################################################
PACKAGE "MetaPasswords"
PUBLIC SCRIPT MetaPwdManage;
PUBLIC SCRIPT MetaPwdSetFindHook;
PUBLIC SCRIPT MetaHookFunc;
PUBLIC GLOBAL META_PWD_COMMON_PASSWORDS;
########################################################################
Script LoadCurrent
   LOCAL x
   SCOPE GLOBAL VARIABLE LastLoaded;

   # Only ONE of these within IVT. It sets GLOBAL values, and they do
   # not change that often. But when a group of many sessions is
   # started, I don't want ONE instance doing the UNSETS where another is
   # doing the SETS!  That won't do!
   SHAREMODE NONE

   # Do not load the file more often than 10 seconds. Saves overhead.
   IF $LastLoaded != "" && $LastLoaded + 10000 > TIME("MILLISECS") \
   THEN RETURN

   # Read an existing file NOW
   # Delete all old values from memory when they exist, in case the older
   # version had MORE entries than the new one.
   FORALL x "IVT_META_"
      IF $FORALLTYPE != "PACKAGE_GLOBAL" THEN CONTINUE
      IF Substr($x,9,4) == "PWDS" THEN UNSET $x
      IF Substr($x,9,4) == "USRS" THEN UNSET $x
      IF Substr($x,9,4) == "OWNS" THEN UNSET $x
   NEXT

   # When package is not initialized properly, quit
   IF $META_PWD_COMMON_PASSWORDS == "" THEN RETURN

   # When the file exists, read it in startup mode. The STARTUP script
   # in there will set all current values. The PACKAGE makes sure the
   # passwords are visible only by the routines in THIS package.
   IF Exists($META_PWD_COMMON_PASSWORDS) \
   THEN ReadRc($META_PWD_COMMON_PASSWORDS,"STARTUP","PACKAGE")

   GSET LastLoaded = TIME("MILLISECS")
END
########################################################################
Script STARTUP
   LOCAL ChooseProjDir

   # Find a place to store common passwords. Any project-dir that
   # is used when nothing explicit is specified will do...
   IF $META_PWD_COMMON_PASSWORDS != "" THEN GOTO NoChoice

   FORALL x "PROJECTSDIR"
      ChooseProjDir = Expand("\$$x")
      IF $ChooseProjDir != "" && IsDir($ChooseProjDir) THEN BREAK
   NEXT

   IF $ChooseProjDir == "" THEN RETURN
   GSET META_PWD_COMMON_PASSWORDS = "$ChooseProjDir\\common-meta-passwords.ivt"

LABEL NoChoice
   # Tie this to the PWDLEARN debug
   Call IvtPwdDebug("Loading file $META_PWD_COMMON_PASSWORDS");
   Call LoadCurrent()
END
########################################################################
Script StrToName (x)
   LOCAL Res, i;

   # Helper routine
   # Make X something that can be used as part of an identifier
   Res = "";
   FOR (i = 0; $i < LENGTH($x); i++)
      Res = Concat($Res,sprintf("%02X",FromAscii(SubStr($x,$i,1))));
   NEXT

   RETURN $Res
END
#########################################################################
Script NameToStr x
   LOCAL Res, i;

   # Helper routine
   # Reverse StrToName (from hex to ASCII string)
   Res = "";
   FOR (i = 0; $i < LENGTH($x); i = $i + 2)
      Res = Concat($Res,ToAscii(Concat("0x",SubStr($x,$i,2))))
   NEXT

   RETURN $Res
END
#########################################################################
Script PwdPrintable (x)
   LOCAL One, Res, i;

   # Helper routine
   # Make X something that can be printed as a string and survive...
   # Now X can contain quotes, backslashes and so on
   Res = "";
   FOR (i = 0; $i < LENGTH($x); i++)
      # A '$' in a string must be coded as \$
      One = SubStr($x,$i,1)
      IF $One == "\$"           \
      THEN Res = "$Res\\\$"     \
      ELSE Res = Concat($Res,"\\",sprintf("%02X",FromAscii($One)));
   NEXT

   RETURN $Res
END
########################################################################
Script SaveMetaWords
   LOCAL fd, Count, Rights, Owners, Val, x;

   # Save the current set to the password file

   IF $META_PWD_COMMON_PASSWORDS == "" THEN RETURN

   fd = Create($META_PWD_COMMON_PASSWORDS,0666);

   IF $fd < 0 \
   THEN POPUP "Cannot create $META_PWD_COMMON_PASSWORDS" : \
        RETURN

   Count = Rights = Owners = 0;
   WRITE ($fd,"Script STARTUP\n")

   # Save all passwords
   FORALL x "IVT_META_PWDS_"
      IF $FORALLTYPE != "PACKAGE_GLOBAL" THEN CONTINUE

      Val = Call PwdPrintable(Expand("\$$x"))
      WRITE ($fd,"   GSET $x = \"$Val\"\n")
      Count++;
   NEXT

   # Save all access rights to passwords
   FORALL x "IVT_META_USRS_"
      IF $FORALLTYPE != "PACKAGE_GLOBAL" THEN CONTINUE
      Val = Expand("\$$x")
      WRITE ($fd,"   GSET $x = \"$Val\"\n")
      Rights++;
   NEXT

   # Save all package owners
   FORALL x "IVT_META_OWNS_"
      IF $FORALLTYPE != "PACKAGE_GLOBAL" THEN CONTINUE
      Val = Expand("\$$x")
      WRITE ($fd,"   GSET $x = \"$Val\"\n")
      Owners++;
   NEXT

   WRITE ($fd,"END\n");
   Close($fd);

   IF CryptFl($META_PWD_COMMON_PASSWORDS,"PASSWORD",$MyPwd,"1way") != 0 \
   THEN Remove($META_PWD_COMMON_PASSWORDS) : \
        POPUP "Problems encrypting file - removed it!" : \
        RETURN

   POPUP Concat("OK. Saved $Count passwords to\n",      \
                "$META_PWD_COMMON_PASSWORDS\n",         \
                "$Rights access rights, $Owners owners")
END
########################################################################
Script AuthMgm (Kind)
   LOCAL x, Id, Ok, Usr, Nm;

   DIALOG SWPAUT DESTROY
   DIALOG SWPAUT
   DIALOG SWPAUT TITLE "Ownership management"

   IF $Kind == "init" THEN GOTO Init
   DIALOG SWPAUT TEXT_NL \
      Concat("This maintains a list of user-ids that\n", \
             "control access to (meta) passwords");
   GOTO Common

LABEL Init
   DIALOG SWPAUT TEXT_NL \
      Concat(ColorAttribute("BrightRed BrightWhite"),           \
             "Specify INITIAL LIST of people granting access\n", \
             "to passwords. Only THESE Windows users will be\n", \
             "able to modify this later!~0\n");

   # Add the current user by default
   Usr = Call StrToName(GetUserName())
   Nm  = "IVT_META_OWNS_${Usr}"
   GSET $Nm = 1

LABEL Common
   DIALOG SWPAUT LISTVIEW USRS "REQHEIGHT=10" "MINHEIGHT=5" "COLUMN=25"
   DIALOG SWPAUT LISTVIEW USRS "HEADER=User name" "SELECT=0"
   DIALOG SWPAUT NEWLINE
   DIALOG SWPAUT LINE
   DIALOG SWPAUT TEXTBOX ONEUSR "User name: "
   DIALOG SWPAUT ROOM "  "
   DIALOG SWPAUT BUTTON_NL ADD "&Add"
   DIALOG SWPAUT LINE
   DIALOG SWPAUT GROUPSTART
   DIALOG SWPAUT BUTTON OK "&OK"
   DIALOG SWPAUT ROOM "  "
   DIALOG SWPAUT BUTTON DELETE "&Delete"
   DIALOG SWPAUT GROUPEND NEWLINE CENTER

LABEL Again
   DIALOG SWPAUT LISTVIEW USRS "CLEAR"

   Id = 0
   FORALL x "IVT_META_OWNS_"
      IF $FORALLTYPE != "PACKAGE_GLOBAL" THEN CONTINUE
      IF Split($x,"_","Parts","LOCAL",0) != 4 THEN CONTINUE
      Usr = Call NameToStr($Parts_3);
      DIALOG SWPAUT LISTVIEW USRS "$Usr"
      Nm = "Map_$Id"
      CSET $Nm = $x             # Map listview number to name X
      Id++;                     # Number entry n listview
   NEXT

   DIALOG SWPAUT SHOW            # Actually show the dialog
   Ok = 0

   WHILE (Ev = DialogEvent("DIALOG","ITEM","KEY1","KEY2")) != "END"
      IF $Ev == "NOTHING" THEN CONTINUE
      IF $Ev == "ERROR"   THEN BREAK

      # Automagically jump to handler when defined.
      GOTO_OPT "${Ev}_${ITEM}"
      CONTINUE

LABEL CLICK_OK                  # Values OK. Save.
      BREAK

LABEL CLICK_ADD                 # Add chosen
      DialogQuery("SWPAUT","ONEUSR","Usr")
      IF $Usr == "" THEN BEEP : CONTINUE
      Usr = Call StrToName($Usr)
      Nm  = "IVT_META_OWNS_${Usr}"
      GSET $Nm = 1
      GOTO Again

LABEL CLICK_DELETE              # DELETE chosen
      IF (Id = DialogQuery("SWPAUT","USRS")) >= 0 \
      THEN UNSET Expand("\$Map_$Id")
      GOTO Again                # Display result
   NEXT

   DIALOG SWPAUT DESTROY        # Remove the dialog from the screen
END
#########################################################################
Script CheckAuthorization
   LOCAL x, Count, ThisUser, OneOwn, Ok;

   # Check to see if the current user is authorized to maintain passwords
   # When zero owners are found, initialize the mechanism

   Count = Ok = 0;
   ThisUser = GetUserName()
   FORALL x "IVT_META_OWNS_"
      IF $FORALLTYPE != "PACKAGE_GLOBAL" THEN CONTINUE
      IF Split($x,"_","Parts","LOCAL",0) != 4 THEN CONTINUE
      Count++;

      OneOwn = Call NameToStr($Parts_3);
      IF $OneOwn == $ThisUser THEN Ok = 1
   NEXT

   # No access set yet?  Initialize it
   IF $Count == 0 THEN RETURN "init"            # Not initialized
   IF $Ok    == 0 THEN RETURN "no"              # Not authorized
   IF $Ok    == 1 THEN RETURN "yes"             # Not authorized

   RETURN "no"          # Not authorized
END
#########################################################################
SCRIPT MgmAccess (Proj,UserNm)
   LOCAL x, Id, Ok, Usr, Nm, Proj_x, User_x;
   LOCAL OneP, OneU;

   x = Call CheckAuthorization()
   IF $x != "yes" THEN RETURN

   DIALOG SWPACC DESTROY
   DIALOG SWPACC
   DIALOG SWPACC TITLE "Manage access to $Proj/$UserNm"

   DIALOG SWPACC TEXT_NL \
      Concat("This maintains a list of user-ids that\n",        \
             "can access the password of\n",                    \
             ColorAttribute("BrightBlue BrightWhite"),          \
             "Host/Project $Proj, user $UserNm~0\n",            \
             ColorAttribute("BrightRed BrightWhite"),           \
             "Add user * to give EVERYBODY access!")

   DIALOG SWPACC LISTVIEW USRS "REQHEIGHT=10" "MINHEIGHT=5" "COLUMN=25"
   DIALOG SWPACC LISTVIEW USRS "HEADER=User name" "SELECT=0"
   DIALOG SWPACC NEWLINE
   DIALOG SWPACC LINE
   DIALOG SWPACC TEXTBOX ONEUSR "User name: "
   DIALOG SWPACC ROOM "  "
   DIALOG SWPACC BUTTON_NL ADD "&Add"
   DIALOG SWPACC LINE
   DIALOG SWPACC GROUPSTART
   DIALOG SWPACC BUTTON OK "&OK"
   DIALOG SWPACC ROOM "  "
   DIALOG SWPACC BUTTON DELETE "&Delete"
   DIALOG SWPACC GROUPEND NEWLINE CENTER

   Proj_x = Call StrToName($Proj)
   User_x = Call StrToName($UserNm)

LABEL Again
   DIALOG SWPACC LISTVIEW USRS "CLEAR"

   Id = 0
   FORALL x "IVT_META_USRS_"
      IF $FORALLTYPE != "PACKAGE_GLOBAL" THEN CONTINUE
      IF Split($x,"_","Parts","LOCAL",0) != 6 THEN CONTINUE

      OneP = Call NameToStr($Parts_3);
      OneU = Call NameToStr($Parts_4);
      Usr  = Call NameToStr($Parts_5);
      IF $OneP != $Proj || $OneU != $UserNm THEN CONTINUE

      DIALOG SWPACC LISTVIEW USRS "$Usr"
      Nm = "Map_$Id"
      CSET $Nm = $x             # Map listview number to name X
      Id++;                     # Number entry n listview
   NEXT

   DIALOG SWPACC SHOW            # Actually show the dialog
   Ok = 0

   WHILE (Ev = DialogEvent("DIALOG","ITEM","KEY1","KEY2")) != "END"
      IF $Ev == "NOTHING" THEN CONTINUE
      IF $Ev == "ERROR"   THEN BREAK

      # Automagically jump to handler when defined.
      GOTO_OPT "${Ev}_${ITEM}"
      CONTINUE

LABEL CLICK_OK                  # Values OK. Save.
      BREAK

LABEL CLICK_ADD                 # Add chosen
      DialogQuery("SWPACC","ONEUSR","Usr")
      IF $Usr == "" THEN BEEP : CONTINUE
      Usr = Call StrToName($Usr)
      Nm  = "IVT_META_USRS_${Proj_x}_${User_x}_${Usr}"
      GSET $Nm = 1
      GOTO Again

LABEL CLICK_DELETE              # DELETE chosen
      Id = DialogQuery("SWPACC","USRS")
      UNSET Expand("\$Map_$Id")
      GOTO Again                # Display result
   NEXT

   DIALOG SWPACC DESTROY        # Remove the dialog from the screen
END
#########################################################################
Script SetPassword (Proj,UserNm,Pwd)
   LOCAL Ok;
   LOCAL Proj_p, User_p, Nm;

   # This script adds an entry to the set of passwords. It creates a
   # variable "IVT_META_PWDS_${Proj_p}_${User_p}" where Proj_p and User_p
   # are hexadecimal-number strings encoding a project and username. The
   # VALUE of the variable is the encoded passwords (hex, escaped $-signs)

   # Construct a GUI dialog
   DIALOG SPWDA DESTROY
   DIALOG SPWDA
   DIALOG SPWDA TITLE "Set new password"
   DIALOG SPWDA TEXT_NL Concat("This sets a project-meta password\n",\
                       "available to authorized IVT users\n")
   DIALOG SPWDA TEXTBOX_NL PROJ   "Project name:" "LENGTH=10" $Proj
   DIALOG SPWDA TEXTBOX_NL USERNM "Account name:" "LENGTH=20" $UserNm
   DIALOG SPWDA TEXTBOX_NL PWD1   "New password:" "LENGTH=20" "NOECHO" "$Pwd"
   DIALOG SPWDA TEXTBOX_NL PWD2   "Again       :" "LENGTH=20" "NOECHO" "$Pwd"
   DIALOG SPWDA LINE
   DIALOG SPWDA GROUPSTART
   DIALOG SPWDA BUTTON OK " &OK "
   DIALOG SPWDA ROOM "    "
   DIALOG SPWDA BUTTON CANCEL "&Cancel"
   DIALOG SPWDA GROUPEND NEWLINE CENTER

   DIALOG SPWDA DEFAULTACTION OK                # ENTER equals OK
   DIALOG SPWDA SHOW                            # Actually show the dialog
   Ok = 0

   IF $Proj != "" THEN DIALOG SPWDA SETACTIVE PWD1

   WHILE (Ev = DialogEvent("DIALOG","ITEM","KEY1","KEY2")) != "END"
      IF $Ev == "NOTHING" THEN CONTINUE
      IF $Ev == "ERROR"   THEN BREAK

      # Automagically jump to handler when defined.
      GOTO_OPT "${Ev}_${ITEM}"
      CONTINUE

LABEL CLICK_OK
      # Retrieve the values from the dialog
      DialogQuery("SPWDA","PROJ",  "PROJ");
      DialogQuery("SPWDA","USERNM","USERNM");
      DialogQuery("SPWDA","PWD1",  "PWD1");
      DialogQuery("SPWDA","PWD2",  "PWD2");
      IF $USERNM == "" THEN BEEP : CONTINUE
      IF $PWD1 == "" || ($PWD1 != $PWD2) THEN           \
         POPUP "Passwords empty or not the same" :      \
         CONTINUE

      # Values OK
      Ok = 1
      BREAK

LABEL CLICK_CANCEL              # CANCEL chosen
      Ok = 0
      BREAK

   NEXT

   DIALOG SPWDA DESTROY         # Remove the dialog from the screen
   IF !$Ok THEN RETURN          # Cancelled

   # Add/overwrite a new entry. Encode to hex-strings so a project or
   # username can contain anything, yet yield a valid VARIABLE name.
   Proj_p = Call StrToName("$PROJ")
   User_p = Call StrToName("$USERNM")
   Nm     = "IVT_META_PWDS_${Proj_p}_${User_p}"

   # This creates a PACKAGE_GLOBAL variable, visible ONLY in this package!
   GSET $Nm = $PWD1;
END
#########################################################################
Script MetaPwdManage
   # Construct a GUI dialog
   LOCAL Au, Count, Nm, x;
   LOCAL Proj_p, User_p;
   LOCAL Proj, UserNm, Txt;

   DESCR "Manage Common Meta Passwords"

   # This script is the main dialog displayed to the user. It shows a
   # list of defined project/user names and allows the user to add, edit
   # and delete entries from the list, plus two buttons to manage
   # ownership of the file and manage access rights on the passwords.

   Call LoadCurrent             # (Re) load current set

   Au = Call CheckAuthorization
   IF $Au == "init" \
   THEN {
      CALL AuthMgm("init")
      Au = Call CheckAuthorization
   }

   # The CURRENT user must be one of the OWNERS
   IF $Au != "yes" \
   THEN POPUP "You are not authorized. Ask your sysadmin!" : \
        RETURN

   DIALOG SPWDM DESTROY
   DIALOG SPWDM
   DIALOG SPWDM TITLE "Manage common passwords"
   DIALOG SPWDM TEXT_NL Concat("This maintains project-meta passwords ",\
                               "available\nto authorized IVT users\n")
   DIALOG SPWDM LISTVIEW METAS "REQHEIGHT=10" "COLUMN=10" "COLUMN=25"
   DIALOG SPWDM LISTVIEW METAS "SELECT=0"
   DIALOG SPWDM LISTVIEW METAS "HEADER=Project\tAccount"

   DIALOG SPWDM NEWLINE
   DIALOG SPWDM LINE
   DIALOG SPWDM GROUPSTART
   DIALOG SPWDM BUTTON OK "&Save"
   DIALOG SPWDM ROOM "  "
   DIALOG SPWDM BUTTON DELETE "&Delete"
   DIALOG SPWDM ROOM "  "
   DIALOG SPWDM BUTTON EDIT "&Edit"
   DIALOG SPWDM ROOM "  "
   DIALOG SPWDM BUTTON ADD "&Add"
   DIALOG SPWDM ROOM "  "
   DIALOG SPWDM BUTTON CANCEL "&Cancel"
   DIALOG SPWDM GROUPEND NEWLINE CENTER
   DIALOG SPWDM GROUPSTART
   DIALOG SPWDM BUTTON MGMOWN "&Manage ownership"
   DIALOG SPWDM ROOM "  "
   DIALOG SPWDM BUTTON MGMACC "&Manage access"
   DIALOG SPWDM GROUPEND NEWLINE CENTER

LABEL Again
   DIALOG SPWDM LISTVIEW METAS "CLEAR"

   Id = 0
   FORALL x "IVT_META_PWDS_"
      IF $FORALLTYPE != "PACKAGE_GLOBAL" THEN CONTINUE
      # x looks like "IVT_META_PWDS_${Proj}_${User}"
      # Split on underscore, get parts 3 & 4
      IF Split($x,"_","Parts","LOCAL",0) != 5 THEN CONTINUE

      Proj   = Call NameToStr($Parts_3);
      UserNm = Call NameToStr($Parts_4);
      DIALOG SPWDM LISTVIEW METAS "$Proj\t$UserNm"
      Nm = "Map_$Id"
      CSET $Nm = $x             # Map listview number to name X
      Id++;                     # Number entry n listview
   NEXT

   DIALOG SPWDM SHOW            # Actually show the dialog
   Ok = 0

   WHILE (Ev = DialogEvent("DIALOG","ITEM","KEY1","KEY2")) != "END"
      IF $Ev == "NOTHING" THEN CONTINUE
      IF $Ev == "ERROR"   THEN BREAK

      # For edit/delete/mgm we need details of current selection
      # Do ONCE, saves repeated code
      Proj = UserNm = Nm = Pwd = ""
      IF (Id = DialogQuery("SPWDM","METAS","Txt")) >= 0 \
         Split($Txt,"\t","Flds","LOCAL",0)
         Proj   = $Flds_0
         UserNm = $Flds_1
         Nm     = Expand("\$Map_$Id")
         Pwd    = Expand("\$$Nm")
      }

      # Automagically jump to handler when defined.
      GOTO_OPT "${Ev}_${ITEM}"
      CONTINUE

LABEL CLICK_OK                  # Values OK. Save.
      Ok = 1
      BREAK

LABEL CLICK_EDIT                # Edit entry
      Call SetPassword($Proj,$UserNm,$Pwd)
      GOTO Again

LABEL CLICK_ADD                 # Add chosen
      Call SetPassword("","","")
      GOTO Again

LABEL CLICK_DELETE              # DELETE chosen
      IF $Id < 0 THEN CONTINUE
      UNSET $Nm                 # Delete row itself

      # Then delete all the rights given to this row
      FORALL x "IVT_META_USRS_"
         IF $FORALLTYPE != "PACKAGE_GLOBAL" THEN CONTINUE
         # x like "IVT_META_USRS_${Proj_x}_${User_x}_${Usr}"
         IF Split($x,"_","Parts","LOCAL",0) != 6 THEN CONTINUE
         Proj_p = Call NameToStr($Parts_3);
         Usr_p  = Call NameToStr($Parts_4);
         IF $Proj_p == $Proj && $Usr_p == $UserNm THEN UNSET $x
      NEXT
      GOTO Again                # Display result

LABEL CLICK_MGMOWN              # Manage ownership
      CALL AuthMgm              # Private function
      CONTINUE

LABEL CLICK_MGMACC              # Manage access rights
      IF $Id < 0 THEN CONTINUE
      IF $Proj == "" || $UserNm == "" THEN BEEP : CONTINUE
      Call MgmAccess($Proj,$UserNm)
      CONTINUE

LABEL CLICK_CANCEL              # CANCEL chosen
      Ok = 0
      BREAK

   NEXT

   DIALOG SPWDM DESTROY         # Remove the dialog from the screen
   IF !$Ok THEN RETURN          # Cancelled

   Call SaveMetaWords           # Store new set
END
#########################################################################
Script MetaPwdSetFindHook (Method)
   # Versions of Pwdlearn exists that do NOT have this hook function.
   # Prevent errors from appearing when a non-existent function is called
   # Migration purposes only....
   HIDE
   IF !Defined("PwdAddFindScript") THEN RETURN

   Call IvtPwdDebug("Setting PwdFind hook to $Method");

   # Set the hook. Pwdlearn will call the given function when a password
   # is not found any other way. The function will first be called with
   # the name of the host and user, when that fails, meta-host and user.
   # When called with "always", do this for all future sessions, otherwise
   # once only
   IF $Method == "always"                       \
   THEN PRECONNECT * MetaHookFunc once          \
   ELSE Call PwdAddFindScript("MetaHookFunc")
END
#########################################################################


22.10: Script to provide a context menu per host

The HOSTLIST command can be used to create an address book for the user.
The EXTRA clause of the hostlist command can be used to code arbitrary details for every host. This example uses that to pass the name of a menu for every host. When the user creates a session to such a host, the MENU command is used to construct a menu on the IVT menu bar that contains commands, scripts, help, and other handy actions specific for that host that the user can activate with a few simple mouse clicks.
The ONSWITCHTO command is used when the user switches sessions to clear one menu and create another. That way, there is always a menu on the IVT menu bar that contains the handy commands for the host the user is currently looking at. For a host that has no menu, the menu will disappear when the user switches to such a host.
Since the actual contents of the menu is created by a script, this can vary according to arbitrary needs (current user on that host, time of day, anything else that the script considers significant).

This can be used, for example, when the host is a server that runs a specific application, and that application has specific commands to start, stop, trace or otherwise manipulate the software. All sorts of details that the user would otherwise have to remember are now only a mouse-click away.

In this case, the "Projects" feature is combined with the context menu.
Every application is a project, and the project file for the application describes the development, test, acceptance test and production hosts. All these application hosts share the same context menu. Another project has another context menu for all ITS hosts. The real-live situation this is taken from has dozens of applications, this example only shows two of them, and those only partially, just to show how it is done.

The parts are:

The project file for project xxx defines a menu_xxx function that actually (re)builds the menu. Example: project TRIX has a "menu_trix" script.
The EXTRA clause is used to associate the name of the context menu with every host that should have that menu (part of the TRIX system).
The EXTRA parser recognizes the "MENU=xxx" clause and calls the handler for that option, which calls the menu_trix function AND uses ONSWITCHTO to make sure that the menu_trix function is called every time the user switches to a session that should have the TRIX menu (and removes it every time the user switches away).

The details are in the following sections.


22.10.1: The TRIX project file

Here, we have the project file for an application called "Trix". This is what it looks like:


# Trix: Payment application
########################## BEGINS ######################################
Script menu_trix
   HIDE
   SECRET

   MENU SELECT 1
   MENU RESET
   MENU TITLE "TRIX-Macros"
   MENU CALL   "Stop TRIX"       TrixDo "./StopTrixProdScript"
   MENU CALL   "Start TRIX"      TrixDo "./StartTrixProdScript"
   MENU LINE
   MENU CALL   "Status van TRIX" TrixDo "./StatusTrix.sh"
   MENU ENABLE
   MENU SELECT 0
END
########################################################################
Script TrixDo (Cmd)
   HIDE
   SEND "cd /opt/ws/p/was/5/bin/payhub; $Cmd\r"
END
########################################################################
HOSTLIST COMMENT_ONLY ""
HOSTLIST COMMENT "TRIX project"
HOSTLIST COMMENT_ONLY "=================="
HOSTLIST EXTRA CLEAR
HOSTLIST EXTRA "MENU=trix\n"
HOSTLIST usa10069  wasadmin "TRIX node 1" SSH
HOSTLIST usa10070  wasadmin "TRIX node 2" SSH
HOSTLIST EXTRA CLEAR
########################## ENDS ########################################

This project file begins with a line of comment that describes the project.
The "menu_trix" function selects the 2nd menu, clears it, and rebuilds it.
It contains a stop, start and status entry. Each entry, when clicked, will call the "TrixDo" script, which will send a command to change to the proper application directory (WebSphere 5 application server) and run the application specific script there.

The HOSTLIST entries list the hosts, the user to login as and a description.
The EXTRA lines make sure that when a connection to one of the TRIX hosts is made, the $HOSTLIST_EXTRA variable will contain "MENU=trix\n".

This will cause the "menu_trix" function to be called every time the user switches to a host of the "trix" project.


22.10.2: The ITShop project file

This PROJECT file describes machines used for a website to order office materials (IT shop). This is what it looks like:


# ITShop - Webshop for internal use
########################## BEGINS ######################################
Script menu_ITShop
   HIDE
   SECRET

   MENU SELECT 1
   MENU RESET
   MENU TITLE "ITshop-Macros"
   IF $USER != "wasadmin" && $TargetUser != "wasadmin" THEN \
   MENU CALL   "SUDO naar &wasadmin"    SimpleSudoW wasadmin

   MENU CALL   "Select DEVELOPMENT (d)" ITShopDo "" "d"
   MENU CALL   "Select TEST        (t)" ITShopDo "" "t"
   MENU CALL   "Select ACCPEPTANCE (a)" ITShopDo "" "a"
   MENU CALL   "Select PRODUCTION  (P)" ITShopDo "" "p"

   MENU CALL "Start Scheduler script" ITShopDo "./Scheduler.sh"
   MENU CALL "Apply schedule now"     ITShopDo "./migrateServices.sh schedule"

   MENU ENABLE
   MENU SELECT 0
END
########################################################################
Script ITShopDo Cmd Env
   HIDE

   # All commands must be executed as user "wasadmin"
   IF $USER == "wasadmin" THEN GOTO UserOK
   x = Call SimpleSudo("wasadmin")
   IF !$x THEN ECHO "~2SUDO to wasadmin failed, abort~0\n" : RETURN

LABEL UserOK
   IF $Env != "" THEN Send "ENV=$Env; "
   SEND "cd /opt/ws/\$ENV/apps/requestcenter/Tools/Acme109/Files; "
   IF $Cmd != "" THEN SEND "$Cmd;"

   SEND "\r"
END
########################## ENDS ########################################
HOSTLIST COMMENT_ONLY ""
HOSTLIST COMMENT "ITShop project"
HOSTLIST COMMENT_ONLY "=================="
HOSTLIST EXTRA CLEAR
HOSTLIST EXTRA "MENU=ITShop"
HOSTLIST usa20064  wasadmin "ITShop ONT, ACC en TEST host" SSH
HOSTLIST usa10064  wasadmin "ITShop productie host"        SSH

Here, the menu will test if the current user on the host is wasadmin.
If not, a menu entry is added to invoke "sudo" to become wasadmin.
The other menu entries will switch to a directory with a very long name that also depends on the current environment, and optionally run a command there.

The HOSTLIST entries list the hosts, the user to login as and a description.
The EXTRA lines make sure that when a connection to one of the shop hosts is made, the $HOSTLIST_EXTRA variable will contain "MENU=sITShop\n".


22.10.3: A script to parse the $HOSTLIST_EXTRA information

Setting the EXTRA clause for a host only results in the $HOSTLIST_EXTRA variable being set to the specified value when the user makes a connection to that host. IVT itself attaches no special meaning to that value, a script must see it and handle it. This is handled by the PROJECTS module of IVT.
The relevant bit is this:


########################## BEGINS ######################################
# This is a generic parser for EXTRA clause of the HOSTLIST command.
# Various handy constructions can be specified per host, this routine
# breaks up files into lines and calls a handler per line.
#
# Split the EXTRA into lines: EXTRA_0 - EXTRA_n
# Every line has the form WORD=THING, or just WORD
# Every WORD has a handler that called IVT_Handler_$WORD, which can be
# overloaded using $PROJ_Handler_$WORD
#
########################################################################
# Make sure this CheckExtra gets called BEFORE normal PRECONNECTS
# by setting a higher priority than default (which is 100.000)
PRECONNECT * PRIORITY=1000 CheckEXTRAstuff
Script CheckEXTRAstuff ()
   LOCAL n, i, Line, o1, o2, Offs, Handler, ExtraArg, OrgArg;

   n = Split($HOSTLIST_EXTRA,"\n","EXTRA[]","LOCAL",1);

   IF $n > 0 && $PROJECTS_DEBUG \
   THEN ECHO "~1PROJECT~0: HOSTLIST_EXTRA=$HOSTLIST_EXTRA\n"

   For (i = 0; $i < $n; i++)
      Line = $EXTRA[$i];
      Offs = StrStr("=",$Line)
      ExtraArg = "";
      OrgArg = "";

      # For "SET FOO=bar" the separator is a SPACE, not '='
      o1 = StrStr(" ",$Line);
      IF $o1 >= 0 && $o1 < $Offs THEN Offs = $o1;

      # Suppose we have "MENU=xx 8" as $Line. I support ONE space argument
      # using $Arg and $ExtraArg. Also pass the entire original part after
      # the '=' sign as a 3rd argument, so the handler can use its own
      # interpretation.
      IF ($Offs >= 0) THEN {
         Cmd    = SubStr($Line,0,$Offs);        # Cmd = 'MENU'
         Arg    = substr($Line,$Offs + 1,-1);   # Arg = 'xx 8'
         OrgArg = $Arg;
         if ((o2 = StrStr(' ',$Arg)) > 0) THEN {
            Arg = substr($Arg,0,$o2);           # Arg = "xx"
            ExtraArg = substr($Arg,$o2 + 1,-1); # ExtraArg = 8
         }
      } ELSE {
         Cmd = $Line;           # No '=', simple command
         Arg = "";
      }

      IF $Cmd == ""     THEN CONTINUE;  # Ignore empty lines
      IF $Cmd == "HOPS" THEN BREAK;     # Hops is multi-line :-(

      # By setting PROJECT_HANDLER to a prefix for a handler routine, you
      # can overload the default handler.

      IF Vardef("PROJECT_HANDLER") THEN {
         Handler = "${PROJECT_HANDLER}_Handler_${Cmd}"
         IF Defined($Handler) THEN {
            IF $PROJECTS_DEBUG THEN ECHO "~1PROJECT~0: Call $Handler($Arg)\n";
            CALL $Handler($Arg, $ExtraArg, $OrgArg);
            CONTINUE;
         }
      }

      # Try default handler
      Handler = "IVT_Handler_$Cmd";
      IF Defined($Handler) THEN {
         IF $PROJECTS_DEBUG THEN ECHO "~1PROJECT~0: Call $Handler($Arg)\n";
         Call $Handler($Arg, $ExtraArg, $OrgArg);
      } ELSE {
         Echo NLS("ST4","~2ERROR: EXTRA contains unknown command $Cmd\n");
      }
   NEXT
END
########################## ENDS ########################################

This script assumes that the EXTRA information is a bunch of newline separated commands and settings. It uses the SPLIT function to break that down into separate lines. When a line like "MENU=trix\n" is seen, it will break that down into a Cmd value of "MENU" and an Arg value of "trix".

It then uses the DEFINED function to see if a script by the name of IVT_Handler_MENU is defined. When not, an error message is thrown onto the screen. When defined, it CALLs the function, passing the argument.
Note that this is an INDIRECT call, the CALL uses "$Handler" as the function name!
The upshot is that when the user connects to a host that has "MENU=trix\n" in its EXTRA value, the IVT_Handler_MENU gets called with "trix" as an argument.
It is done this way to make the framework very easily extended to handle new commands to the EXTRA descriptions.


22.10.4: A script to handle the MENU=XXX EXTRA clause

The script to parse the $HOSTLIST_EXTRA calls a handler for every specific command. One such command is MENU=trix or MENU=ITShop, in this example, but there can be very many different applications, each with its own context menu. Here, "trix" is a project named after an application, and so is ITShop. Every "project" describes all the hosts used in that application environment (such as development, test and production hosts and anything else that is related to that particular project).

The purpose here is to have a menu appear on the IVT menu bar that is host- specific: Standard commands to use on the host, help menu that may explain the purpose in life of that host, etc. The menu can be used by admin staff so they do not have to remember the exact details of often-used commands on the various hosts.

The MENU handler looks like this:


########################## BEGINS ######################################
# MENU=xxx in the EXTRA will cause a menu_XXX script to be called every
# time the user switches to a host that specifies that menu. The typical
# place for the definition of that script would be the project file.
# Example: EXTRA="MENU=xx\n" will cause function "menu_xx" to be called
# every time the user switches to a host that has that attribute defined.
# Every time the user switches AWAY from such a host, the menu is removed.
########################################################################
Script IVT_Handler_MENU (Name, Number)
   LOCAL FullNm;

   HIDE
   IF $Number == "" THEN {
      # Menus are numbered 0 - 9. Choose a default when not given.
      Number = ($PROJECT_MENU != "" ? $PROJECT_MENU : 2);
   }

   FullNm = "menu_$Name";               # name of a user-defined script
   IF (Defined($FullNm)) THEN {
      IVT_MY_MENU        = $FullNm;
      IVT_MY_MENU_NUMBER = $Number;
      # The CheckMenuSwitchTo is called automatically when the session
      # is created (and becomes active).
   } ELSE {
      ECHO NLS("ST5",\
             "~2IVT: ERROR:~0 Script $FullName has not been defined!\n")
   }
END
########################################################################
ONSWITCHFROM PRIORITY=1000 CheckMenuSwitchFrom
ONSWITCHTO   PRIORITY=1000 CheckMenuSwitchTo
Script CheckMenuSwitchTo ()
   SECRET
   SHAREMODE "NONE"

   # If the current session does NOT have the foreground, do nothing
   IF FgSessId() != MySessId() THEN RETURN

   # This script gets called initially when a project file says "MENU=xx"
   # for a host. It has to create the menu.
   # And it gets called when switching TO that host. In that case it must
   # re-create the menu. Only when set to a valid function name.
   IF TypeOf(IVT_MY_MENU) == "SCALAR" && Defined($IVT_MY_MENU) THEN {
      # This is the self-defined, actual menu-creating function
      # Note: Indirect call: $IVT_MY_MENU contains the name of a script.
      CALL $IVT_MY_MENU($IVT_MY_MENU_NUMBER)
      RETURN
   }
END
########################################################################
Script CheckMenuSwitchFrom ()
   SHAREMODE "NONE"

   # If there IS a per-session menu, remove it when we switch from
   # this session. Must have been set with GSET!
   IF TypeOf(IVT_MY_MENU) == "SCALAR" && Defined($IVT_MY_MENU) THEN {
      IF TypeOf(IVT_MY_MENU_NUMBER) == "SCALAR" THEN {
         MENU SELECT $IVT_MY_MENU_NUMBER
         MENU RESET
         MENU SELECT 0
      }
   }
END
########################## ENDS ########################################

The script determines the full function name of the script that actually builds the context menu. For example, when "Name" is passed as "trix", the function to create the menu is called "menu_trix". And that script is defined in the project file, see here.

The handler function uses the DEFINED function to find out if the actual function is defined. When not, it throws an error on screen.
When defined, the function is called (using, yet again, an INDIRECT call).

Also, importantly, it sets a session-local variable called IVT_MY_MENU to the name of the function that provides the actual menu.
This is because the ONSWITCHTO that is also defined, will call the CheckMenuSwitch script ALWAYS when the user switches sessions in whatever way and for whatever reason! When a session is activated that has a value set for $IVT_MY_MENU, then that variable is assumed to point to a script that (re)builds the context menu for the session.
And, lo and behold, the menu_trix script uses MENU RESET to do exactly that. So does the menu_ITShop function.

When the user switches to a session that has no function defined (remember that there are many ways to start sessions, not all of the hosts need be listed in the projects files) then the CheckMenuSwitch command deletes any context menu that might otherwise be left behind (and which might have nothing to do with the session it appears on).

The SECRET statement is used to prevent that an icon is displayed in the status bar of the session while the script is running. Without it, an icon will flash briefly, causing annoying redraws of the status bar when the "executing script" icon is switch on and off each time a user switches between sessions.


22.11: Script to program the Unix PS1 prompt

The AutoPrompt system is nice example of the power of IVT scripting.
It has the following features:

The upshot is that essential information about the current state of all your sessions is displayed in places that makes sessions easily distinguishable from each other, even if you have many sessions.

The system is disabled by default. It programs the PS1 string of a Unix shell, and not all Shells on all Unix flavors have the same capabilities, so your Mileage May Vary. To enable, use the "Scripts" menu entry AutoPrompt.
When the prompt is set, a clickable (hyperlink-colored) message is displayed.
Clicking that takes you straight to the configuration dialog.

Check 'Enable AutoPrompt system'. It will show you which bits of information are displayed, and where.
To change the configuration, enter your own preferences:

All other text will show up as literal text. When you enclose an item in brackets of some form, and the item is empty, the brackets will be removed as well.

High time for an example!

This script is still a little experimental; if you have suggestions or questions, please send mail.

The complete annotated source of the script follows below. You can find the actual script in $IVTDIR/Plugins/03_AutoPrompt.ivt.
The script uses many advanced scripting techniques to interact with a host, display GUI dialogs, store and retrieve configuration information in the registry, etc. etc.


########################################################################;
# Script to configure a Unix prompt to send status-information that IVT
# picks up and displays in the TAB, TITLE, statusbar or prompt itself.
# Note: The core of IVT knows about the existence of this package,
# when saving current sessions as a group it check for $MyP{'DIR'}
########################################################################
PACKAGE "AutoPrompt"
PUBLIC SCRIPT  AutoPromptConfig, AutoPromptEnabled;
PUBLIC SCRIPT  AutoPromptSetPrompt;
PUBLIC GLOBAL  AutoPromptForceMode;     # Settable from outside
PUBLIC SESSION AutoPromptSetPromptDone; # Testable from outside
PUBLIC SESSION AUTOPROMPT;              # Settable from outside
PUBLIC SESSION AutoPromptOnPrompt;      # Testable from outside
########################################################################
ONLANGUAGE ResetLanguage
########################################################################
Script ResetLanguage
   Call IVTRegisterPlugin( \
        CalledBy(0,"FILE"), \
        NLS("MN_15","Automatically configure Unix Prompt"),\
            "Ex-AutoPrompt", "AutoPromptConfig");
END
########################################################################
Script Startup
   Call ResetLanguage()
END
########################################################################
# Note: When the language switches, the HIGHLIGHT is translated automatically
# when it has an ID and the translation files have a match.
HIGHLIGHT \
   PATTERN="IVT AutoPrompt: Configured session prompt successfully" \
   RELATIVE UNDERLINE                                   \
   ID=AutoPrompt                                        \
   FG=brightblue BG=default                             \
   CALL_BUTTON1=AutoPromptConfig                        \
   TIP="Click to configure AutoPrompt"

########################################################################
ONCONNECT    * AutoPromptSetPrompt      # Configure PS1 prompt on new sessions
ONCONNECT    * PromptDecode             # Decode prompt
ONCONNECT    * MonitorState
ONSWITCHFROM   SavePromptStuff1         # For cloning - make globals
PRECONNECT   * SavePromptStuff2         # For cloning - save globals locally
ONDISCONNECT * RemoveMyInfo             # Destructor
#ONRESIZE     RedrawPrompt              # Resize makes troubles
########################################################################
Script_Redefine SavePromptStuff1
   SECRET

   SHAREMODE SESSION

   # When a session is cloned, save this from the CURRENT session into
   # package GLOBAL variables. Called whenever user switches away from
   # the current session. HOSTNAME and USER are used by cloning automatically.
   # This is called every time user leaves a session (ONSWITCHFROM)
   # Save per session, the IVT_CLONE_OF references the session-id.
   # When AutoPrompt is not in use, MyP is an empty (session) hash
   LastClone{MySessId()}{'DIR'}  = GetValue($MyP{'DIR'});
   LastClone{MySessId()}{'VIEW'} = GetValue($MyP{'VIEW'});
END
########################################################################
Script_Redefine SavePromptStuff2
   # This is a PRECONNECT script that runs immediately when the session
   # is started. It saves the global values in case of a clone. Save these
   # to local session variables because the SetPS1 can be called multiple
   # times and the clone must be done only once, so we need to clear
   # these local copies.

   # Do nothing if the current session is not a clone.
   IF TypeOf(IVT_CLONE_OF) == "UNKNOWN" THEN RETURN
   MyLast{'DIR'}   = $LastClone{$IVT_CLONE_OF}{'DIR'}   # Last directory seen
   MyLast{'VIEW'}  = $LastClone{$IVT_CLONE_OF}{'VIEW'}  # Last ClearCase view
END
########################################################################
Script_Redefine RemoveMyInfo
   SECRET
   # This is an ONDISCONNECT script.
   # Every session that gets switched away from adds data to LastClone Hash.
   # Remove that when the session dies.
   DelHash($LastClone{MySessId()});
END
########################################################################
Script_Redefine UseDefaults (Reset)

   IF $Reset != 1 THEN {
      # Only do this once, except when explicit reset to default
      IF GetValue($Cfg{'RUNONCE'}) == 1 THEN RETURN;
   }

   Cfg{'RUNONCE'} = 1;

   # This is what I like as defaults. Set all these as global vars.
   Cfg{'USE'} = 0;                      # System OFF by default
   Cfg{'SET'} = 1;                      # Type PS1 on command line
   Cfg{'PS1'} = 0;                      # Leave original prompt
   Cfg{'ROT'} = 1;                      # Do not alter ROOT prompt
   Cfg{'NOI'} = 1;                      # Noisy success message
   Cfg{'OVR'} = 0;                      # Overrule other mechanisms
   Cfg{'CLR'} = 1;                      # Root prompt is red
   Cfg{'CMD'} = 1;                      # Bad exit status, red indicator
   Cfg{'TIT'} = "USER@HOST DIR (VIEW)"  # Titlebar shows this
   Cfg{'TAB'} = "USER@HOST (VIEW)"      # Tab shows this
   Cfg{'HST'} = "HOST (DIR)"            # Hostname part of status
   Cfg{'CMN'} = ""                      # Comment unaltered
   Cfg{'SCR'} = "USER@HOST: "           # Screen prompt
   Cfg{'CU1'} = "";                     # Custom vars
   Cfg{'CU2'} = "";
   Cfg{'CL1'} = 1;                      # Clone: Dir
   Cfg{'CL2'} = 1;                      # Clone: ClearCase View
   Cfg{'FXT'} = ""                      # Fixed text to ADD to PS1
   Cfg{'INC'} = ""                      # Include these hosts
   Cfg{'EXL'} = ""                      # Exclude these hosts
   Cfg{'INU'} = ""                      # Include these users
   Cfg{'EXU'} = ""                      # Exclude these users
END
########################################################################
   : (code snipped)
   :
Script LoadValuesFromRegistry
   LOCAL x, v, q;

   RegQueryStr($Hive,$KeyNm,"USE","USE","LOCAL")
   IF TypeOf(USE) == "UNKNOWN" THEN RETURN      # There ARE no values

   # Get values for variables. $Cfg{'TIT'} is read from key 'TIT', etc.
   # Cannot read straight into a hash, use v as intermediate value.
   FORALL (VALUES x KeyNames)
      q = RegQueryStr($Hive,$KeyNm,$x,"v","LOCAL");

      # NOI (noisy login) was added later. Default to 1 when missing
      IF $q != 0 && $x == "NOI" && $v == "" THEN v = "1";
      Cfg{$x} = $v;
   NEXT

   IF $AutoPromptForceMode THEN {       # Mainly for testing.
      Call UseDefaults();
      Cfg{'USE'} = 1;                   # Force to ON
      Cfg{'NOI'} = 1;                   # Noisy mode
      Cfg{'OVR'} = 1;                   # Overrule others
      GSET AUTOPROMPT = "";             # And this is overruled
      AUTOPROMPT = "";                  # Session var, too
   }
END
########################################################################
Script_Redefine AutoPromptConfig
   LOCAL x, Ok, Apply;
   LOCAL UseStart, SaveValues;

   # This is an exported script, visible in the menu and this gets a
   # place in the 'Scripts' menu bar of IVT.
   DESCR "Configure Unix PS1 prompt"

   SHAREMODE NONE

   # When this dialog was used before on this session, keep the
   # current set of values. User might save them now...
   IF (GetValue("LoadMode") != "noload") THEN {
      Call UseDefaults();               # Start with this
      Call LoadValuesFromRegistry();    # Overrule with this
   }

   UseStart = $Cfg{'USE'};              # Current on/off status

   # Create the configuration dialog.
   DIALOG Acfg DESTROY
   DIALOG Acfg
   DIALOG Acfg TITLE "Configure AutoPrompt system"
   CALL UpdateConfigDialog(1)           # Create initial

   # Add OK/CANCEL buttons.
   DIALOG Acfg LINE
   DIALOG Acfg GROUPSTART
   DIALOG Acfg BUTTON OK " Save "
   DIALOG Acfg ROOM "    "
   DIALOG Acfg BUTTON DFLT "Restore defaults"
   DIALOG Acfg ROOM "    "
   DIALOG Acfg BUTTON CANCEL "Cancel"
   DIALOG Acfg ROOM "    "
   DIALOG Acfg BUTTON APPLY "Apply"
   DIALOG Acfg ROOM "    "
   DIALOG Acfg BUTTON SHHELP "Help"
   DIALOG Acfg GROUPEND NEWLINE CENTER

   # When this is NOT a session, there is nothing to APPLY to.
   # This assumes that the AutoLogin is in use....
   IF $IvtWaitLoggedInReady != 1 THEN DIALOG Acfg DISABLE APPLY

   # Point to manual page for this script.
   DIALOG Acfg HELP Acfg "Ex-AutoPrompt"
   DIALOG Acfg SHOW

   # By adding these events, the dialog will be greyed out when disabled and
   # available when USE is true. The fake event does NOT change the option
   # value, just makes the event loop THINK it was clicked.
   DialogAddEvent("Acfg","CLICK",0,0,"PS1");
   DialogAddEvent("Acfg","CLICK",0,0,"USE");

   Ok = Apply = SaveValues = 0;
   WHILE (1)
      Ev = DialogEvent("DIALOG","ITEM","KEY1","KEY2")
      IF $Ev == "ERROR"   THEN BREAK
      IF $Ev == "NOTHING" THEN CONTINUE

      # Quit when the MASTER dialog does an END
      IF $Ev == "END" && $DIALOG == "Acfg" THEN BREAK

      # Automagically jump to event handler when defined.
      GOTO_OPT "${Ev}_${ITEM}"
      CONTINUE

LABEL CLICK_USE
      Mode = DialogQuery($DIALOG,'USE') ? 'ENABLE' : 'DISABLE'

      # Enable/disable all, except USE itself.
      FORALL (VALUES x KeyNames)
         IF $x != 'USE' THEN DIALOG Acfg $Mode $x
      NEXT
      DIALOG Acfg $Mode 'CLN'
      CONTINUE

LABEL CLICK_PS1
      # The Screen prompt cannot be set when PS1 is the original.
      Mode = DialogQuery($DIALOG,'PS1') ? 'DISABLE' : 'ENABLE'
      DIALOG Acfg $Mode "SCR"
      CONTINUE

LABEL CLICK_DFLT                        # Restore defaults
      CALL UseDefaults(1)
      CALL UpdateConfigDialog(0)        # Update dialog
      DialogAddEvent('Acfg','CLICK',0,0,'USE');
      CONTINUE

LABEL CLICK_CANCEL
      BREAK                     # Ignore any changes

LABEL CLICK_APPLY
      Ok = 1;
      Apply = 1;
      CONTINUE

LABEL CLICK_SHHELP
      HELP 'Ex-AutoPrompt'
      CONTINUE

LABEL CLICK_OK
      Ok = 1;                   # Store and use current values.
      Apply = 1;
      SaveValues = 1;
   NEXT

   IF $Ok != 1 THEN DIALOG Acfg DESTROY : RETURN

   # Retrieve settings annd optionally store values in registry.
   IF ($SaveValues) THEN \
      RegCreateKey($Hive,$KeyNm);

   FORALL (VALUES x KeyNames)
      # Query field TAB from dialog and store in regkey TAB, etc.
      DialogQuery($DIALOG,$x,'val');
      IF $SaveValues THEN \
         RegSetValueStr($Hive,$KeyNm,$x,$val)

      # Can be unsaved
      Cfg{$x} = $val;
   NEXT

   DIALOG Acfg DESTROY

   IF ($Apply) THEN {
      # Set a session, package private variable.
      LoadMode = $SaveValues ? '' : 'noload';

      IF (!$Cfg{'USE'}) THEN {
         # Kill any running threads
         IF $MonitorStatePid != "" THEN KILL $MonitorStatePid 1;

         # When going from ON to OFF, restore a simple prompt or
         # the killing of the thread will cause garbage display.
         IF $PromptModePid != "" THEN {
            KILL $PromptModePid 1;
            SEND "PS1='\$ '\r";
         }
      }

      Thread PromptDecode($Cfg{'USE'},$LoadMode)        # Decode prompt
      Thread MonitorState($LoadMode)
      CALL AutoPromptSetPrompt(0,$Cfg{'USE'},$LoadMode)

      # If the Highlight package is installed, this function is defined.
      # Call it, it will redefine the HIGHLIGHT patterns and allow extra
      # functionality when AutoPrompt was just turned ON, and turn the extras
      # off when AutoPrompt was just disabled.
      IF (Defined('HighlightDefineDynamics') && \
          $UseStart != $Cfg{'USE'}) THEN {
         Call HighlightDefineDynamics()
      }
   }
END
########################################################################
# The ForcePrompt is usable in a KEYMACRO to overrule setting the prompt
# for a session, even if the configuration settings prevent that.
########################################################################
Script_Redefine AutoPromptSetPrompt (IsSudo, ForcePrompt, LoadMode)
   LOCAL rc;
   LOCAL x, h, b, v;
   LOCAL LoginTexts;

   # Explicitly callable from outside. Can be used after a SuDo or some
   # other sub-shelling to restore the prompt.
   DESCR "Set PS1 to configured prompt"
   SHAREMODE SESSION

   # Turn keyboard off NOW to catch type-ahead. Note that if typing
   # is required to log in, that the PWDLEARN system will handle that.
   KEYBOARD 'OFF'

   # Monitor texts during login process.
   CAPTURE LoginTexts;

   Call IvtPwdDebug("Wait for SetUnixEnv to end");
   # Note that if this SetUnixEnv script is not part of the current
   # configuration, that the WAIT immediately returns.
   # If we do not wait for it to finish, the order may be wrong and part
   # of the data may not be echoed; the Call WaitPrompt in there is
   # also waiting assigns to the variable HERE, so wait right early.
   Wait_OnConnect('SetUnixEnv');        # Wait for SetUnixEnv to finish
   Call IvtPwdDebug("SetUnixEnv ended");

   # When difficult login sequences are required: Do not interfere
   IF $SSH_FURTHER_AUTH_REQ == 1 && !$ForcePrompt THEN GOTO Ready

   AutoPromptSetPromptDone = 0;         # Assume it is off
   AutoPromptOnPrompt = 0;              # Initialize for every session

   IF $PROTOCOL == "Dummy" THEN GOTO Ready

   # PROJECT can use "SET AUTOPROMPT=OFF to disable for a session
   # Your own scripts can do this, too.
   IF $AUTOPROMPT == 'OFF' && !$ForcePrompt THEN GOTO Ready

   # When this profile is set, assume non-Unix like hosts
   IF QuerySetting('PROFILE') == 'DEC-VT220' && !$ForcePrompt \
   THEN GOTO Ready

   # Load all config stuff now, system IS in use.
   IF ($LoadMode != 'noload') THEN {
      Call UseDefaults();               # Start with this
      Call LoadValuesFromRegistry();    # Overrule with these options
   }

   IF !$ForcePrompt THEN {
      IF $Cfg{'USE'} == 0     THEN GOTO Ready   # User says "neh"
      IF $Cfg{'SET'} == 'OFF' THEN GOTO Ready   # Leave PS1 to .profile

      # When INCLUDE is used, match. No match, do nothing
      IF $Cfg{'INC'} != "" THEN {
         IF !RegMatch($Cfg{'INC'},$HOSTNAME,'ICASE') THEN GOTO Ready
      }

      # When EXCLUDE is used, match. Match? Do nothing
      IF $Cfg{'EXL'} != "" THEN {
         IF RegMatch($Cfg{'EXL'},$HOSTNAME,'ICASE') THEN GOTO Ready
      }

      # When INCLUDE is used, match. No match, do nothing
      IF $Cfg{'INU'} != "" && $USER != '' THEN {
         IF !RegMatch($Cfg{'INU'},$USER) THEN GOTO Ready
      }

      # When EXCLUDE is used, match. Match? Do nothing
      IF $Cfg{'EXU'} != "" && $USER != '' THEN {
         IF RegMatch($Cfg{'EXL'},$USER) THEN GOTO Ready
      }

      # If the root prompt must be unaltered, quit when user IS root.
      IF ($Cfg{'ROT'} && $USER == 'root') THEN GOTO Ready
   }

   # AutoPrompt system is configured "ON". Wait for login to succeed
   # and set PS1 when the prompt appears. The PS1 prompt will contain
   # clever codes to tell IVT about the remote session properties.
   # Don't do this on simple machines.
   Call IvtPwdDebug("Wait for login to finish");
   rc = Call IvtWaitLoggedIn()
   CAPTURE off LoginTexts;
   Call IvtPwdDebug("Login finished, status $rc");

   # When login failed, or target is a "BusyBox", back off.
   # Do NOT interfere with complex authentication procedures.
   # User can overrule this by forcing (from A"pply" button)
   # in the configuration dialog.
   IF (($rc == 0                                        || \
        StrStr('busybox',Lower($LoginTexts)) >= 0       || \
        $SSH_FURTHER_AUTH_REQ == 1                         \
       ) && !$ForcePrompt)                                 \
   THEN GOTO Ready

   # Set a PUBLIC SESSION variable, so stuff on the outside can test
   # whether the autoprompt system is in charge of PS1.
   AutoPromptSetPromptDone = 1; 

   # This setting of PS1 is NOT something the average user wants to see
   # on-screen.
   IF $IvtPwdDebug != 1 THEN DISPLAY 'OFF'
   TIMEOUT 10000 Trubbles               # More than 10 secs? Not Good
   AutoKSH = 0                          # (re)enable this

   Call IvtPwdDebug("Program PS1 prompt");

   # Assign PS1. Start with space, sometimes suppresses history, and
   # this is ALSO not something to store in user history.

   SEND " PS1=\""

   # Use printf, only way I know to reliably get funny chars in PS1...
   # \\032 is an SUB (not used for much else, I hope).
   SEND "`printf '\\032x";              # Magic lead-in
   SEND "DIR=\\\$PWD%%"                 # Current directory
   SEND "VIEW=\\\$CLEARCASE_ROOT%%"     # Current clearcase view
   SEND "USER=\\\$LOGNAME%%";           # Current user

   if ($Cfg{'CMD'}) THEN {              # Want red on fail?
      SEND "CMDEX=\\\$?%%";             # Last exit status
   }

   # Publish up to 2 custom shell variables
   IF TRIM($Cfg{'CU1'}) != "" THEN \
      SEND Concat("CU1=\\\$",TRIM($Cfg{'CU1'}),"%%")

   IF TRIM($Cfg{'CU2'}) != "" THEN \
      SEND Concat("CU2=\\\$",TRIM($Cfg{'CU2'}),"%%")

   # By embedding a \n in the prompt, the shell thinks the prompt is
   # fairly short and does not repeat parts of it when you type a long
   # command (because it thinks it is near the edge of the screen).
   # The Newline gets eaten by the prompt scanner.
   SEND "\\032y\\n"                             # Magic Lead out

   # Make the prompt 'real'. A previous version of this script would
   # intercept the escape sequence and use ECHO to display the prompt,
   # but then Unix thinks the prompt is really short and
   # when doing line-editing and history searching, the cursor is
   # positioned wrongly.
   IF !$Cfg{'PS1'} THEN {
      h = $HOSTNAME_ONLY;
      if ($h == "SecretServer" && \
          strstr("SecretServer",$IVT_URL_STARTUP) > 0) THEN {
         h = $HOSTNAME;
      }
      x = $Cfg{'SCR'};                              # Prompt as configured
      x = Replace($x,'USER',"\\\$LOGNAME");         # HOSTS user (for SU)
      x = Replace($x,'VIEW',"\\\$CLEARCASE_ROOT");  # HOSTS idea of VIEW.
      x = Replace($x,'DIR',"\\\$PWD");              # HOSTS ideas of dir.
      x = Replace($x,'HOST',"$h");                  # IVT's idea of host!
      x = Concat($x,$Cfg{'FXT'});                   # Append free text (if any)

      # If stuff is misconfigured we can end up with an empty prompt
      # Provide default.
      IF $x == "" THEN x = '$ '
      y = '';
   } ELSE {
      x = $Cfg{'FXT'};          # Can ADD this to prompt
      y = "\n";
   }

   IF $x != "" THEN SEND "$x";  # The new prompt
   SEND "'`"                    # End of printf, end of ` string
   SEND "$y\""                  # End PS1=""

   # Original PS1 should be LAST to make line-editing work properly
   IF $Cfg{'PS1'} THEN SEND "\$PS1"

   SEND ";export PS1;"          # Not all systems export PS1 by default

   IF $IsSudo && GetValue($MyP{'VIEW'}) != "" \
   THEN SEND Concat("CLEARCASE_ROOT=",$MyP{'VIEW'},"; export CLEARCASE_ROOT;")

   SEND "echo '##''#'\r" # End of command
   WAIT "###"            # Wait for RESULT of echo (TIMEOUT catches trubbles)

   TIMEOUT 0
   Call IvtPwdDebug("Program PS1 finished");

   # Restore normality
   IF $IvtPwdDebug != 1 THEN DISPLAY 'ON'

   # Use VTECHO to make sure line-wrapping is OK or highlight may not work.
   # Is optional for people that KNOW how it works and dislike the noise
   IF $Cfg{'NOI'} THEN {
      VTECHO Concat(Nls('DIDSET', \
               "IVT AutoPrompt: Configured session prompt successfully"), \
               "\r")
   }

   # Do not override TIT, TAB etc when user manually alters them
   FORALL (VALUES x Settables)
      DidSet{$x} = "";
   NEXT

   # Not a clone? Then done. When clone, set view and dir when requested.
   # Only do this once. When nothing is cloned, we're done.
   IF TypeOf(IVT_CLONE_OF) == "UNKNOWN" || \
      ($Cfg{'CL1'} == 0 && $Cfg{'CL2'} == 0) \
   THEN GOTO Ready

   # When cloning of clearcase view is requested, do now.
   IF $MyLast{'VIEW'} != "" && $Cfg{'CL2'} THEN {
      SEND Concat('cleartool setview ',                 \
             Replace($MyLast{'VIEW'},'/view/',''),      \
             "\r")
      CALL WaitPrompt();
   }

   # When cloning of current dir is requested, do now.
   IF $MyLast{'DIR'} != "" && $Cfg{'CL1'} THEN {
      # Send dir in single quotes to deal with spaces & specials.
      SEND Concat("cd '",$MyLast{'DIR'},"'\r")
      Call WaitPrompt();
   }

   # Only do this ONCE, when the clone is started
   DelHash(MyLast);
   GOTO Ready

LABEL Trubbles
   Call IvtPwdDebug("Problems: Setting PS1 times out");
   ECHO Nls("FAIL", Concat( \
     "\n~2IVT AutoPrompt: Cannot set prompt on this system?\n",         \
     "~2Perhaps your line-kill or erase character is odd? See 'stty -a'\n",\
     "~2A % or @ sign will confuse this script - so sorry!\n",          \
     "Use 'Menubar->Scripts->Configure Unix prompt' to turn this off\n"));

   IF $IvtPwdDebug != 1 THEN DISPLAY 'ON'

LABEL Ready
   Call IvtPwdDebug("Ready");
   KEYBOARD 'ON'
END
########################################################################
Script_Redefine MonitorState (LoadMode)
   SECRET

   # This script makes sure that AutoPromptOnPrompt has the proper value.
   # When a prompt is recognized, it is set to TRUE, when user hits ENTER,
   # it is set to FALSE.]

   # Only one of these threads per session
   SHAREMODE SESSION

   IF $AUTOPROMPT == 'OFF' THEN RETURN  # Per-session off

   IF $PROTOCOL == "Dummy" THEN RETURN

   IF ($LoadMode != 'noload') THEN {
      Call UseDefaults();               # Start with this
      Call LoadValuesFromRegistry();    # Overrule with this
   }

   IF $Cfg{'USE'} == 0 THEN RETURN      # User says "neh"

   MonitorStatePid = $PID;
   TRAP 1 Die

   ONKEY HasKey
   FOREVER
      PAUSE

LABEL HasKey
      ONKEY PASSKEY
      # When a command like "env" is typed, the PS1 string is printed
      # and recognized by this script. Since it contains the UNEXPANDED
      # directory and so on, the 'exec ksh' is triggered. Prevent this
      # by disabling the AutoKSH setting as soon as the user starts
      # typing.
      AutoKSH = 1;
      CanResize = 0;            # Session var, user is typing

      # When user hits enter, some command is running
      # A plain ENTER will immediately redisplay the prompt, that's ok.
      IF $ONKEYN1 == 13 THEN AutoPromptOnPrompt = 0
   NEXT

LABEL Die
   # When thread needs to die, a KILL will take me here
END
########################################################################
Script_Redefine RedrawPrompt
   SECRET
   LOCAL Now

   # When a resize gets done, some systems get confused when the
   # prompt is long. Force redraw of prompt when ON a prompt.
   # Prevent nasty loops.
   IF $AUTOPROMPT == 'OFF' THEN RETURN
   IF TypeOf(CanResize) == 'UNKNOWN' THEN RETURN
   IF !$CanResize THEN RETURN

   # Note: LastResizeTime becomes a package-session var, automatically.
   Now = TIME();
   IF $LastResizeTime != '' && $LastResizeTime + 1 >= $Now THEN RETURN
   LastResizeTime = $Now
   SEND "\r"
END
########################################################################
Script_Redefine SetOpts ()
   LOCAL PrevVal, Val, Opt, i, n, Lab, StripView, x;
   LOCAL Target, New, q;

   SECRET       # No 'S' for script in status

   # Remove /view/ and .BLAH from viewname (shorter)
   StripView = Replace(GetValue($MyP{'VIEW'}),'/view/',"")
   IF ((x = StrStr(".",$StripView)) > 0) \
   THEN StripView = SubStr($StripView,0,$x)

   # Remove some room-eating prefixes from the view name
   StripView = Replace($StripView,'enha_','');
   StripView = Replace($StripView,'bugf_','');

   FORALL (VALUES Target Settables)     # TIT, TAB, HST, CMN
      Val = $Cfg{$Target};              # USER@HOST: VIEW CUSTOM1

      # If user has configured target as empty, do nothing
      IF $Val == "" THEN CONTINUE

      Val = Replace($Val,'DIR',    GetValue($MyP{'DIR'}));
      Val = Replace($Val,'VIEW',   GetValue($StripView));
      Val = Replace($Val,'HOST',   GetValue($MyP{'HOST'}));
      Val = Replace($Val,'USER',   GetValue($MyP{'USER'}));
      Val = Replace($Val,'DESCR',  GetValue($HOSTLIST_DESCR));
      Val = Replace($Val,'ORG',    GetValue($Org{$Target}));
      Val = Replace($Val,'CUSTOM1',GetValue($MyP{'CU1'}));
      Val = Replace($Val,'CUSTOM2',GetValue($MyP{'CU2'}));

      # Now remove noise
      Val = Replace($Val,'  ',' ');
      Val = Replace($Val,'()','');
      Val = Replace($Val,'[]','');
      Val = Replace($Val,'{}','');
      Val = Replace($Val,'  ',' ');

      # Set the new value
      New{$Target} = Trim($Val);
      GOTO_OPT Opt_$Target
      CONTINUE

LABEL Opt_TIT
      q = QuerySetting('TITLEBAR (text)')
      GOTO CheckuserSetting

LABEL Opt_TAB
      q = GetTabText();
      GOTO CheckuserSetting

LABEL Opt_HST
      q = $IVT_STATUSHOST;
      GOTO CheckuserSetting

LABEL Opt_CMN
      q = $STATUSTXT;
      GOTO CheckuserSetting

LABEL CheckuserSetting
      # If the USER interactively changes an item for this session, leave that
      # intact when the prompt reappears.
      IF !$Cfg{'OVR'} && $DidSet{$Target} != '' && \
         $q != '' && $q != $DidSet{$Target} \
      THEN New{$Target} = ''

      # Only alter title when it is not a "fixed text".
      IF $Target == 'TIT' && $New{'TIT'} != '' && \
         ($Cfg{'OVR'} || QuerySetting('TITLEBAR') != 2) THEN {
         TITLEBAR XTERM_CLEAR;
         TITLEBAR SESSION $New{'TIT'};
         DidSet{'TIT'} = $New{'TIT'};
      }

      # When tabtext is user-specified (CREATE stat), leave it be.
      IF $Target == 'TAB' && $New{'TAB'} != '' && $IVT_SESSION_TABTEXT == '' \
      THEN {
         SetTabText($New{'TAB'});
         DidSet{'TAB'} = $New{'TAB'}
      }

      IF $Target == 'HST' && $New{'HST'} != '' THEN {
         STATUSHOST $New{'HST'}
         DidSet{'HST'} = $New{'HST'}
      }

      # Comment will restore ORG comment when New{CMN} is empty.
      # When using key-broadcast, the session comment is used to indicate
      # the master-typist. Do NOT replace that message!
      IF $Target == 'CMN' && \
         !QueryScript('DoBroadcast','keybroadcast','SESSION') \
      THEN {
         STATUSTXT $New{'CMN'}
         DidSet{'CMN'} = $New{'CMN'}
      }
   NEXT
END
########################################################################
Script_Redefine PromptDecode (ForceMode,LoadMode)
   SECRET
   LOCAL n, i, Opt, MyPrompt;
   LOCAL First, Now, x;

   # Only one of these threads per session
   SHAREMODE SESSION

   IF !$ForceMode && $AutoPromptForceMode THEN ForceMode = 1
   IF (($AUTOPROMPT == 'OFF' && !$ForceMode) || $PROTOCOL == 'Dummy') THEN {
      Call IvtPwdDebug('PromptDecode is off');
      RETURN;
   }

   IF ($LoadMode != 'noload') THEN {
      Call UseDefaults();               # Start with this
      Call LoadValuesFromRegistry();    # Overrule with these options
   }

   IF $Cfg{'USE'} == 0 && !$ForceMode THEN {
      Call IvtPwdDebug(Concat('PromptDecode USE=',$Cfg{'USE'}, \
                              ", Force=$ForceMode"));
      RETURN;
   }

   # Make this stoppable when user disables on the current session
   PromptModePid = $PID;                # Session variable
   TRAP 1 Die

   SECRET
   CANCEL 0                     # F3-reset will not kill this
   First = 1;
   AutoKSH = 0;

   FOREVER
      IF (GetValue($IVT_TUNNEL_ACTIVE) == 1 && \
          defined('IVTWaitForEndOfTunneling')) THEN {
         Call IVTWaitForEndOfTunneling();
         CONTINUE;
      }

      WAIT EAT_MATCH "\1Ax"             # Start of info
      #
      # When the texttransfer module is pumping text, this matching
      # causes a serious slowdown. When DISPLAY OFF is issued, there is
      # no point in analyzing the data, so ignore in that case. Serious
      # speed improvement for text-mode transfers.
      IF QuerySetting('DISPLAY') == 0 THEN CONTINUE

LABEL NoSync
      # Lead in seen, get everyting up to the lead-out in $Myprompt
      # If we see another unexpected lead-in, start again.
      CAPTURE MyPrompt 300 TooMuch
      WAIT EAT_MATCH EAT_NOMATCH "\1Ay" "\1Ax",NoSync

      # And after lead-out we have a newline, which CAN be preceded by
      # a CR (or followed). Take no risks.
      WAIT EAT_MATCH EAT_NOMATCH "\n"

LABEL TooMuch
      CAPTURE OFF MyPrompt
      CanResize = 1;            # On prompt, do redraw on resize
      AutoPromptOnPrompt = 1;   # Testable from outside

      # Do this once
      IF $First == 1 THEN {
         Org{'TIT'} = QuerySetting('TITLEBAR (text)')
         Org{'TAB'} = GetTabText()
         Org{'HST'} = ($IVT_STATUSHOST!=''? $IVT_STATUSHOST:$HOSTNAME)
         Org{'CMN'} = ($STATUSTXT     !=''? $STATUSTXT     :$HOSTLIST_DESCR)
         First = 0
      }

      MyPrompt = Replace($MyPrompt,"\1Ay","")
      MyPrompt = Replace($MyPrompt,"\r",'')
      MyPrompt = Replace($MyPrompt,"\n",'')

      # Prompt PUBLISHES stuff like "DIR=/tmp", USER=john.
      # All parts are separated by % signs.
      n = Split($MyPrompt,'%',"Parts[]","LOCAL",1)
      FOR (i = 0; $i < $n; i = $i + 1)
         # We only want parts that say "Name=Option"
         IF ((x = StrStr('=',$Parts[$i])) < 0) THEN CONTINUE

         Name = SubStr($Parts[$i],0,$x);        # Name of part
         Opt  = Substr($Parts[$i],$x + 1, -1)   # Value of the part

         # Some shells do not expand vars. So instead of a directory, we
         # see "$PWD", literally. Try to exec a decent shell, but only once.
         IF $Name == 'DIR' && $Opt == '$PWD' && $AutoKSH == 0 THEN {
            AutoKSH = 1;

            Call IvtPwdDebug("Shell does not understand \$PWD. Exec ksh");
            # The "exec ksh" undoes some of the work performed by AllSessions.
            # See if we have that and call it again. And KSH may be absent,
            # causing immediate logoff. Too bad...

            # If user did type-ahead, that really messes up this 'exec'.
            # Get to a clean prompt first...
            SEND "\r"
            Call WaitPrompt

            # Then start a new shell.
            SEND "exec ksh\r"
            Call WaitPrompt
            IF (Defined('SetUnixEnv')) THEN Call SetUnixEnv(1)

            # The KSH should see the exported PS1, unless users set PS1
            # explicitly in their .kshrc (which is just plain wrong). Also
            # too bad... Try sending a ENTER to force display of prompt...
            SEND "\r"
         } ELSE {
            # Track in a session wide hash what the bits are.
            MyP{$Name} = $Opt;
         }
      NEXT

      # Then process those bits into the tab, status, comment, title...
      # If prompt does not supply user or host, use what IVT knows already
      # Cocde this such that STRICT VARIABLES does not complain
      IF GetValue($MyP{'HOST'}) == '' THEN MyP{'HOST'} = $HOSTNAME
      IF GetValue($MyP{'USER'}) == '' THEN MyP{'USER'} = $USER

      # Let IVT track the remote user. Note than an assign to $USER
      # will cause automatic update of status and tab when that is
      # configured to display the user.
      IF $USER != GetValue($MyP{'USER'}) THEN USER = $MyP{'USER'}

      # Alter all alterable bits
      Call SetOpts();
      IF MySessID() != FgSessID() THEN {
         # If I am not the foreground session, turn the indicator
         # background green to show the shell is ready, or red when it failed
         if ($Cfg{'CMD'}) THEN {        # Want red on fail?
            x = GetValue($MyP{'CMDEX'}); # The real exit stat
         } else {
            x = 0;                      # No. Fake zero exit stat
         }

         if ($x == "" || $x == 0) THEN {
            IvtFunction('Background indicator Green','WAIT')
         } else {
            IvtFunction('Background indicator Red','WAIT')
         }
      }
   NEXT

LABEL Die
   # A KILL will get me here, and the thread will exit
END
########################################################################
Script AutoPromptEnabled ()
   HIDE
   
   # Return TRUE when the system is enabled. Testable from outside
   # Note: Plugins like this one are loaded before most other include
   # files. For example, HIGHLIGHT.IVT needs to know if this AutoPrompt
   # is enabled (at startup).

   RETURN $Cfg{'USE'} != 0;
END
########################################################################
Script STARTUP

   # Global initialisation. Thanks to "PACKAGE" we do not have to worry
   # about other scripts having a GSET of Hive or KeyNm and so on.
   # These variables are "package global".

   GSET Hive  = 'HKEY_CURRENT_USER';
   GSET KeyNm = "$IVT_INFO{'REGISTRY_BASE'}\\Scripts\\AutoPrompt";

   # Explicit declaration of these globals
   SCOPE GLOBAL ARRAY KeyNames, Settables;
   SCOPE GLOBAL HASH  Cfg, LastClone, MyLast;

   # Declare these for the session.
   SCOPE SESSION HASH DidSet, Org, MyP;

   # This array of names is used for various purposes:
   # - Names of configure dialog items
   # - Names of registry keys
   # - Names of variables that hold the current values.
   # All of this is done indirectly to save lines of repetitive code.
   # This is also a nice example of the flexibility of IVT scripting.
   Push(0,KeyNames,'USE','SET','TIT','TAB','CMD',       \
                   'HST','CMN','SCR','CL1',             \
                   'CL2','FXT','INC','EXL','INU','EXU', \
                   'PS1','ROT','CU1','CU2','NOI', 'OVR');

   # We set TIT (Titlebar), TAB (tab-text), HST (hostname field in status) and
   # CMN (comment field in status).
   Push(0,Settables,'TIT','TAB','HST','CMN');

   Call UseDefaults();                  # Start with this
   Call LoadValuesFromRegistry();       # Overrule with this
END
########################################################################


22.12: Script to hop from one system to another.

This script was developed in a complex environment with many machines on separate networks, not all of which are directly reachable from the PC where IVT runs on. To login to such remote machines, IVT will automatically contact a machine that can be reached, and then use a remote login program there (such as telnet, ssh or rlogin) to hop to another. This will be repeated as many times as necessary, until the destination system is reached.
Every hop is authenticated using the password learning system, and transparent to the user. All this is actually implemented using hooks in the password learning system so the whole hopping process is seen as a single login, so scripts that use IvtWaitLoggedIn will wait until the final destination is reached. The script even deals with hardened systems (a Unix system where extra security measures imply that "root" cannot login directly, but a private account must be used to login first, followed by "sudo" to gain root access).

Like the proxy example, the whole things is directed using the EXTRA feature of the HOSTLIST command, where a string is coded that describes what route must be taken to reach the final destination. For example:


Script STARTUP
  HopSSH = "exec ssh -AY -e none"

  Hop1="10.125.72.206#beerr02    #IvtLogMeIn#$HopSSH 10.125.72.206"
  Hop2="\\\$OrgHOST  #\\\$OrgUSER#IvtLogMeIn#$HopSSH \\\$OrgIP -l \\\$OrgUSER"

  GSET Hops = "HOPS=$Hop1\nHARDENED\n$Hop2\n"
END

HOSTLIST COMMENT "KT TAO LPARS - building Q"
HOSTLIST apwgqu01 root "TAO: Q Ext WAS 1" EXTRA="$Hops" SSH
HOSTLIST apwgqu02 root "TAO: Q Ext WAS 2" EXTRA="$Hops" SSH

Suppose the user creates a session to the "apwgqu01". This machine can only be reached by first SSH-ing to 10.65.81.169, then hop to 10.125.72.206, and then finally to the destination host. The intermediate hops are with a fixed user ID (beerr02). Every hop codes 4 fields, separated by # marks:

These hops are separated by newlines. The single word HARDENED can appear to indicate that the next hop cannot login as "root", but needs the normal user name followed by SUDO. The OrgHOST and OrgUSER are the name of the actual host we are trying to reach and the user that wants to login there.

The actual script that does all the work is shown below. Careful study will reveal how it works. A few major features:

#
# HOPS.IVT: Generic scripts to hop from one machine to another
# Author: Ruurd Beerstra
# Date  : Wed Sep 19 10:30:47 2007
#       : Thu Jan 31 14:17:14 2013
#         Added optional menu, plus English text.
#
#############################################################################
# Check every connection to see if it has a "HOPS=..." in the HOSTLIST_EXTRA
# variable. If so, the connection is indirect.

PRECONNECT * HopsCheck
ONERROR    * HopsCheckError
#############################################################################
Script HopsParseOne
   LOCAL x, i, Part, OneHop, Skip;
   HIDE

   Skip = 1;
   WHILE $Skip == 1
      Skip   = 0;
      IF ((x = StrStr(";",$Hops)) < 0) THEN Hops = "" : RETURN
      OneHop = SubStr($Hops,0,$x);              # Up until ";"
      Hops   = SubStr($Hops,$x + 1,-1);         # Strip off 1st part
   NEXT

   # Reset these, inherit host/user from previous entry
   HOP_SCRIPT = HOP_EXEC = ""   

   For (i = 0; $i < 4; i++)
      x = StrStr("#",$OneHop)
      Part   = Expand(Replace(Substr($OneHop,0,$x),"\t",""));
      Part   = trim($Part)
      OneHop = SubStr($OneHop,$x + 1,-1);

      IF $Part == "" THEN CONTINUE

      IF $i == 0 THEN HOSTNAME   = $Part
      IF $i == 1 THEN USER       = $Part
      IF $i == 2 THEN HOP_SCRIPT = $Part
      IF $i == 3 THEN HOP_EXEC   = $Part
   NEXT
END
#############################################################################
Script HopsWatcher
   HIDE

   FOREVER
      TIMEOUT 20000 Trubbles

      TRAP 1 Ready
      TRAP 2 Trubbles
      TRAP 3 IsOk

      PAUSE

LABEL IsOk
      TIMEOUT 0
   NEXT

LABEL Ready
   TIMEOUT 0
   IF $HopsConnOk == 1 THEN RETURN
   GOTO Trubbles2

LABEL Trubbles
   echo " ~3HOP-TIMEOUT "

LABEL Trubbles2
   TIMEOUT 0
   CAPTURE OFF HopsCapture
   DISPLAY ON
   VTECHO "$HopsCapture"                # Contains ESC sequences...
   WAITIDLE                             # Wait on VTECHO to end
   POPUP "Problems hopping between systems.\nHop: $HOSTNAME, user $USER\n"
END
#############################################################################
Script HopsAfterFirst
   LOCAL Line, AuthSock, Xdisp, NotFirst, Watcher, x;
   HIDE

   NotFirst = 0

   # This script is called as part of the first login. The actual login in
   # terms of IvtLogMeIn is STILL UNDER WAY, so IvtWaitLoggedIn will NOT return
   # until ALL hops have finished.

   IGNCHILDREN "ON"
   Watcher = -1;
   IF !$HopsShowProgress THEN Watcher = THREAD HopsWatcher
   LPSET HOPS_ABORT = 0;

   WHILE $Hops != "" || $NotFirst == 0
      DoSuDo = 0;
      IF $NotFirst == 1 THEN {
         IF $Watcher > 0 THEN KILL $Watcher 3
         Call HopsParseOne()
         ECHO "IVT is routing this connection through $HOSTNAME (user $USER)\n"
      }

      NotFirst = 1;
      IF $HOP_EXEC   != "" THEN Send "$HOP_EXEC\r" : WAIT "\r\n"
      IF $HOP_SCRIPT != "" THEN Call $HOP_SCRIPT()
   NEXT

   CAPTURE OFF HopsCapture
   DISPLAY ON
   SEND "\r"

   # Restore this setting
   IF $OrgSSHAgent == 1 THEN SSH_SHOW_AGENT

   HopsConnOk  = 1
   IF $Watcher > 0 THEN KILL $Watcher 1
   IF $HOPS_ABORT THEN RETURN "FAIL"

   # We have reached the target host. Update variables, since the user
   # is logically connected to OrgHOST.
   HOSTNAME    = $OrgHOST
   USER        = $OrgUSER
   IVT_IP_ADDR = $OrgIP

   IF $HOSTLIST_DESCR != "" && $USER != "" THEN \
      STATUSTXTFIX "$USER@$HOSTLIST_DESCR"

   AUTOLOG DYNAMIC              # Track future changes to $HOSTNAME
   RETURN "OK"
END
#############################################################################
Script HopsCheck
   LOCAL x;
   HIDE

   # Usually off - Do not interfere with errors in that case.
   HopsActiveOnSession = 0;

   # This is a PRECONNECT script that checks if a re-route is required
   # Using weird ports? You're on your own.
   IF $PROTOCOL_SESSION == "SSH"    && $HOSTNAME_PORT != 22 THEN RETURN 0
   IF $PROTOCOL_SESSION == "TELNET" && $HOSTNAME_PORT != 23 THEN RETURN 0

   # Check for "HOPS=" in the HOSTLIST_EXTRA
   IF (x = StrStr("HOPS=",$HOSTLIST_EXTRA)) < 0 THEN RETURN 0

   HopsActiveOnSession = 1;
   AUTOLOG APPLY        # Create log file for TARGET (if required)
   AUTOLOG STATIC       # Do NOT switch log when HOSTNAME alters

   # OK. We need to do one or more hops. Remember where we originally
   # wanted to connect to (target host).
   OrgDESCR = $HOSTLIST_DESCR;
   OrgHOST  = $HOSTNAME;
   OrgUSER  = $USER;
   OrgIP    = ResolveName($HOSTNAME);

   # The first hop is the REAL ivt connection to someplace else. Once
   # we get to the shell prompt of THAT host, work your way through
   # the remaining hops...
   Hops = Substr($HOSTLIST_EXTRA,$x + 5,-1);
   if ((x = StrStr("\n",$Hops)) > 0) THEN \
      Hops = Substr($Hops,0,$x)

   HopsConnOk = 0

   Call HopsParseOne()
   Call PwdAddLoginScript("HopsAfterFirst")     # Call after actual login

   echo "IVT is routing this connection through $HOSTNAME (user $USER)\n"
   OrgSSHAgent = QUERYSETTING("SSH_SHOW_AGENT")
   NO_SSH_SHOW_AGENT

   IF $HopsShowProgress == 0 THEN DISPLAY OFF
   CAPTURE HopsCapture
END
#############################################################################
Script HopsCheckError
   HIDE

   # When no hopping in progress, do not interfere.
   IF $HopsActiveOnSession != 1 THEN RETURN 0

   IF $HopsConnOk == 1 THEN RETURN 0
   ECHO_LIT "$HopsCapture"
   ECHO "\n"
   RETURN 0
END
#############################################################################
Script HopsShowProgress (NoToggle)
   HIDE

   IF $NoToggle == "" THEN GSET HopsShowProgress = !$HopsShowProgress

   RETURN Concat("Show progress of system  hopper (",           \
                  $HopsShowProgress ? "on" : "off", ")"         \
                )
END
#############################################################################
Script Startup
   LOCAL x
   SCOPE GLOBAL VARIABLE HopsShowProgress, HopsAddMenu;

   IF $HopsShowProgress == "" THEN GSET HopsShowProgress = 0
   IF $HopsAddMenu      == "" THEN RETURN

   x = Call HopsShowProgress("NoToggle")

   MENU SELECT $HopsAddMenu
   MENU CALL "$x" "HopsShowProgress"
   MENU SELECT 0
END
#############################################################################


22.13: Script to broadcast what you type to all sessions

This example is extremely useful if you have many similar hosts that you have to maintain (and keep as similar as possible). This script turns the current session into a "master typist". Once turned on, everything you type on the master session is "broadcast" to all other sessions, so the same thing happens on all hosts that IVT has a connection with.
How the connection is established (SSH, Telnet, Kerberos, serial, etc.) is irrelevant. Suppose you want to change your password on 10 hosts (all the same password). You connect to the 10 hosts (using a group, multiple selection from the address book or by any other means). Switch to the first session (anyone will do, but the first is easiest to remember). Then you start the broadc.ivt script (it is part of the "Scripts" menu bar). Type the "passwd" command and change your password. All hosts will "follow the leader".
Do NOT forget to turn the master typist off afterwards! (by choosing the same menu-entry again).

The rules are:

I use this script myself very often. Creating accounts on many hosts at the same time, installing software, making configuration changes, etc, etc, is all very much faster and more flexible using the key broadcast then most other methods.
This is how the script works:


########################################################################
# Script to send keystrokes to ALL active terminals
# Author: R. Beerstra
# Date: September 5, 2003
# Rewrite based on VARIABLE_ASSIGN january 2008.
# Added PACKAGE feature to isolate these functions from the rest
# of IVT.

PACKAGE "keybroadcast"
PUBLIC SCRIPT DoBroadcast;

# When a session starts, it passively waits for work from the master
# typist session. When a session stops, it unregisters.
ONCONNECT    * Worker           # Wait for work
ONDISCONNECT * StopMaster       # Master killed
########################################################################
Script ResetLanguage
   Call IVTRegisterPlugin( \
                CalledBy(0,"FILE"), \
                NLS("MN_1","Key-broadcast on/off"), \
                "Ex-Broadc", "DoBroadcast");
END
########################################################################
ONLANGUAGE ResetLanguage
Script Startup
   Call ResetLanguage()
END
########################################################################
Script Worker
   LOCAL key
   SECRET

   # This thread waits for work from the master typist and copies it unto
   # the session. EVERY session has one of these threads, so the master
   # session itself ALSO gets this work! A single assign to BrdKey wakes
   # all sessions up.

   # Thread must NEVER stop, or the whole things fails due to insufficient
   # number of ACK signals.
   CANCEL 0

   FOREVER
      # Cool: Wake up when this variable is assigned to (by master)
      WAIT VARIABLE_ASSIGN "BrdKey"

      # Ok, we end up here when the Slave assigns BrdKey
      key = $BrdKey                     # Copy to local
      GSET ACK = $ACK + 1;              # Acknowledge

      # If this is the master session itself, do nothing.
      # Only send data when THIS session is part of the same application
      # group as the master typist. Allow for editing the groupcode by
      # using QuerySetting every time.
      IF MYSESSID() != GetValue("ActiveSess") &&                \
         QuerySetting("APPGROUP") == $AppGroup  \
      THEN SEND_KEYB "$key"
   NEXT
END
########################################################################
Script Slave
   SECRET

   # The master session uses ONSEND to trap keystrokes. A fast typist will
   # generate keystrokes faster than all sessions can send them. A simple
   # global key variable will cause keys to be missed. So this thread
   # gets woken up by the master typer, gets a single global key from
   # the queue, wakes up all workers and WAITS for acknowledgements from
   # all sessions. In the meantime, the master thread appends keys to the
   # queue WITHOUT sending signals. That way, a keystroke is NEVER lost.

   TRAP 7 Quit                  # Master goes exit, die in sympathy
   FOREVER
      WAIT VARIABLE_ASSIGN "Queue"

      # Eat the queue empty
      WHILE $Queue != ""
         GSET ACK = 0           # Number that answered

         # This assign wakens up all WAIT VARIABLE_ASSIGN threads.
         GSET BrdKey = SUBSTR($Queue,0,50)

         # Wait until all threads acknowledge processing this part
         # Even sessions in other groups acknowledge, but they do not
         # send the data.
         WHILE $ACK < NRSESSIONS()
            USLEEP 10
         NEXT

         # Now we know for sure this key is done. Take out of queue
         Queue = SUBSTR($Queue,Length($BrdKey),-1)
      NEXT
   NEXT

LABEL Quit
   # The master says to quit
END
########################################################################
Script StopMaster
   # When THIS session is master, free up stuff so someone else can be
   IF GetValue("ActiveSess") == "" THEN RETURN
   IF GetValue("ActiveSess") != MYSESSID() THEN RETURN

   KILL $Workthread 7           # Send QUIT
   STATUSTXT ""                 # Remove temp status text
   UNSET "ActiveSess" "ActivePID" "Workthread"
END
########################################################################
Script DoBroadcast
   LOCAL me one two KeyCounter
   LOCAL ByteCounter SessCounter x

   DESCR "Start/stop this terminal as master typist"

   # When THIS session is master, STOP
   IF GetValue("ActiveSess") == MYSESSID() \
   THEN KILL $ActivePID 7 : RETURN

   # Not when CreateSession is active...
   IF $IVT_CREATE_SESSION == 1 THEN BEEP : RETURN

   # Not when there are fewer than 2 sessions
   IF NRSESSIONS("GROUP") <= 1 THEN BEEP : RETURN
      POPUP NLS("ONLY_1",Concat("You have only one session,\n",         \
                   "so there is nothing to broadcast to.\n\n",          \
                   "Try again when you have more than 1 session.")) :   \
                   RETURN

   # When ANOTHER session is master, complain
   IF $ActiveSess != "" THEN \
      POPUP NLS("OTHERBOSS","Another terminal is already master!") :    \
      RETURN

   one = "CANCEL"               # We want a CANCEL button
   POPUP NLS("ST1",Concat( \
                         "This session will copy ALL keystrokes\n",     \
                         "to all other sessions!\n\n",                  \
                         "Start this script again to make it stop!\n\n")),\
                ColorAttribute("BrightWhite BrightRed"),        \
                NLS("ST2","      Use with CARE!!      "))       \
         "one" "two"    # NAMES of vars, one and two!

   # RETURN or Y: Continue. Else quit.
   IF $one != 13 && (Upper(ToASCII($one)) != "Y") THEN RETURN

   # OK. Become the master typist. Show red. blinking annoying
   # text in statusbar because You Must Not Forget!
   COMMENTIGNORE 0
   STATUSTXT Concat(ColorAttribute("BrightWhite BrightRed"),\
                    NLS("STATMSG","~3 MASTER TYPIST SESSION "))

   GSET ActiveSess = MYSESSID()
   GSET ActivePID    = $PID

   SessCounter = NRSESSIONS("GROUP");
   KeyCounter  = 0;
   ByteCounter = 0;

   # Start a background thread to eat the queue empty
   Workthread = THREAD Slave()

   TRAP 7 Quit                  # Sent when we have to stop
   ONSEND Typing                # All generated data goes there

   FOREVER
      PAUSE
LABEL Typing
      # We end up here when a key is typed on the master session.
      # But also a PASTE, function key, and SEND_KEYB data...
      # Simply append, will wake up the WAIT ASSIGN in the slave...
      GSET AppGroup = QuerySetting("APPGROUP");
      Queue = "${Queue}${ONSEND_DATA}"

      # Gather statistics
      KeyCounter++;
      ByteCounter = $ByteCounter + LENGTH($ONSEND_DATA)
      x = NRSESSIONS("GROUP")
      IF $x > $SessCounter THEN SessCounter = $x

      ONSEND PASS_SEND          # And send to master session
   NEXT

LABEL Quit                      # User stops broadcast
   Call StopMaster
   POPUP NLS("FINISH", \
         Concat("Key broadcaster is now stopped - normality restored!\n\n", \
                "$KeyCounter keystrokes totaling\n",                    \
                "$ByteCounter bytes of data were sent to\n",            \
                "$SessCounter sessions.\n\n"))
END
########################################################################


22.14: Script to process an arbitrary hash

Hashes and arrays are a late addition to IVT (version 25.0, late 2015).
They allow more complex data structures than was possible before.
This example is based on a well-known Perl module called Data::Dumper.
IVT's equivalent is to have a "Dumper" script. It is part of the distribution of IVT, can be found in the "hashes" PACKAGE in the file hashes.ivt.
The script uses the various functions for hashes and arrays and as such it is a very practical example. It can assemble an arbitrary complex hash structure (a hash can contain variables, arrays and other hashes recursively to arbitrary depths) into a simple string, which can be printed or studied or examined as you please.

For example:


   MyHash{1} = "One"
   MyHash{2}{1} = "Two one";
   PUSH(0,MyHash{3},"This", "That", "and", "the", "other")
   x = Call Dumper($MyHash)
   ECHO "$x\n"


This is a multi-dimensional hash that also has an array in it.
The Dumper will Show:


   MyHash = {
       "1" => "One",
       "2" =>
       {
           "1" => "Two one",
       }
       "3" =>
       [
           "This",
           "That",
           "and",
           "the",
           "other",
       ]
   }

Note that it knows the name of the hash (MyHash) and that the parts are printed in sorted order.
The Dumper routine looks like this:


########################################################################
# HASHES: Support routines to do clever stuff with hashes and arrays.
# Author: Ruurd Beerstra
# Date  : Wed Nov 25 18:48:34 2015
#
########################################################################
PACKAGE "hashes";
PUBLIC SCRIPT Dumper;
########################################################################
# Perl-like Dumper: Print all dimensions and values of a hash
########################################################################
Script Dumper (BYREFERENCE Item)
   LOCAL Result

   HIDE         # Not mentioned in "Choose script" dialogs

   # This uses the ~5BYREFERENCE~~ feature to pass the "Result" string to
   # a recursive function, which is modified (appended to) and that
   # is returned to the caller
   Result = Concat(NAMEOF(Item), " = ");
   Call Assemble($Item,0,$Result)
   RETURN $Result
END
########################################################################
Script Indent (Indent,Txt,BYREFERENCE Result)
   # Append "Indent" spaces and Txt to the Result
   IF $Indent > 0 THEN \
      Result = Concat($Result,SPRINTF("%-${Indent}.${Indent}s",""))

   IF $Txt != "" THEN Result = "$Result$Txt"
END
########################################################################
Script Assemble (BYREFERENCE Item, BYVALUE Indent, BYREFERENCE Result)
   LOCAL Tp, k, v
   HIDE         # Do not show in Execute scripts dialog

   Tp = TypeOf($Item);          # SCALAR, HASH, ARRAY...
   GOTO_OPT DUMP_$Tp
   Call Indent($Indent,"$Item is of unknown type $Tp\n",$Result)
   RETURN

LABEL DUMP_SCALAR
   v = Replace($Item, "'", "\\'");
   Result = "$Result'$v'\n"
   RETURN

LABEL DUMP_HASH
   Call Indent($Indent,"{\n", $Result)
   # Get the members of the hash, neatly sorted
   FORALL (KEYS ASCENDING k $Item)
      v = Replace($k,"'","\\'");
      Call Indent($Indent + 4,"'$v' => ",$Result)
      IF TypeOf($Item{$k}) == "SCALAR" THEN {
         v = Replace($Item{$k}, "'", "\\'");
         Result = "$Result'$v',\n";
      } ELSE  {
         Result = "$Result\n"
         Call Assemble($Item{$k},$Indent + 4,$Result);
      }
   NEXT
   Call Indent($Indent,"}\n",$Result);
   RETURN

LABEL DUMP_ARRAY
   Call Indent($Indent,"[\n", $Result)
   FORALL(Values v $Item)
      k = Replace($v, "'", "\\'");
      Call Indent($Indent + 4,"'$k',\n",$Result)
   NEXT
   Call Indent($Indent,"]\n", $Result)
   RETURN
END
########################################################################


22.15: Managing projects

This script provides the PROJECTS feature of IVT, which is sufficiently useful to have earned a place in the standard 'Scripts' menu bar entry.
See the PROJECTS topic for a description of projects and how to use them.

The projects.ivt script is part of the standard distribution of IVT.
The actual (annotated) source of the script can be studied below.

The script is also activated using an INCLUDE statement from the main IVT.RC configuration file. It uses the powerful MENU statement to arrange an entry on the main session menu bar so users can activate projects using a few mouse clicks.

This is the script:


########################################################################
#
# Load project files with maximum flexibility.

# This contains an extendable framework for parsing HOSTLIST_EXTRA data.
# When EXTRA contains "FOO=BAR\n", the function IVT_Handler_FOO will be
# called with argument BAR. When a global variable called PROJECT_HANDLER
# is defined, it is seen as a prefix for the handler function, so when you
# do a "PROJECT_HANDLER=BLAH, and you do the same "FOO=BAR\n", the function
# BLAH_Handler_FOO will be called instead (a function overload).
# You can also do "SOMEWORD\n" in the EXTRA clause, in which case the handler
# will be called with an empty argument.
#
# Actually, the handler is called with 3 arguments:
# 1) The optional part after the "=" up to a space.
# 2) The 2nd word after the first space.
# 3) The entire,  unaltered argument after the '=' for complex cases.
#
# So the handler for FOO will have 3 empty strings for a "FOO\n" type call.
# When you do "FOO="blah   1   2\n", the handler for FOO will have a first
# arg of "blah", a 2nd arg of "1", and a 3rd arg of "blah   1   2";
# Scripts in IVT can have variable arguments, and can be called with fewer or
# more arguments than were used in the definition.
#
# Tue Jan 21 15:32:39 2020: Enhancement: When multiple variables end up
# pointing to the same directories, suppress loading of already-loaded files,
# since it only causes confusion which is easily avoided.
########################################################################
PACKAGE "projects";
PUBLIC SCRIPT ProjectsAdd, DoShell, IVTSimpleSudo;
PUBLIC SCRIPT IVTSimpleSudoW;
PUBLIC SCRIPT IVT_X_Sudo;
PUBLIC SCRIPT IVT_ChDir;
PUBLIC SCRIPT IVTDoSuAfter, IVTDoSuDoAfter, IVTDoSuDoXAfter;

# These handlers can be called from outside, if so desired.
PUBLIC SCRIPT IVT_Handler_MENU;
PUBLIC SCRIPT IVT_Handler_SCRIPT;
PUBLIC SCRIPT IVT_Handler_THREAD;
PUBLIC SCRIPT IVT_Handler_SET;
PUBLIC SCRIPT IVT_Handler_GSET;
PUBLIC SCRIPT IVT_Handler_THEME;
PUBLIC SCRIPT IVT_Handler_DIR;
PUBLIC SCRIPT IVT_Handler_LINUX;
PUBLIC SCRIPT IVT_Handler_TERM;
PUBLIC SCRIPT IVT_Handler_EVAL;
PUBLIC SCRIPT IVT_Handler_AGENTOFF;
PUBLIC SCRIPT IVT_Handler_UTF8;
PUBLIC SCRIPT IVT_Handler_NO_X;
PUBLIC SCRIPT IVT_Handler_ROOT;

PUBLIC GLOBAL PROJECTS_DEBUG;   # Set this to 1 for debug
PUBLIC GLOBAL PROJECTS_CURRENT_DIR, PROJECTS_CURRENT_PROJECT;

Script STARTUP
   # Define a few global hashes.
   SCOPE GLOBAL HASH     ProjNms, ProjArr;
   SCOPE GLOBAL VARIABLE ProjLd;
END
########################################################################
Script PublishCurrentPath (Mode, Dir, Project)
   # If the project wants to include files "in the same directory as me",
   # make that information easily available.
   if ($Mode) THEN {
      GSET PROJECTS_CURRENT_DIR     = $Dir;
      GSET PROJECTS_CURRENT_PROJECT = $Project;
   } else {
      UNSET PROJECTS_CURRENT_DIR;
      UNSET PROJECTS_CURRENT_PROJECT;
   }
END
########################################################################
Script LoadProject(Dir,Project)
   LOCAL x, rc, hs, ky, Cnt;
   HIDE

   FOR (x = 0; $x < $ProjLd; x++)
      IF (lower($ProjArr{$x}{'Ld'}) == lower("$Dir/$Project")) THEN {
         RETURN;        # Already loaded this one.
      }
   NEXT

   # Load the project "$Project" in directory "$Dir"
   IF $PROJECTS_DEBUG THEN ECHO "~1PROJECT~0: Load $Dir/$Project\n"
   Call PublishCurrentPath(1,$Dir,$Project);

   IF Exists(rc = "${Dir}/${Project}.rc") \
   THEN ReadRc($rc,"STARTUP","NO_PACKAGE")      \
   ELSE ECHO "Configuration file $rc for project $Project not found\n"

   # Automatically use a hosts file, prepend to RESOLVE. Use
   # NO_RESOLVE to kill any old list first.
   x = QuerySetting("RESOLVE","GLOBAL")

   IF Exists(hs = "${Dir}/${Project}.hosts") \
   THEN {
      # Use some tricky extra quotes to allow spaces in file names
      x = Concat("\"$hs",($x != "") ? ",$x" : "","\"")

      # And because the \\ are interpreted by RESOLVE, double them
      x = Replace($x,"\\","\\\\");

      NO_RESOLVE
      RESOLVE "$x"
   }

   # SSH Hostkeys are optional. Just add to list.
   IF Exists(ky = "${Dir}/${Project}_hosts.ssh") \
   THEN SSH_HOSTKEYS "$ky"

   # SSH Hostkeys are optional (more logical name)
   IF Exists(ky = "${Dir}/${Project}.ssh") \
   THEN SSH_HOSTKEYS "$ky"

   # Keep track of loaded projects
   IF $ProjLd == "" THEN ProjLd = 0
   ProjArr{ProjLd++}{'Ld'} = "$Dir/$Project"

   Call PublishCurrentPath(0);
END
########################################################################
Script LoadOne (Item)
   LOCAL BsDir, BsProj;

   # Load project with item number $Item from the menu.
   BsDir  = $ProjArr{$PrjItm{$Item}}{'Dr'};     # The directory
   BsProj = $ProjArr{$PrjItm{$Item}}{'Nm'};     # The project name
   Call LoadProject($BsDir,$BsProj)
END
########################################################################
Script FindAll (ProjTot,SetProjects,Pattern)
   LOCAL Nr, Nm, i, x, fd, Title;
   LOCAL Cnt;

   # Find all projects in all configured directories. Do not load them,
   # just store info about them in global hashes.

   FORALL IvtPrjDir "PROJECTSDIR_"
      BsDir = Expand("\${$IvtPrjDir}")
      Cnt   = FINDFILES("MyProjs","LOCAL",$BsDir,$Pattern)
      FOR (i = 0; $i < $Cnt; i++)
         x = $MyProjs{$i}{'NAME'}
         IF Match("*/default.rc",$x) THEN CONTINUE

         Nm = Substr($x,LENGTH($BsDir) + 1,-1); # Drop directory
         Nm = Substr($Nm,0,LENGTH($Nm) - 3);    # Drop .rc extension

         # Create PROJECT_1 - PROJECT_N automagically. Is found by the
         # FORALL loop, so don't use a hash here.
         IF $SetProjects == "EXPORT" THEN {
            PROJECT_$ProjTot = $Nm;
         } else {
            # Get the title (1st line) from every project file
            fd    = OPEN($x,0);
            Title = ReadLn($fd);
            Close($fd);

            # When 1st line is not a TITLE comment, skip.
            IF Substr($Title,0,2) != "# " THEN CONTINUE

            Title = Replace($Title,"\n","");    # Remove "# " and newline
            Title = Substr($Title,2,-1);

            # Store the info for all projects in global hash
            ProjNms{$Nm} = $ProjTot;            # Name to number
            ProjArr{$ProjTot}{'Nm'} = $Nm;              # Number to name
            ProjArr{$ProjTot}{'Tt'} = $Title;   # Title
            ProjArr{$ProjTot}{'Dr'} = $BsDir;   # Base dir
         }

         ProjTot++;                             # Count projects found
      NEXT
   NEXT

   RETURN $ProjTot
END
########################################################################
Script STARTUP
   LOCAL IvtPrj, IvtPrjDir, BsDir, BsProj;
   LOCAL Cnt, x, y, Nr;
   SCOPE LOCAL HASH DeDup;

   # Let projectsdirs default to $IVTDIR/Projects...
   Cnt = 0;
   FORALL IvtPrjDir "PROJECTSDIR_"
      Cnt++;
   NEXT

   # When no projects are set, default to these 2
   IF $Cnt == 0 \
   THEN GSET PROJECTSDIR_1 = "$IVTDIR/Projects"
   
   IF $Cnt == 0 && $ENV_HOMEDRIVE != "" && $ENV_HOMEPATH != "" \
   THEN GSET PROJECTSDIR_2 = "${ENV_HOMEDRIVE}${ENV_HOMEPATH}/IvtProjects"

   # Always load support routines, in all projectsdir given.
   FORALL IvtPrjDir "PROJECTSDIR_"
      BsDir  = Expand("\${$IvtPrjDir}")

      # Prevent duplicates
      IF TypeOf($DeDup{lower($BsDir)}) == "SCALAR" THEN CONTINUE
      DeDup{lower($BsDir)} = 1;

      IF Exists("$BsDir/support.ivt") THEN {
         Call PublishCurrentPath(1,$BsDir,"support.ivt");
         READRC("$BsDir/support.ivt","NO_PACKAGE");
         Call PublishCurrentPath(0);
      }
   NEXT

   # When ALL is set, find and set all projects
   IF TypeOf(PROJECTS_ALL) == "SCALAR" && $PROJECTS_ALL != "" \
   THEN Nr = Call FindAll(0,"EXPORT","*.rc");

   # Start IVT with arguments "PROJECT=name [PROJECT_2=name]", will load
   # the project files automatically. Defaults to project "default"
   Cnt = 0;
   FORALL IvtPrj "PROJECT"
      IF Match("PROJECTSDIR_*", $IvtPrj) == 1 THEN CONTINUE
      IF Match("PROJECTSMATCH*",$IvtPrj) == 1 THEN CONTINUE
      Cnt++;
   NEXT

   # Add all matches with patterns.
   FORALL IvtPrj "PROJECTSMATCH"
      Nr = Call FindAll($Nr,"EXPORT", Expand("\${$IvtPrj}"))
   NEXT

   IF $Cnt == 0 THEN PROJECT_1 = "DEFAULT"  # 0 projects is default config

   # Read all project files that are now named in PROJECT_1 - X
   Cnt = 0;
   FORALL IvtPrj "PROJECT"
      IF Match("PROJECTSDIR_*", $IvtPrj) == 1 THEN CONTINUE
      IF Match("PROJECTSMATCH*",$IvtPrj) == 1 THEN CONTINUE

      FORALL IvtPrjDir "PROJECTSDIR_"
         BsDir  = Expand("\${$IvtPrjDir}")
         BsProj = Expand("\${$IvtPrj}");
         IF Exists("${BsDir}/${BsProj}.rc") THEN {
            Call LoadProject($BsDir,$BsProj)
            Cnt++;
         }
      NEXT
   NEXT

   # When project files are loaded, assume they fill the address book
   # with many items and that users have many sessions.
   #MAN: edit: IF $Cnt > 0 THEN ~5NO_TYPEDHOSTS~TYPEDHOSTS~
   IF $Cnt > 0 THEN NO_TYPEDHOSTS
END
########################################################################
Script ProjectsAdd (LoadName,DoMsg)
   LOCAL IvtprjDir, IvtPrj;
   LOCAL BsDir, ProjTot;
   LOCAL Loaded, Entry, CurItm, LdItm, Cnt, i, x;
   LOCAL DIALOG, ITEM, KEY1, KEY2;

   DESCR "Choose a project to add"

   # Find and store all projects
   ProjTot = Call FindAll(0,"","*.rc");

   # Show a dialog with all projects, allow user to pick one or all.
   # Alternatively, when a name is passed, use that.
   # Name "ALL" loads all remaining projects.
   # DoMsg must be not-empty for error messages.

   IF $LoadName == "" THEN {
      DIALOG PRJ DESTROY
      DIALOG PRJ
      DIALOG PRJ TITLE "Load project files"
      DIALOG PRJ LISTVIEW_NL PRJL "REQHEIGHT=20" "MINWIDTH=60" "COLUMN=60"
      DIALOG PRJ LISTVIEW    PRJL "DOUBLECLICK=L1"
      DIALOG PRJ LINE
      DIALOG PRJ GROUPSTART
      DIALOG PRJ BUTTON L1 "Load project"
      DIALOG PRJ ROOM "  "
      DIALOG PRJ BUTTON LA "Load All"
      DIALOG PRJ ROOM "  "
      DIALOG PRJ BUTTON CN "Cancel"
      DIALOG PRJ GROUPEND CENTER NEWLINE
   }

   # Use global variables to populate the LISTVIEW
   Cnt = 1;
   FOR (i = 0; $i < $ProjTot; i++)
      Entry  = Concat($ProjArr{$i}{'Dr'},"/",$ProjArr{$i}{'Nm'});
      FOR (j = 0; $j < $ProjLd; j++)
         Loaded = $ProjArr{$j}{'Ld'}
         IF LOWER($Entry) == LOWER($Loaded) THEN CONTINUE 2
      NEXT

      PrjItm{Cnt++} = $i;
      IF $LoadName == "" THEN {
         DIALOG PRJ LISTVIEW PRJL $ProjArr{$i}{'Tt'}
      }
   NEXT

   LdItm = $Cnt - 1;
   IF $LoadName == "ALL" && $LdItm == 0 && $DoMsg == "" \
   THEN RETURN

   IF $LdItm == 0 THEN {
      x = NLS("ST1","All defined projects are already loaded")
      GOTO ShowErr
   }

   IF $LoadName == "ALL" THEN GOTO CLICK_LA     # Fake click
   IF $LoadName != ""    THEN GOTO LoadByName
   DIALOG PRJ SHOW

   # Handle the user actions on the dialog.
   WHILE (Ev = DialogEvent("DIALOG","ITEM","KEY1","KEY2")) != "END"
      IF $Ev == "NOTHING" THEN CONTINUE
      IF $Ev == "ERROR"   THEN BREAK
      GOTO_OPT "${Ev}_${ITEM}"
      CONTINUE

LABEL CLICK_L1          # Clicked on "Load project"
      CurItm = DialogQuery("PRJ","PRJL") + 1;
      Call LoadOne($CurItm)
      GOTO Esc

LABEL CLICK_CN          # Clicked "Cancel"
      BREAK
   NEXT

LABEL Esc
   DIALOG PRJ END       # Ready
   DIALOG PRJ DESTROY
   RETURN

LABEL CLICK_LA          # Clicked on "Load all"
   FOR (i = 1; $i <= $LdItm; i++)
      Call LoadOne($i);
   NEXT
   GOTO Esc

LABEL LoadByName
   # Find number of the named project
   IF TypeOf(ProjNms{$Nm}) == "UNKNOWN" THEN GOTO LoadByNameFail

   i = $ProjNms{$Nm}    # Number of the project

   # Determine dir + name of project
   BsDir  = $ProjArr{$i}{'Dr'}
   BsProj = $ProjArr{$i}{'Nm'}

   # Check to see if loaded already
   FOR (j = 0; $j < $ProjLd; j++)
      IF Stricmp("$BsDir/$BsProj",$ProjArr{$j}{'Ld'}) == 0 \
      THEN GOTO LoadByNameLoaded
   NEXT

   # Not loaded already. Load.
   Call LoadProject($BsDir,$BsProj)
   RETURN

LABEL LoadByNameFail
   IF $DoMsg != "" THEN {
      x = NLS("ST2","Project $LoadName not found")
      GOTO ShowErr
   }
   RETURN

LABEL LoadByNameLoaded
   IF $DoMsg != "" \
   THEN x = NLS("ST3","Project $LoadName already loaded") : \
        GOTO ShowErr

   RETURN

LABEL ShowErr
   WINDOW ERR
   WINDOW ERR NOBOX
   WINDOW ERR COLOR "WHITE RED BRIGHT BRIGHT"
   WINDOW ERR TEXT "\n $x \n\n"
   WINDOW ERR SHOW
   WINDOW ERR TIMEOUT 2500
END
########################################################################
########################################################################
########################################################################
# If EXTRA contains SCRIPT=xxx, call xxx before connecting
Script IVT_Handler_SCRIPT (Arg)
   HIDE
   IF !Defined($Arg)  \
   THEN {
      Echo NLS("ST6","~2ERROR~0: Script $Arg is not defined\n")
      RETURN
   }

   Call $Arg
END
########################################################################
# If EXTRA contains THREAD=xxx bevat, start xxx as thread in background
Script IVT_Handler_THREAD (Arg)
   HIDE
   IF !Defined($Arg) \
   THEN {
      Echo NLS("ST6","~2ERROR~0: Script $Arg is not defined\n")
      RETURN
   }

   IGNCHILDREN on
   Thread $Arg
END
########################################################################
Script IVT_Handler_SET (Arg)
   LOCAL Var, Value;
   
   HIDE
   o = strstr("=",$Arg)
   IF $o < 0 THEN {
      ECHO NLS("ST7","~2ERROR: Extra SET $Arg: Invalid syntax\n")
      RETURN
   }

   Var   = substr($Arg,0,$o)            # The variable name
   Value = substr($Arg,$o + 1,-1)       # The value to assign
   LPSET $Var = $Value;                 # Indirect, PUBLIC assign!
END
########################################################################
Script IVT_Handler_GSET (Arg)
   LOCAL Var, Value;
   
   HIDE
   o = strstr("=",$Arg)
   IF $o < 0 THEN {
      ECHO NLS("ST8","~2ERROR: Extra GSET $Arg: Invalid syntax\n")
      RETURN
   }

   Var   = substr($Arg,0,$o)            # The variable name
   Value = substr($Arg,$o + 1,-1)       # The value to assign
   GPSET $Var = $Value;                 # Indirect, PUBLIC assign!
END
########################################################################
Script IVT_Handler_THEME (Arg)
   LOCAL Theme;

   HIDE
   Theme = "THEME_COLOR_$Arg";
   if Defined($Theme) THEN {
      Call $Theme
   } else {
      ECHO NLS("ST12","~2ERROR: Extra THEME=$Arg: Unknown color theme\n")
   }
END
########################################################################
Script IVT_ChDir ()
   # Part of login process, logged in and looking at prompt.
   HIDE
   SEND "cd $IVT_ChDirName\r"
END
########################################################################
Script IVT_Handler_DIR (Arg)
   # Store directory in a (package) session var and arrange for a CD to
   # be sent to the host to that directory after login is OK
   HIDE
   IVT_ChDirName = $Arg
   Call PwdAddLoginScript("IVT_ChDir")
END
########################################################################
Script IVT_Handler_LINUX (Arg)
   HIDE
   if (left(QuerySetting("SSH_TERM","SESSION"),5) != "xterm") THEN {
      ECHO NLS("ST9", \
           "~1IVT:~0 Linux system detected - adjusting codepage to UTF-8\n")
   }
   VOLATILE CODEPAGE "UTF-8"
END
########################################################################
Script IVT_Handler_TERM (Arg)
   # Send the TERM type to the remote system
   HIDE
   VOLATILE SSH_TERM     "$Arg"
   VOLATILE TELNET_TTYPE "$Arg"
END
########################################################################
Script IVT_Handler_EVAL (Arg)
   # Just do whatever is passed as an argument.
   # That is an escape-all method: Any RC command or script command can
   # be passed this way.
   HIDE
   IvtEval($Arg)
END
########################################################################
Script IVT_Handler_AGENTOFF (Arg)
   HIDE
   VOLATILE NO_SSH_SHOW_AGENT
END
########################################################################
Script IVT_Handler_UTF8
   HIDE
   VOLATILE CODEPAGE "UTF-8"
END
########################################################################
Script IVT_Handler_NO_X
   # For machines that will refuse an X-display forwarding.
   # Saves an error message during login.
   HIDE
   VOLATILE NO_FORWARD_X
END
########################################################################
Script IVTDoSuAfter
   HIDE
   Call IVTSimpleSudo("root",$USER,1,"su -");
END
########################################################################
Script IVTDoSuDoAfter
   HIDE
   Call IVTSimpleSudo("root",$USER,1);
END
########################################################################
Script IVTDoSuDoXAfter
   Call IVT_X_Sudo("root",$USER,1);
   HIDe
END
########################################################################
Script IVT_Handler_ROOT (method)

   # When we are not logging in to this host as 'root' no action is
   # needed. But if we WANT to become root, and direct login is denied,
   # we must use a method like "sudo" (and possibly our own password), or
   # "su -" and type the root password. This script automates that.
   HIDE
   IF ($USER != "root") THEN RETURN;

   # Method can be "sudo|sudo|sudoX[,user". The optional user is used to find
   # the password for any prompt that may appear after the su/sudo
   # SudoX preserves the X environment in the root shell.
   IF (split($method, ",", "words[]","LOCAL",1) > 1) THEN {
      USER = $words[1];
   } else {
      USER = $ENV_USERNAME;
   }

   method = $words[0];  # su or sudo
   ECHO "~1Access to root on $HOSTNAME is via $method, redirect via $USER\n"

   # Switch statement, IVT style
   GOTO_OPT HANDLE_$method
   echo "Unsupported ROOT method: $method - ignored\n"
   RETURN

LABEL HANDLE_su
   CALL PwdAddLoginScript("IVTDoSuAfter");
   RETURN

LABEL HANDLE_sudo
   CALL PwdAddLoginScript("IVTDoSuDoAfter");
   RETURN

LABEL HANDLE_sudoX
   CALL PwdAddLoginScript("IVTDoSuDoXAfter");
   RETURN

END
########################################################################
Script DoShell (Cmd)
   # Plain execute of a "http://blah" or "C:\Documents\blah.doc" etc
   HIDE
   SHELLEXECUTE("open",$Cmd,"","","SHOWNORMAL")
END
########################################################################
Script WtEndSudo (WtStr,OrgUser)
   SECRET                       # No "Script active" in de status
   HIDE

   WAIT "END_SUDO_$WtStr"       # Unique string after SUDO ends
   WtEndSudoDone = 1;
   USER = $OrgUser              # Updates tab, status, comment...
END
########################################################################
Script IVTSimpleSudoW (ToUser,PwdUser,DoExec,UseProg)
    HIDE
    # A CALL from a menu item can return a string and that will be
    # the new text of the menu. Sometimes that is just a hindrance,
    # so this W (wrapper) function is a SimpleSudo that returns nought.
    CALL SimpleSudo($ToUser,$PwdUser,$DoExec,$UseProg)
END
########################################################################
Script IVTSimpleSudo (ToUser,PwdUser,DoExec,UseProg)
   LOCAL Prog, x, o, WtStr, OrgUser, Exec, EndCmd;
   HIDE

   # The "sudo" can do exec, so when the user logs out, the whole
   # thing ends. When we sub-shell, we want to notice the END of the
   # subshell so we can update the statusline and the tab.
   # Implemented by a sly WAIT on a unique string by a background thread.

   # The command to use is either explicitly specified or defaults to
   # "sudo su -".
   Prog    = ($UseProg != "") ? $UseProg : "sudo su - $ToUser";
   OrgUser = $USER;             # Current user

   IF $DoExec != ""   \
   THEN Exec = "exec" \
   ELSE {
      Exec = ""
      WtStr = Rand()
      EndCmd = "; echo 'END_''SUDO_'$WtStr"
   }

   WtEndSudoDone = 0;
   IF $DoExec == "" THEN {
      IGNCHILDREN on
      Thread WtEndSudo($WtStr,$OrgUser)
   }

   SEND "${Exec} $Prog $EndCmd\r"

   # The "1" means that LOGIN is already done, just password remains
   # And sudo does not ask for password of "ToUser" but of CURRENT user!
   x = Call IvtLogMeIn($HOSTNAME,$PwdUser,1)
   IF !$x THEN RETURN 0         # FALSE, failure

   # Updates the tab, status, title...
   IF !$WtEndSudoDone THEN USER = $ToUser;

   # If PS1 was set in the ORIGINAL session, THEN do so in the sub-shell
   IF GetValue("AutoPromptSetPromptDone") THEN {
      Call AutoPromptSetPrompt(1)
   }

   RETURN 1                     # Success
END
########################################################################
Script IVT_X_Sudo (ToUser,PwdUser,DoExec,UseProg)
   LOCAL Line, AuthSock, Xdisp, Xauth, x, o;

   DESCR "Do a SUDO, preserve X-DISPLAY and SSH_AUTHSOCK"

   IF $ToUser == "" THEN ToUser = "root"

   # Make sure the SSH_AUTH_SOCK, DISPLAY and XAUTH survive the SUDO...
   # Tricky: some xauth list $DISPLAY translate between localhost and real
   # hostname, some do not.
   # Try to get both the X-cookie and name of the current X-display

   DISPLAY OFF
   ECHO NLS("ST10","Please wait...")
   SEND "echo 'STA''RT';echo S=\$SSH_AUTH_SOCK; echo D=\$DISPLAY;"
   SEND "h=\$(hostname);Ath=\$(xauth list \$DISPLAY);"
   SEND "[ -z \"\$Ath\" ] && Ath=\$(xauth list "
   SEND "\$(echo \$DISPLAY | sed -e \"s=localhost=\$h/unix=\"));"
   SEND "echo A=\$Ath;echo 'EN''DSAUTH'\r"

   # By waiting for START we KNOW what comes after
   # is not the ECHO of our own commands but the OUTPUT of those commands.
   # Similar for ENDSAUTH, that is not the ECHO of the command but OUTPUT
   # That is due to the clever single quotes in the command...
   WAIT "START"
   CAPTURE Line
   WAIT "ENDSAUTH"
   CAPTURE OFF Line

   # Now grab the values of the authentication socket.
   # Line contains the results of the Unix ECHO commands
   AuthSock = SubStr($Line, StrStr("S=",$Line) + 2,-1)
   AuthSock = SubStr($AuthSock,0,StrStr("\n",$AuthSock) - 1)

   # The value of $DISPLAY
   Xdisp    = SubStr($Line, StrStr("D=",$Line) + 2,-1)
   Xdisp    = SubStr($Xdisp,0,StrStr("\n",$Xdisp) - 1)

   # And the value of the X-cookie of $DISPLAY
   Xauth    = SubStr($Line, StrStr("A=",$Line) + 2,-1)
   Xauth    = SubStr($Xauth,0,StrStr("\n",$Xauth) - 1)

   # Now become root.
   x = Call IVTSimpleSudo($ToUser,$PwdUser,$DoExec,$UseProg)
   IF !$x THEN {
      DISPLAY ON
      ECHO "Failure:\n$Line\n";
      SEND "\r";                        # Add new prompt
      RETURN "FAIL"
   }

   # We are root: tell the root-shell the proper values
   IF $AuthSock != "" THEN SEND "export SSH_AUTH_SOCK=$AuthSock;"
   IF $Xdisp    != "" THEN SEND "export DISPLAY=$Xdisp;"
   IF $Xauth    != "" THEN SEND "xauth add $Xauth;"
   SEND "\r"
   Call WaitPrompt(500)

   # When ALL were empty, say nothing
   IF "$AuthSock$Xdisp$Xauth" != "" THEN {
      # Show what survived
      ECHO "IVT Preserved the values of "
      IF $AuthSock != "" THEN ECHO "SSH_AUTH_SOCK ($AuthSock) "
      IF $Xdisp    != "" THEN ECHO "DISPLAY ($Xdisp) "
      ECHO "\n";

      IF $Xdisp != "" && $Xauth == "" \
      THEN ECHO NLS("ST11",Concat( \
                "~2WARNING: DISPLAY was set but the XAUTH data failed\n", \
                "to make it across!\n"))
   } else {
      ECHO "Could not find the values for your X-display...\n";
   }

   DISPLAY ON;          # Restore normality
   SEND "\r";           # Cause a new prompt to appear

   RETURN "OK"
END
########################################################################


22.16: Increasing/decreasing the current font

This example shows the use of a KEYMACRO statement that binds a key to a script that performs some function that is not part of standard IVT.
In X-Windows you can increase the current font size by hitting Ctrl and the plus key on the numeric keypad. Decreasing is accomplished using the Ctrl and minus key. IVT does not have this feature, BUT it can be built using this script that is part of the standard distribution. You can find the source of this in the util.ivt file that is part of the installation.

Basically, it takes the current font description as returned by QuerySetting that looks like:


Lucida Console,Points=9,Charset=1,Weight=100

and substitutes the "Points=" part by increasing or decreasing the number Here is the complete script, taken straight from util.ivt:


#########################################################################
# Map Ctrl + and Ctrl - on numeric keypad to increase/decrease font size
# Some keyboards call the minus key "sub". Others just "minus". Sigh.
KEYMACRO "Num plus-Shift+Ctrl-Alt"  SYNCFUNCTION FontSize 1
KEYMACRO "Num minus-Shift+Ctrl-Alt" SYNCFUNCTION FontSize -1
KEYMACRO "Num SUB-Shift+Ctrl-Alt"   SYNCFUNCTION FontSize -1

Script_Redefine FontSize (diff)
   LOCAL DstPart, n, nm, vl, i, Txt;
   HIDE
   SECRET
   SHAREMODE "SESSION"

   # Split the parts of the font in comma-separated fields
   n = split(QuerySetting("FONT","SESSION"),",","Parts[]","SESSION",0);
   for (i = 0; $i < $n; i++)
      IF (RegMatch('(Points|Height|Width)=(\d+)', \
                    $Parts[$i],'ICASE','Pieces') != 0) THEN {
         # Get the name and the (new) value
         nm = $Pieces{'MATCH'}{1}{'TEXT'};
         vl = $Pieces{'MATCH'}{2}{'TEXT'} + $diff;
         Push(0,DstPart,Concat($nm,'=',$vl));

         # For display of the new value
         IF (Lower($nm) == "points") THEN Txt = "$vl points"
         IF (Lower($nm) == "height") THEN Txt = "$vl high"
      } else {
         # Keep old part.
         Push(0,DstPart,$Parts[$i]);
      }
   NEXT

   # Set the new font.
   FONT Join(',',DstPart);

   WINDOW FNT                   # Show the current size briefly
   WINDOW FNT NOBOX
   WINDOW FNT COLOR "WHITE RED BRIGHT BRIGHT"
   WINDOW FNT TEXT "\n $Txt \n\n"
   WINDOW FNT SHOW
   WINDOW FNT TIMEOUT 2000
END
########################################################################


22.17: ALT-Click on text, start URL

A nice little example of the power of scripting is IVTStartURL.
The standard distribution of IVT contains this in the IVT.RC:


MOUSE_KEY BUTTON1 SHIFT NONE CALL IVTStartURL

That says: When the user clicks the mouse with the SHIFT down, invoke the IVTStartURL script. The script knows the position of the mouse, grabs text from the screen looking for a URL and when it finds it, uses SHELLEXECUTE.
Upshot: Shift-Click on a http://whatever or "www.whatever" or even "SomeName.doc" and your PC will open the link.
This is what IVTStartURL looks like (taken straight from the actual distribution file):


########################################################################
Script_Redefine IVTStartURL
   LOCAL Ln, Sp, Ep;
   HIDE

   # This script is called by MOUSE_KEY, when SHIFT is down and the
   # user clicks in some text. We scan left & right for a space, and
   # remove leading and trailing junk. The result (if any) is passed
   # to shell-execute, which will do whatever is "right" for the type
   # of selected text.
   # NOTE: Actual MOUSE_KEY statement is in main ivt.rc
   # NOTE: This is superseded by ~5HIGHLIGHT~~ and "real" clickable URLs

   Ln = ScreenTxt($MOUSE_ROW,1,$COLS);  # The line the user clicked

   Sp = Ep = $MOUSE_COL;                # Start and end point
   WHILE $Sp > 0 && SubStr($Ln,$Sp,1) != " "
      # Search back for a space
      Sp--;
   NEXT

   WHILE $Ep <= Length($Ln) && SubStr($Ln,$Ep,1) != " "
      # Search FORWARD for a space
      Ep++;
   NEXT

   # Select the basic word
   Ln = Trim(Substr($Ln,$Sp,$Ep - $Sp + 1))

   WHILE Substr($Ln,0,1) == "<" || Substr($Ln,0,1) == "."
      # Remove leading gunk
      Ln = Substr($Ln,1,-1);
   NEXT

   WHILE RightStr($Ln,1) == ">" || RightStr($Ln,1) == "."
      # Remove trailing gunk
      Ln = Substr($Ln,0,Length($Ln) - 1);
   NEXT

   # Should contain at least a dot or a colon, or start with www.
   IF Substr($Ln,0,4) == "www." THEN Ln = Concat("http://",$Ln)
   IF Instr($Ln,":.") < 0 THEN POPUP "$Ln\nIs not a valid URL" : RETURN
   ShellExecute("open",$Ln,"","","SHOWNORMAL");
END


22.18: Script to dial out through modems

This example is complex. This script was used all the time to dial into systems using a Hayes-compatible modem (that was in 1995 or so, these days (2025) such connections are not so common anymore. Still, the script provides:

To get dialing support into the standard start-up IVT use these statements in the main IVT.RC file:


   INCLUDE "$IVTDIR/IVT/DIAL.IVT"
   CREATEGROUP DialMenu
   CREATE COM4,57600,N,8,1 "COM4 - modem" DialMenu

When IVT is invoked with the -A command line option, this will create a session that talks to my modem (an external modem on COM4). The DialMenu is the name of the dialer script. An alternative is the lower-case 'a', which starts a named group, in case you have several CREATEGROUP statements.
Also, make sure you also pass the -S parameter to force the serial protocol:

   IVT -S -aDialMenu

should work reliably.
The whole thing is driven by a phone book, a simple file that is read by the scripts below that specifies the systems you can dial into. Mine looks like:


#************************************************************************
Contents of C:\TOOLS\IVT\PHONE.IVT
#************************************************************************
# The DIALER lines specifies the dialer on this system.
DIALER HAYES

# The PREFIX indicates a number prefix (for example, if you have a home
# PABX, you first have to dial zero to get an outside line.
PREFIX 0,

#Phonenr    Baud  Init      LogIn       Description
#---------  ----  --------  ----------  ------------
079-9999999 9600  Init9600  SNILogin    Serv01 in Zoetermeer (line 1)
020-1234567 9600  InitCMG   CMGLogin    Mail gateway of CMG
026-6666666 14400 NONE      NlNetlogin  NlNet, Arnhem
#************************************************************************

As you can see, this lists the descriptions of the systems I dial into. I can specify a baud rate for the connection; the Init script will be called before dialing out, the LogIn script will be called after the connection is established.

In principle, the dialer supports various types of modems. Each modem requires its own command-language. For now, there is only the hayes dialer.
The support for this dialer is in $IVTDIR/IVT/HAYES.DIA, a dialer for an XYZ modem would be stored in a $IVTDIR/IVT/XYZ.DIA.
Every dialer file should declare one script called <dialer>_dial, in this case HAYES_DIAL or XYZ_DIAL. This will be called automatically.

Below is the contents of the DIAL.IVT file:


#************************************************************************
Contents of C:\TOOLS\IVT\DIAL.IVT
#************************************************************************
# All supported dialers have their own file (name.dia). It should
# have a SCRIPT called NAME_DIAL, and accept a single parameter
# specifying the phonebook entry to dial.
# Example: hayes.dia must have a hayes_dial script.

INCLUDE "$IVTDIR/IVT/hayes.dia"
#************************************************************************
Script ReadPhoneFile nm
   LOCAL fd line x y i j w;
   LOCAL PhoneCount
   HIDDEN

   IF (fd = OPEN($nm,0)) < 0 THEN \
      POPUP "ReadPhone: $nm: Cannot open, errno=$ERRNO\n" : RETURN -1

   i = 0;
   WHILE (line = READLN($fd)) != ""
      IF $line == "\n" THEN CONTINUE

      # Remove comment lines from phone data
      IF Substr($line,0,1) == "#" THEN CONTINUE

      # Check for special keywords DIALER and PREFIX
      PhoneCount = Split($line," \t\n","PhoneWord","LOCAL",1);
      if $PhoneCount < 1 THEN CONTINUE

      IF $PhoneWord_0 == "DIALER" DialType
      IF $PhoneWord_0 == "PREFIX" THEN PREFIX = $PhoneWord_1 : CONTINUE

      # Fill one array entry with a dial-entry
      PhoneNr$i     = $PhoneWord_0;
      PhoneMode$i   = $PhoneWord_1;
      PhoneInit$i   = $PhoneWord_2;
      PhoneScript$i = $PhoneWord_3;
      x             = $PhoneWord_4;
      For (j = 5; $j < $PhoneCount; j = $j + 1)
         y = Expand("\$PhoneWord_$j");
         x = "$x $$y"
      NEXT
      PhoneDescr$i = $x;

      i = $i + 1
      CONTINUE

LABEL DialType
      w = $PhoneWord_1;
      IF $w == "HAYES" THEN GSET DialType = $w : CONTINUE
      POPUP "Unrecognized DIALER type :$w:"
      RETURN -1
   NEXT

   CLOSE($fd)
   RETURN $i
END

#************************************************************************
Script ReadPhoneBook
   LOCAL nm
   HIDDEN

   # First try to read a phone.ivt file in the IVTDIR
   nm = "$IVTDIR/phone.ivt"
   IF Exists($nm) THEN PhoneMax = CALL ReadPhoneFile($nm) : RETURN

   # When not found, try IVT subdir.
   nm = "$IVTDIR/IVT/phone.ivt"
   IF Exists($nm) THEN PhoneMax = CALL ReadPhoneFile($nm) : RETURN
END
#************************************************************************
Script DialMenu
   LOCAL x1 x2 y1 y2 x y i nm desc Choice Pscript

   DESCR "Phonebook dialer"

   IF $PhoneMax == "" THEN Call ReadPhoneBook

   DIALOG Dial DESTROY
   DIALOG Dial
   DIALOG Dial TITLE "Dial menu"
   DIALOG Dial LISTVIEW_NL BOOK "HEADER=Number\tDescription" \
               "COLUMN=15" "COLUMN=40" "DOUBLECLICK=DIAL"

   FOR (i = 0; $i < $PhoneMax; i = $i + 1)
      nr   = EXPAND("\$PhoneNr$i")
      desc = EXPAND("\$PhoneDescr$i")
      DIALOG Dial LISTVIEW BOOK "$nr\t$desc"
   NEXT

   DIALOG Dial LINE
   DIALOG Dial GROUPSTART
   DIALOG Dial BUTTON DIAL " Dial "
   DIALOG Dial ROOM "   "
   DIALOG Dial BUTTON CANC "Cancel"
   DIALOG Dial GROUPEND CENTER NEWLINE
   DIALOG Dial SHOW

   Choice = -1;
   WHILE (Ev = DialogEvent("DIALOG","ITEM","","")) != "END"
      IF $Ev == "NOTHING" THEN CONTINUE
      IF $Ev == "ERROR"   THEN BREAK
      GOTO_OPT "${Ev}_${ITEM}"
      CONTINUE

LABEL CLICK_DIAL
      Choice = DialogQuery("Dial","BOOK");
      BREAK

LABEL CLICK_CANC
      Choice = -1;
      BREAK;
   NEXT

   DIALOG Dial END
   DIALOG Dial DESTROY
   IF $Choice < 0 THEN RETURN

   IF !DEFINED("${DialType}_INIT") DoDial

   x = CALL "${DialType}_INIT"          # Dialer dependent init
   If $x <= 0 InitFail                  # Init failed

LABEL DoDial
   # Call the dialer routine for the configured type of modem
   CALL "${DialType}_DIAL"($Choice)

   # If there is a script defined,
   pscript = EXPAND("\$PhoneScript$Choice")
   IF $pcript != "NONE" && Defined($pscript) THEN Call $pscript($Choice)
   RETURN $Choice

LABEL InitFail
   nm = EXPAND("\$PhoneNr$Choice")
   Call DialAbort($nm,"Initialisation of $DialType failed")
   RETURN -1
END
#************************************************************************
Script DialAbort Host Reason
   Hidden
   WAITIDLE

   Echo "~2\n\r$Host - Aborted - $Reason\n"
   Echo "~2Please correct the reported problem. "
   Echo "~2Try again using F4-X, DialMenu.\n"
   POPUP "DIAL to $Host ABORTED\nReason: $Reason"
END
#************************************************************************

This whole thing manages the phone book on screen and eventually calls HAYES_DIAL <entry>, where entry is the index in the phone book. The HAYES_DIAL script lives in $IVTDIR/IVT/HAYES.DIA and contains:


#************************************************************************
Contents of C:\TOOLS\IVT\HAYES.DIA
#************************************************************************
# Ivt Dialer for HAYES modems.
#************************************************************************
Script HAYES_INIT               # Check to see if modem exists
   Hidden

   Timeout 1500 NoModem
   Send "AT\r"
   Wait "OK"
   Timeout 0
   RETURN 1                     # Modem exists

LABEL NoModem
   RETURN -1                    # Modem does NOT exist
END
#************************************************************************
Script HAYES_DIAL Choice
   Local AB BdrRat par bits sbts nm desc nr mode init WaitTime
   Local Minutes Seconds x txt

   Hidden
   desc = EXPAND("\$PhoneDescr$Choice")
   init = EXPAND("\$PhoneInit$Choice")
   nr   = EXPAND("\$PhoneNr$Choice")
   mode = EXPAND("\$PhoneMode$Choice")

   BdrRat   = 9600      # Set a bunch of global defaults
   par      = "N"
   bits     = 8
   sbts     = 1
   WaitTime = 30

   Split($mode,",","Settings","LOCAL");
   IF $Settings_0 != "" THEN BdrRat = $Settings_0;
   IF $Settings_1 != "" THEN par    = $Settings_1;
   IF $Settings_2 != "" THEN bits   = $Settings_2;
   IF $Settings_3 != "" THEN sbts   = $Settings_3;

   # Watch it - BAUD must be LAST because of bug in serial drivers!
   DBITS  $bits
   SBITS  $sbts
   PARITY $par
   BAUD   $BdrRat

   Echo "~2Dialing $nr, $desc\n"
   IF Defined($init) THEN Call $init $Choice

LABEL NoInit
   Send "ATDT $PREFIX$nr\r"
   WAIT CASE_INSENSITIVE        \
        "CONNECT"               \
        "BUSY",busy             \
        "VOICE",voice           \
        "NO DIALTONE",notone    \
        "ANSWER",noans          \
        "NO CARRIER",noans      \
        "OK",noans              \
        "DELAYED",Delayed

   RETURN

LABEL busy
   Echo "\r~2$desc is busy - retrying...\n"
   GOTO Retry

LABEL Delayed
   SLEEP 2
   GOTO NoInit

LABEL voice
   AB = "VOICE DETECTED"
   GOTO Abort

LABEL notone
   AB = "No DIALTONE - local problem - please correct"
   GOTO Abort

LABEL noans
   AB = "No answer"
   GOTO Abort

LABEL Retry
   Count = $WaitTime
   OnKey TestAbort

LABEL Retry2
   WHILE $Count > 0
      Minutes = $Count / 60
      Seconds = $Count % 60
      txt = SPRINTF("%02d",$Seconds)
      StatusTxt "Retry in $Minutes:$txt (ESC)"

      Sleep 1
      Count = $Count - 1
   NEXT

   StatusTxt ""
   # Increase waittime, in steps of 30 secs, up to 5 minutes
   IF $WaitTime < 300 THEN WaitTime = $WaitTime + 30
   GOTO NoInit

LABEL TestAbort
   IF $ONKEYN1 != 27 THEN ONKEY PASSKEY : GOTO Retry2

   Echo "Dial aborted.\n"
   Onkey OFF
   StatusTxt ""
   RETURN

LABEL Abort
   Call DialAbort $desc $AB
END
#************************************************************************
Script HAYES_SEND This TmOut
   Hidden

   Send "AT $This\r"
   WAIT "OK"
   Timeout (($Tmout == "") ? 400 : $TmOut) IsDone
   PAUSE

Label IsDone
END
#************************************************************************
Script ToggleDTR
   HIDDEN
   SETDTR OFF                   # Force hangup on connection
   Sleep 2
   SETDTR ON                    # Re-enable DTR

   Timeout 1500 Problem         # Check modem
   SEND "AT\r"
   WAIT "OK"
   Timeout 0                    # It responds
   RETURN                       # GOOD

LABEL Problem
   WINDOW ModemOff
   WINDOW ModemOff TEXT "Trouble with modem.\nTry turning it on/off\n"
   WINDOW ModemOff COLORS "WHITE RED HIGH"
   WINDOW ModemOff SHOW
   Beep
   ONKEY Key

   PAUSE

Label Key
   WINDOW ModemOff KILL
   ONKEY OFF
   RETURN
END
#************************************************************************

Last, but not least, the whole thing gets combined with the other example scripts. Take, for example, the script CMGLogin which was mentioned as the script to be used when dialing in to the CMG host. It is stored in my main IVT.RC file and listed below. The CMG host will only accept a 'Dialback entry', which is a name for a phone number. The response must be 'thuis', which means 'Home' (for the non-Dutch speakers in the audience). The host will disconnect and dial back. So, the script waits for the "NO CARRIER" message, answers the phone when it rings, waits for a "CONNECT" and logs in once more, which will result in a shell prompt on the machine:


Script CMGLogin
   Hidden
   Call IvtLogMeIn("cmg","ruurdb")
   Wait "entry:"
   Send "thuis\r"
   Wait "NO CARRIER"
   Wait "RING"
   Send "ATA\r"
   Wait "CONNECT"
   Call IvtLogMeIn("cmg","ruurdb")
END

Similar things can be done for the other entries. Starting special programs, checking for mail, etc, etc.


22.19: Keyboard watcher that translates what you type

The script below is an example of a 'secret' script that installs a sort of keyboard watcher in IVT for all sessions. When you type a particular sequence to a host, such a script can intercept and modify what you type. In this case, the ESC ESC sequence used in the KSH on HP-UX (which I find very convenient for filename completion) is translated into ESC \ which is insisted upon by AIX and Linux.
The script only does this when both ESC keys are typed within an interval of 750 Ms. Below is the actual script, taken straight from a working file:


########################################################################
########################################################################
# HP-UX uses 'ESC ESC' for filename completion in KSH. Others want
# ESC \, which I find inconvenient. This script monitors the keyboard,
# and when 2 ESC are typed within 750 Ms, it translates the second ESC
# into a backslash.

PACKAGE "escesc"
PUBLIC GLOBAL NO_ESCESC, FORCE_ESCESC;
########################################################################
ONCONNECT * EscEsc
SCRIPT EscEsc
   SECRET                       # No 'S' indicator in status
   LOCAL LoginData, State, Key;

   # Emacs users - do a "GSET NO_ESCESC = 1" in a STARTUP script.
   IF $NO_ESCESC != "" THEN RETURN

   IF $PROTOCOL == "Dummy" THEN RETURN

   # Or force the issue when login gives no clue
   IF $FORCE_ESCESC != "" DoTrans

   # Determine the type of OS (HP, AIX, Linux). Mind Kerberized logins!
   CAPTURE LoginData
   TIMEOUT 10000 EndOfData              # Safeguard
   ONKEY   IsTyping                     # Another safeguard

   FOREVER
      WAIT ANYCHAR
      IF STRSTR("ogin:",$LoginData) > 0 THEN BREAK
      IF Length($LoginData) > 1024      THEN BREAK
   NEXT
   
LABEL EndOfData
   TIMEOUT 0                            # Cancel safeguards
   ONKEY off
   CAPTURE OFF LoginData

   LoginData = LOWER($LoginData)
   IF STRSTR("aix",$LoginData)   DoTrans
   IF STRSTR("linux",$LoginData) DoTrans

   # Others presumably work correctly
   RETURN

LABEL IsTyping
   ONKEY PASSKEY
   GOTO  EndOfData

LABEL DoTrans
   # OK. Translate ALL typed ESC ESC into ESC \ things
   State = 0            # 1 after 1st ESC, 2 after 2nd ESC...
   ONKEY Watch
   CANCEL 0             # Script should survive F3-R or F3-C

   FOREVER
      PAUSE             # Wait until key is typed

LABEL Watch             # Jumped to with ONKEY
      # When dialogs are active, don't interfere!
      IF $ONKEYN1 != 27 || GetValue("IVT_DIALOGS") != "" \
      THEN State = 0 \
      ELSE State++;

      # Create $Key{1} and $Key{2} with timestamps of 1st and 2nd ESC
      Key{$State} = TIME("MILLISECS")

      # Normal chars, or 1st ESC - send to host
      IF $State != 2 THEN ONKEY PASSKEY : CONTINUE

      # Ok, we had TWO escapes in a row. Calc time differential
      State = 0
      IF ($Key{2} - $Key{1}) > 750 THEN ONKEY PASSKEY : CONTINUE

      # A second ESC within 750 Ms - translate into ESC backslash
      # No passkey - key gets eaten!
      SEND_KEYB "\\"    # Pretend \ was typed
   NEXT
END
########################################################################
########################################################################


22.20: Automatically set a proxy for some hosts and not others

The PROXY feature of IVT allows you to use a proxy server to connect to a host that cannot be reached directly.
However, when you configure a proxy, ALL connections established by IVT will use the proxy server, unless you use a PROXY_EXCLUDE to laboriously exclude the servers (or networks) that can be reached directly.
The following example script was developed in an environment with many hosts in different networks, some of which can be reached directly, some of which require a proxy server, some of which require hopping from one host to the next, and some even a combination of a proxy server and hopping.

The basic trick is to describe all hosts you log in to using a HOSTLIST command in an IVT.RC configuration file. The EXTRA option of the HOSTLIST command is used to describe certain characteristics of those hosts.
IVT will ALWAYS set the $HOSTLIST_EXTRA variable when a session is initiated to that host, even when you do not use the address book (which is the main reason to use HOSTLIST). A PRECONNECT statement is used to start a script that runs just prior to the actual connect to the chosen host.

The PRECONNECT script inspects the $HOSTLIST_EXTRA variable to see if it needs to use a proxy server to reach that specific host. If so, it picks the appropriate PROXY settings from that $HOSTLIST_EXTRA variable. So, say you have 2 different proxy servers in your networks, you do:


Script Startup
  GSET PRXY_1 = "PROXY=10.26.1.78:5555@SOCKS-4@NO@NO@\n"
  GSET PRXY_2 = "PROXY=APECOU5:5555@SOCKS-5@YES@NO@10.73.116.216\n"
END
...
HOSTLIST COMMENT "KT OLO LPARS - building Q"
HOSTLIST APECOU2 root "OLO: Q - Ext WAS 1" EXTRA="$PRXY_2" SSH
HOSTLIST APECOU7 root "OLO: Q - Ext WAS 2" EXTRA="$PRXY_2" SSH
HOSTLIST APECOU5 root "OLO: Q - admin"                     SSH

HOSTLIST COMMENT "VIO Migration project"
HOSTLIST aphmcu06  hscroot "TAO: HMC van de VIOS" EXTRA="$PRXY_1"  SSH
HOSTLIST apvio001a padmin  "TAO: VIO server A"    EXTRA="$PRXY_1"  SSH
...
GSET PROXY_NETWORK_1 = "10.65.*      $PRXY_1"
GSET PROXY_NETWORK_1 = "10.131.255.* $PRXY_2"

The APECOU5 is a proxy server, it can be reached directly and so does not have an EXTRA field.
The variable $PRXY_1 and $PRXY_2 describe proxy servers. They contain 5 fields, separated by @ signs, that are:

respectively. These PRXY variables are used in the EXTRA clause, so the appropriate proxy information is copied for every host.
The PROXY_NETWORK variables can be used to specify ranges of addresses that are behind a proxy server. When the user types an IP address that can be resolved locally, IVT will still select the proper proxy settings (even though the HOSTLIST entry is not used when an IP-address is typed).

The following script takes care of the rest:


########################################################################
#
# PROXY.IVT: Parse proxy command in HOSTLIST_EXTRA and apply settings to
#            current session.
#
# Author   : R. Beerstra
# Date     : Mon Oct 15 09:24:15 2007
#
########################################################################
# Check EVERY connection to see if it has a "PROXY=...\n" in the
# HOSTLIST_EXTRA field. If so, set the proxy for this connection.

PRECONNECT * CheckProxy
########################################################################
Script CheckProxy
   LOCAL Nm, x, i, Field, Prx;
   HIDE

   # Only TCP/IP can be proxied...
   IF STRICMP($PROTOCOL,"WINSOCK") != 0 THEN RETURN
   
   # Check for "PROXY=" in the HOSTLIST_EXTRA
   # When not found, check for implicit match through PROXY_NETWORK vars
   IF (x = StrStr("PROXY=",$HOSTLIST_EXTRA)) < 0 \
   THEN GOTO CheckNetworks

   # Delete the PROXY=
   Prx = SubStr($HOSTLIST_EXTRA,$x + 6,-1)

LABEL UsePrx
   # Dump everything after the optional \n
   if (x = StrStr("\n",$Prx)) >= 0 THEN Prx = SubStr($Prx,0,$x)

   # Prx is "PROXYNAME:PORT@TYPE@DNS SETTING@EXCLUDE"
   # That is 4 fields, which we strip from Prx one by one

   #echo "Using Proxy $Prx\n"
   FOR (i = 0; $i < 4 && (x = StrStr("@",$Prx)) >= 0); i++)
      Field = SubStr($Prx,0,$x)         # Part BEFORE @
      Prx   = SubStr($Prx,$x + 1,-1)    # Part AFTER @

      #echo "$i: Field is $Field\n"     # For debug

      # Set a session-local variable for easy test in other scripts.
      # Use VOLATILE to prevent these per-session changes from
      # becoming permanent when the user saves setup.
      IF $i == 0 THEN VOLATILE PROXY_HOSTNAME $Field : ProxyUsedHost = $Field
      IF $i == 1 THEN VOLATILE PROXY_TYPE     $Field
      IF $i == 2 THEN VOLATILE PROXY_DNS      $Field
      IF $i == 3 THEN VOLATILE PROXY_EXCLUDE "$Field"
   NEXT
   RETURN

LABEL CheckNetworks
   # Check if the IP address of the host is mentioned in a PROXY
   # range of addresses
   Prx = CALL ProxyCheckIpAddress($HOSTNAME)
   IF $Prx != "" THEN GOTO UsePrx
END
########################################################################
Script ProxyCheckIpAddress Host
   LOCAL Ip, Nm, x, i, Pattern, Prx;

   HIDE
   # ALLOW GSET variables like: GSET PROXY_NETWORK_1 = "..."
   # to simply specify ranges of IP addresses behind a proxy.
   # The variable should contain a pattern (like 10.138.*) of IP
   # adresses and a PROXY= like string to indicate the proxy settings
   # Do NOT do the ResolveName when there are no PROXY_NETWORK_ vars, since
   # that causes blocking preconnect which is SLOW when name is invalid
   # and complex resolving is configured

   FORALL (VARIABLES Nm LIKE "^PROXY_NETWORK_" FILTER GLOBAL)
      IF $Ip == "" THEN Ip = ResolveName($Host)
      x       = Expand("\$$Nm")
      i       = StrStr(" ",$x)
      Pattern = SubStr($x,0,$i)
      Prx     = SubStr($x,$i + 1,-1)
      IF (x = StrStr("PROXY=",$Prx)) >= 0 THEN Prx = SubStr($Prx,$x + 6,-1)
      IF ($Pattern == $Ip || Match($Pattern,$Ip)) THEN RETURN $Prx
   NEXT

   RETURN ""
END
########################################################################

As with the other examples, the whole thing is activated by simply using an INCLUDE of the proxy.ivt script. There is no harm in having the script active even if you do not use proxy functionality. I most cases, a host will not have a PROXY= setting as part of the HOSTLIST, so the CheckProxy script does nothing.


22.21: Keeping a session alive

Sometimes, the TELNET_KEEPALIVE setting is not sufficient to keep a session from timing out because it does not generate user-level data. This bit of script sends space-backspace every two minutes when no other keyboard activity is seen on the session. It detects a backspace being echoed (on hosts that have DELETE set as the backspace character). In that case, it switches from BACKSPACE to DELETE (or v.v.). Salt to taste.


########################################################################
# Uncomment this or specify specific hosts.
# ONCONNECT * KeepAlive
########################################################################
Script KeepAliveMsg(BYVALUE Txt)
   HIDE
   SECRET
   WINDOW MSG
   WINDOW MSG NOBOX
   WINDOW MSG COLOR "WHITE RED BRIGHT BRIGHT"
   WINDOW MSG TEXT "\n$Txt\n"
   WINDOW MSG ROW -1
   WINDOW MSG COL -1
   WINDOW MSG SHOW
   WINDOW MSG TIMEOUT 2500
END
########################################################################
Script KeepAlive
   SECRET
   LOCAL Bsp

   Bsp = "\08"                  # Start with a backspace
   FOREVER
      TIMEOUT 120000 MakeNoise  # Wait 2 minutes
      ONKEY Again               # Catch all keys
      PAUSE

LABEL Again                     # A key is typed
      TIMEOUT 0                 # Cancel timer
      ONKEY PASSKEY             # Pass key to wherever it was supposed to
      CONTINUE                  # Restart timer

LABEL MakeNoise                 # Keep application alive
      TIMEOUT 8000 GoOn
      SEND " "                  # Space-Backspace
      WAIT ANYCHAR              # First echo
      TIMEOUT 0
      IF $ANYCHAR != " " Warn   # Weirdness
      SEND "$Bsp"
      TIMEOUT 8000 GoOn
      WAIT ANYCHAR              # Either a Bsp or "^H" or "^?"
      TIMEOUT 0
      IF $ANYCHAR != "\08" THEN GOTO Switch
      CONTINUE

LABEL Warn
      CALL KeepAliveMsg("KeepAlive: No echo! Retrying...\n")
      CONTINUE

LABEL Switch
      # Switch between backspace and DELETE
      Bsp = ($Bsp == "\7F") ? "\08" : "\7F"
      SEND "$Bsp$Bsp"           # Correct space + bad erase
      CALL KeepAliveMsg "KeepAlive: Changed erase character\n"
LABEL GoOn
   NEXT
END


22.22: Intercepting 'Shell will timeout'

Some organisations configure their Unix systems to automatically log you off after a certain period of inactivity. When this is only a few minutes, this can be extremely annoying when you have many sessions, some of which may be inactive for longer than the timeout. In such environments, I have seen users that would habitually start some program to prevent the timeout from happening.
That is not very efficient. The IVT script below will intercept the message issued by the shell and respond only then. It also suppresses the message, since that contains a BELL which will cause noise and red status indicators in IVT. The script is a nice example of the adaptability of IVT to certain circumstances:


########################################################################
Script_Redefine ShTimeoutPreventer
   HIDE
   SECRET
   CANCEL 0

   # Some shells say "BEEP:Shell will timeout in 60 seconds" and we do NOT
   # want our sessions to end because of that. Start a simple shell command
   # that prevents the exit.
   # Activate by setting "ONCONNECT * ShTimeoutPreventer"
   FOREVER
      # There is a BEEP at the START of the warning...
      WAIT CASE_INSENSITIVE EAT_MATCH "Shell will time out in "
      WAIT EAT_MATCH EAT_NOMATCH "\n"

      ECHO "Shell wants to timeout at" TIME("DATE",TIME(),"%Y/%m/%d %T")
      ECHO "- IVT to the rescue! - type ENTER to return to the prompt: "
      DISPLAY OFF
      SEND "\03"        # ^C, in case a partial command was typed
      USLEEP 100
      SEND "read aaA; unset aaA\r"

      ONKEY Typing UNIQUE
      FOREVER
         PAUSE
LABEL Typing
         IF $ONKEYS1 == "\r" THEN BREAK
         IF $ONKEYN1 == 4    THEN BREAK # ^D (sometimes you type many)
         IF $ONKEYN1 == 3    THEN BREAK # ^C (Interrupt)
         ONKEY PASSKEY                  # Treat all other keys normally
      NEXT

      ONKEY PASSKEY     # ENTER terminates the READ
      ONKEY off         # Done for now
      DISPLAY ON
      IF $ONKEYN1 == 4 THEN SEND "\04"  # User wanted to log out
   NEXT
END
#########################################################################
########################################################################


22.23: Dropping files on the IVT Window

The ONDROPFILES statement allows you to write a script that gets invoked when the user drags & drops objects on the main IVT window. The most natural thing to do is to send the files to the host, using ZMODEM.

The distribution of IVT comes with a clever bit of scripting that first figures if the host you are dropping files on has ZMODEM software. If so, it will use it and the file transfer will be fast.

When no ZMODEM is available, the IVT script will try to find either Perl or the UUDECODE program. When one of those is found, the script will use that.
It does a quick compress of the file on the windows end, TYPES IN THE RESULT on the session, and uses UUDECODE and GUNZIP to restore the data on the unix end.
The upshot is that under normal circumstances, you can just drop files on the Shell prompt and they will be transferred. It will not be very fast because many hosts do not tolerate a super-fast typist, but it works well for smallish files (think 50 - 100 KB/s). If you want large files and/or high speed, please use the WinSCP integration from the Scripts menu of IVT.

But it can be awesomely convenient to just drop a few quick files on the IVT Window and have them transferred to the current directory on Unix!

This is how the "clever bit of scripting" works:


########################################################################
#
# ONDROP.IVT: Script to send files using ZMODEM when a file (or directory)
# is dropped on the IVT session window.
# Modified Tue Mar 13 10:12:59 2012, allow transfer through either
# rz/sz or perl/uuencode, auto-detected.
#
########################################################################
PACKAGE "ondropfiles"
ONDROPFILES DROPSendFile
########################################################################
Script DROPSendFile
   LOCAL TotTel, TotLen, Bytes, DropIt, Base, FlOpts;
   LOCAL Cnt, i, j, Fl, x;
   LOCAL RestZmode;
   HIDE

   # First see if the user has configured ASCII transfers as default
   Hive   = "HKEY_CURRENT_USER";
   KeyNm  = "$IVT_INFO{'REGISTRY_BASE'}\\Scripts\\FTPUNX"
   RegQueryStr($Hive,$KeyNm,"DropASCII", "FtpDropASCII", "SESSION")
   RegQueryStr($Hive,$KeyNm,"Xyzmodem",  "FtpXyz",      "SESSION");

   IF $FtpXyz == "" THEN FtpXyz = 0;    # Default to false

   # Show a nice progress screen, don't let zmodem startup
   # strings be shown on screen (DISPLAY OFF). Also prevent
   # automatic start of the transfer by RZ (when enabled).
   DISPLAY "off"
   IF $ZMODEM_AUTO == 1 THEN NOZMODEM_AUTO
      NOZMODEM_AUTO
      RestZmode = 1;
   }

   TotTel = 0;
   MaxNmLen = 0;        # A package, session variable
   Bytes = 0;
   FOR (Cnt = 0; $Cnt < $IVT_DROP_COUNT; Cnt++)
      Fl = Expand("\$IVT_DROP_$Cnt")
      IF Length($Fl) > $MaxNmLen THEN MaxNmLen = Length($Fl)
      #MAN: IF !~5IsDir~~($Fl) THEN {
      IF !IsDir($Fl) THEN {
         TotTel++;
         if (stat($Fl,"StatInfo{}","LOCAL") == 0) THEN {
            Bytes = $Bytes + $StatInfo{'SIZE'};
         }
         CONTINUE
      }
      
      IF GetValue("FtpDropASCII") == 1 THEN GOTO NoDirsInASCII
      # Count entries in directory
      j = FindFiles("DirList{}","LOCAL",$Fl,"*","RECURSIVE");
      TotTel = $TotTel + $j;
      FOR (i = 0; $i < $j; i++)
         x = $DirList{$i}{'NAME'}
         Bytes = $Bytes + $DirList{$i}{'SIZE'};
         IF Length($x) > $MaxNmLen THEN MaxNmLen = Length($x)
      NEXT
   NEXT

   Bytes = $Bytes / 1024;
   ECHO NLS("ST1","\n~1IVT ONDROP: $TotTel files to transfer ($Bytes KB)\n")

   FlOpts = "RECURSIVE SHOWDIRECTORIES NOFILES";
   TotTel = 1;
   TotLen = 0;
   Dirs   = 0;
   FOR (Cnt = 0; $Cnt < $IVT_DROP_COUNT; Cnt++)
      Fl = Expand("\$IVT_DROP_$Cnt")
      IF !IsDir($Fl) THEN CONTINUE

      # OK. Fl is a directory. Find all directories.
      # Create empty directory structure remotely.
      Base = Call Basename($Fl);        # Convenience function in util.ivt

      DropIt = SubStr($Fl,0,Length($Fl) - Length($Base))

      IF $Cnt != 0 && $Dirs > 0 THEN SEND ";"
      SEND "mkdir -p '$Base'; "
      Dirs = FindFiles("DirList{}","LOCAL",$Fl,"*",$FlOpts);
      TotLen = 0;
      FOR (i = 0; $i < $Dirs; i++)
         x = Replace($DirList{$i}{'NAME'},"\\","/")
         x = Substr($x,Length($DropIt),-1);
         IF $TotLen == 0 THEN SEND "mkdir -p "
         TotLen = $TotLen + Length($x) + 1;
         IF $TotLen < 1000 THEN {
            SEND "'$x' "
            CONTINUE
         }

         # Long line. Terminate
         SEND "\r"
         Call WaitPrompt(100)
         TotLen = 0;
      NEXT
   NEXT

   IF $TotLen != 0 THEN SEND "\r" : Call WaitPrompt(100)

   FOR (Cnt = 0; $Cnt < $IVT_DROP_COUNT; Cnt++)
      # Get the name of file $Cnt into variable $Fl
      Fl = Expand("\$IVT_DROP_$Cnt")
      IF IsDir($Fl) THEN {
         x = CALL SendADir(0,$Fl,$DropIt,$TotTel)
         IF !$x THEN BREAK
         TotTel = $x
      } ELSE {
         x = Call DROPSendOneFile($TotTel,$Fl)
         IF !$x THEN BREAK
         TotTel++;
      }
   NEXT

LABEL Ready
   IF $RestZmode == 1 THEN ZMODEM_AUTO  # Restore normality

   USLEEP 250
   DISPLAY "on"
   SEND "\n"            # Ends in a new prompt
   RETURN

LABEL NoDirsInASCII
   WINDOW BADDIR KILL
   WINDOW BADDIR
   WINDOW BADDIR NOBOX
   WINDOW BADDIR COLOR "WHITE RED BRIGHT BRIGHT"
   x = NLS("ST2", Concat("\n You have configured ASCII transfers \n", \
                         " which does not support the transfer of \n", \
                         " directories \n\n"))
   # WINDOW statement does not accept complex expressions.
   WINDOW BADDIR TEXT "$x"
   WINDOW BADDIR SHOW
   WINDOW BADDIR TIMEOUT 3000
   RETURN

END
########################################################################
Script SendADir (Depth,DirNm,DropIt,TotTel)
   LOCAL Cnt, RemDir, Fl, i, x;
   HIDE

   RemDir = SubStr($DirNm,Length($DropIt),-1)
   ECHO "Sending directory $RemDir\n"
   SEND "cd '$RemDir';\r"

   Cnt = FindFiles("FileList","LOCAL",$DirNm,"*","SHOWDIRECTORIES")
   FOR (i = 0; $i < $Cnt; i++)
      Fl = Replace($FileList{$i}{'NAME'},"\\","/")
      IF IsDir($Fl) THEN {
         x = CALL SendADir($Depth + 1,$Fl,"$DropIt$RemDir/",$TotTel)
         IF !$x THEN RETURN $x
         TotTel = $x
      } ELSE {
         x  = Call DROPSendOneFile($TotTel,$Fl)
         IF !$x THEN RETURN $x
         TotTel++;
      }
   NEXT

   SEND "cd ..\r"
   RETURN 1
END
########################################################################
Script DROPSendOneFile (Cnt,Fl)
   LOCAL x, SecStart, Secs;
   HIDE

   # When ASCII drop is configured, do so.
   IF GetValue("FtpDropASCII") == 1 THEN {
      DISPLAY ON
      IF Defined("IVTTransferToHost") \
      THEN {
         x = Call IVTTransferToHost($Fl,$Cnt,$MaxNmLen)
         RETURN $x
      }

      # No texttransfer module installed - use raw send function
      x = FILE_SEND("A",$Fl)
      RETURN $x;
   }

   # When user has disabled x/y/z, pretend it is not there
   IF $FtpXyz THEN GOTO norz

   TIMEOUT 2000 norz

   SEND "rz\n"  # Assumes you have RZ on Unix
   WAIT CASE_INSENSITIVE        \
        "modem program"         \
        "waiting to receive"    \
        "not found",norz        \
        "unknown",norz

   TIMEOUT 0
   WAITIDLE
   ECHO "$Cnt: $Fl: "
   SecStart = Time();
   x = FILE_SEND("Z",$Fl)
   Secs = Time() - $SecStart;
   IF $x > 0 && $Secs > 0 \
   THEN Rate = ($x / 1024) / $Secs \
   ELSE Rate = 0
   ECHO "Transferred $x bytes ($Rate KB/s)\n"
   Call WaitPrompt(100)
   RETURN $x >= 0       # Negative on errors

LABEL norz
   TIMEOUT 0

   # Call the texttransfer function when we have it
   IF Defined("IVTTransferToHost") THEN {
      x = Call IVTTransferToHost($Fl,$Cnt,$MaxNmLen)
      RETURN $x
   }

   IF !$FtpXyz THEN {
      ECHO NLS("ST3",Concat( \
            "\n~1ONDROP: This assumes you have 'rz' installed on Unix~0\n", \
            "Unfortunately, that seems to be missing.\n"))
   }

   RETURN 0
END
########################################################################
########################################################################

Note that this script will accept files AND directories. When directories are dropped, the FindFiles function is used to search through the directory structure and uses recursion and various other advanced techniques to reproduce the directory structure remotely.

Also note that the text-transfer module that can be accessed from the SCRIPTS menu bar entry allows you to check an option "Drop file sends ASCII", in which case the dropping of files will result in simply sending the contents of the file(s) on the session, line by line. This can be convenient to transfer text to simple systems that lack decent network connectivity, serial lines and so on.

See also FindFiles and IsDir.


22.24: Extending the escape sequence command set of IVT

Sometimes a host sends some command intended for another type of terminal which is not recognised by IVT and displayed on the screen instead.
In such cases, a bit of clever scripting can be used to either ignore the specific command, or to intercept it and act upon it in an IVT script.
See the IGNORE_ESCAPE for an example of the first.

Teaching IVT to understand a new command is a bit more involved.
Consider the command to set the title bar, recognized by some terminals.

  \9D21;Some text\9C

So the (hexadecimal 9D, 157 decimal), followed by a "2", "1" and semicolon introduces a string that should end up as the windows title bar. The string is terminated by a \9C (156 decimal).
IVT does not know this command, BUT we can teach it to:


ONCONNECT * WindowTitle
Script WindowTitle
   LOCAL Txt, Terminator;
   HIDE
   SECRET
   Terminator = "\9C"
   FOREVER
      WAIT EAT_MATCH "\9D21;"
      CAPTURE Txt 256 TooLong
      WAIT EAT_MATCH EAT_NOMATCH "$Terminator"
      CAPTURE OFF Txt
      TITLEBAR SESSION Substr($Txt,0,length($Txt) - length($Terminator))
LABEL TooLong
   NEXT
END

So, the ONCONNECT says: start this WindowTitle script as a background thread for every session created. If you have 20 sessions in parallel, each of them will have an instance of this script active.

It goes into an infinite loop, waiting for the command lead-in (\9D21;).
The tricky bit is EAT_MATCH: when those 4 characters are being received from the host, they are eaten - discarded by IVT and not displayed on the session screen. By using this EAT_MATCH, the script assumes responsibility for those received bytes (which is exactly what we want to do here).
Of course, all data NOT matched (the normal session data) is left untouched.
The script blocks in the single WAIT statement until the lead-in is received completely.
When a bad lead-in is received (say \9D2X) the EAT_MATCH will realise it has made a mistake - the already eaten \9D and 2 will be regurgitated and treated normally after all.

When the lead-in is received correctly, the first WAIT terminates.
A CAPTURE statement says to catch up to 256 bytes into variable $Txt (a local variable). Anything longer is considered an error.
The WAIT EAT_MATCH EAT_NOMATCH says to eat all data up to the "\9C", the terminator of the command. The actual title text is part of the NOMATCH (it does not match "\9C"), but we do NOT want the title text to be displayed on screen (a DISPLAY OFF  might have been used here, too).
The "\9C" is a match, and that is eaten too, due to the EAT_MATCH.

When the terminator is seen, the capture is turned off. The $Txt variable now contains the title bar text plus the terminator (the byte 9C).
At this point, IVT has intercepted the command. If it did nothing, this would simply cause the command to be ignored (a marked improvement over displaying the command with lead-in, text and terminator on the screen).

However, the script uses the TITLEBAR command to make the string end up where it was supposed to be going. In effect, the command set of IVT is extended.
It has to strip that last 9C byte off, of course, using SUBSTR and LENGTH.

Note that when a terminator is NOT received, the limit set on the CAPTURE will cause a branch to the TooLong label. Nothing happens except that it starts waiting for a properly-formed command again. Without this, the rest of the session would disappear from the screen (and into the $Txt variable).

Suppose you want to recognise MULTIPLE new commands. You could write multiple scripts, all handling a single extension like WindowTitle does.
While IVT handles this very efficiently, it may become a drag on performance when there are many independent threads, all examining all the data on all the sessions. Instead, you might want to write a single script that does:


   WAIT EAT_MATCH               \
        "\9D21;",WindowTitle    \
        "\9D22;",SomethingElse  \
        ... etc etc ...

LABEL WindowTitle
   ...

LABEL SomethingElse
   ...

Since a single WAIT can have an endless list of things to look for and branches to the label specified for the particular match. The single EAT_MATCH applies to all of the strings.


22.25: Real-life example of programming a microprocessor board

In the "Examples" subdirectory of the IVT installation package there is a file called "loadup.ivt", which contains a script to manipulate a uP board using a serial line. It can be studied for the following things:

And various other general programming techniques in a real-life, working script.


22.26: Testing IVT with VTTEST, or use it with VAX-VMS

IVT claims to have a top score on the VTTEST test program.
This program is a real torture test for VT-style terminals, it does things no sane application would ever do, but to be a "proper" VT-terminal, IVT has to do the "right thing" in all these cases.

However, when you run a "plain vanilla" IVT installation against the VTTEST program, you'll find that IVT does NOT live up to the claim of 110 out of a 110 maximum points. Some have chosen to make derogatory remarks about the claimed compatibility of IVT because of this...

The standard installation of IVT fails part of the VTTEST test because many hosts out there cannot handle a true VT220 terminal! Therefore, the default configuration of IVT is such that it works best with most of the hosts out there, at the price of VT220 compatibility. For example, the IDENTIFY string that IVT sends in response to an enquiry command falsely states that IVT is a sort of XTERM terminal. The proper response is not recognized by various older versions of HP-UX, Solaris and Linux. Especially HP-UX hosts get confused by the proper response, and you can't even get logged in properly. In such situations the safer defaults at least get you logged in and working. You may end up with a TERM environment variable set to VT100, or even "dumb", but most users will never know the difference, anyway. Not being able to get logged on is, however, noticed immediately and such a product is not usually given a second chance.
However, VTTEST will say: "You are a VT100 terminal, VT220 tests disabled".

Then there is the window size. A true VT220 is 24 lines, 80 columns. I think that is a really tiny window on most modern PC's, so IVT comes up with a much larger window, much more pleasant to work with, but NOT vt220-like...
Various VTTEST tests will fail if the terminal is not 24 x 80.

Then there is the issue of interpreting some 8-bit commands. There are plenty hosts out there that assume that ALL of the 8-bit characters will cause display of that character. However, a VT220 will interpret some of them as commands.
Very few applications actually make use of the VT220 8-bit commands (VAX-VMS hosts and VTTEST being exceptions), so I chose to make IVT work with the majority of hosts out there at the cost of breaking VT220 compatibility.

Another issue is the color setting. IVT has, by default, a "Windows-like" color scheme of black letters on a bright-white background. This will cause some of the color VT220 tests to fail and/or look bad.

Lastly, SCO has added a few escape sequences that IVT recognizes by default.
This needs to be turned off.

So, to summarize, IF you want to test IVT's vt220 compatibility, configure it to be a true VT220:


   WINDOW_SIZE 24 80 DEFAULT
   SIZEFONT FULL_POINTS_ONLY            # Keep same size
   IDENTIFY "?62;1;2;6;7;8;9c"  # Proper VT220 response
   COLORS WHITE BLACK
   8BITCHARS DEC DEC            # restore compatibility
   BIT8COMMANDS EXECUTE
   NO_SCO_ANSI
   BACKSPACE DELETE                     # DEC default
   SSH_TERM "vt220"                     # Force proper response
   TELNET_TTYPE "vt220"                 # Force proper response
   NO_ALT_SCREEN                        # DEC does not have this
   ANSWERBACK "\06"                     # Force default

An even better way is to select the DEC-VT220 profile.
Profiles are a convenient way to apply any number of settings in a single operation, the DEC-VT220 profile is part of the standard IVT distribution, and is an exact copy of the set of statements above.


23: History of changes and updates to IVT

News screen. This is updated regularly to list fixes & new features.


Version 27.0 (21/03/2024 - 25/01/2025) Build 47950


Version 26.8 (16/1/2022 - 21/03/2024) Build 47408
Version 26.7 (08/3/2020 - 09/01/2022) Build 45898
Version 26.6 (08/10/2019 - 08/03/2020) Build 44331
Version 26.5 (11/02/2019 - 08/10/2019) Build 43762
Version 26.4 (05/12/2018 - 10/02/2019) Build 42319
Version 26.3 (12/10/2018 - 11/12/2018) Build 41963
Version 26.2 (26/09/2018 - 06/10/2018) Build 41757
Version 26.1 (13/10/2017 - 25/09/2018) Build 41727
Version 26.0 (09/06/2017 - 13/10/2017) Build 39809
Version 25.3 (09/04/2016 - 09/06/2017) Build 39099
Version 25.2a (01/12/2016 - 09/04/2017) Build 38715
Version 25.2 (04/07/2016 - 09/10/2016) Build 38361
Version 25.1 (01/01/2016 - 04/07/2016) Build 37531
Version 25.0 (25/08/2015 - 01/01/2016) Build 36582
Version 24.0d (07/07/2015 - 25/08/2015) Build 35525
Version 24.0c (22/02/2015 - 07/07/2015) Build 35251
Version 24.0b (09/02/2015 - 22/02/2015) Build 34785
Version 24.0a (05/01/2015 - 09/02/2015) Build 34730
Version 24.0 (28/01/2014 - 17/12/2014) Build 34651
Version 23.3a (25/11/2013 - 28/01/2014) Build 33066
Version 23.3 (12/06/2013 - 25/11/2013) Build 32950
Version 23.2 (25/01/2013 - 12/06/2013) Build 32404
Version 23.1b (08/08/2012 - 25/01/2013) Build 31675
Version 23.1a (04/04/2012 - 08/08/2012) Build 31320
Version 23.1 (25/05/2011 - 04/04/2012) Build 30833
Version 23.0a (25/05/2011 - 18/01/2012) Build 30255
Version 23.0 (1/12/2010 - 17/04/2011) Build 29957
Version 22.3a (20/10/2010 - 01/12/2010) Build 29225
Version 22.3 (18/06/2010 - 08/10/2010) Build 29130
Version 22.2a (12/03/2010 - 18/06/2010) Build 29020
Version 22.2 (27/01/2010 - 12/03/2010) Build 28765
Version 22.1b (18/11/2009 - 27/01/2010) Build 28538
Version 22.1a (23/08/2009 - 18/11/2009) Build 28239
Version 22.1 (14/08/2009 - 23/08/2009) Build 27594
Version 22.0b (17/04/2009 - 13/08/2009) Build 27576
Version 22.0a (18/02/2009 - 17/04/2009) Build 27050
Version 22.0 (5/05/2008 - 18/02/2009) Build 26482
Version 21.2a (1/02/2008 - 13/02/2008) Build 24826
Version 21.2 (20/01/2008 - 27/01/2008) Build 24807
Version 21.1c (20/08/2007 - 20/01/2008) Build 24774
Version 21.1b (20/08/2007 - 05/10/2007) Build 23760
Version 21.1a (12/04/2007 - 20/08/2007) Build 23551
Version 21.1 (09/02/2007 - 12/04/2007) Build 22768
Version 21.0 (10/12/2006 - 09/02/2007) Build 22397
Version 20.2a (10/12/2006 - 02/01/2007) Build 21922
Version 20.2 (10/12/2006 - 21/12/2006) Build 21730
Version 20.1e (24/10/2006 - 10/12/2006) Build 21575
Version 20.1d (08/09/2006 - 23/10/2006) Build 21100
Version 20.1c (30/05/2006 - 07/09/2006) Build 20810
Version 20.1b (23/04/2006 - 30/05/2006) Build 20552
Version 20.1a (23/04/2006 - 25/04/2006) Build 20053
Version 20.1 (22/03/2006 - 23/04/2006) Build 20039
Version 20.0 (27/11/2005 - 22/03/2006) Build 19661
Version 19.1 (14/10/2005 - 27/11/2005) Build 18121
Version 19.0c (23/06/2005 - 14/10/2005) Build 17616
Version 19.0b (30/05/2005 - 23/06/2005) Build 17152
Version 19.0a (12/05/2005 - 30/05/2005) Build 17075
Version 19.0 (12/11/2004 - 12/05/2005) Build 17005
Version 18.1b (12/11/2004 - 01/01/2005) Build 16224
Version 18.1a (13/10/2004 - 31/10/2004) Build 15997
Version 18.1 (13/08/2004 - 13/10/2004) Build 15775
Version 18.0b (4/06/2004 - 13/08/2004) Build 15336
Version 18.0a (25/05/2004 - 03/06/2004) Build 15150
Version 18.0 (30/01/2004 - 23/05/2004) Build 15133
Version 17.0e (30/01/2004 - 16/03/2004) Build 14337
Version 17.0d (25/11/2003 - 30/01/2004) Build 13552
Version 17.0c (19/10/2003 - 23/11/2003) Build 13449
Version 17.0b (25/09/2003 - 19/10/2003) Build 13216
Version 17.0a (10/09/2003 - 25/09/2003) Build 13132
Version 17.0 (3/8/2003 - 10/09/2003) Build 13039
Version 16.4c (18/5/2003 - 3/08/2003) Build 12592
Version 16.4b (14/4/2003 - 18/05/2003) Build 12142
Version 16.4a (8/4/2003 - 13/04/2003) Build 11998
Version 16.4 (3/2/2003 - 08/04/2003) Build 11942
Version 16.3a (29/11/2002 - 03/02/2003) Build 11697
Version 16.2d (12/11/2002 - 29/11/2002) Build 10821
Version 16.2c (04/11/2002 - 11/11/2002) Build 10670
Version 16.2b (25/10/2002 - 04/11/2002) Build 10156
Version 16.2a (18/10/2002 - 25/10/2002)
Version 16.2 (06/09/2002 - 18/10/2002)
Version 16.1a (08/08/2002 - 06/09/2002)
Version 16.1 (04/07/2002 - 22/07/2002)
Version 16.0a (24/05/2002 - 04/07/2002)
Version 16.0 (22/05/2002 - 24/05/2002)
Version 15.0e (02/04/2002 - 22/05/2002)
Version 15.0d (19/03/2002 - 02/04/2002)
Version 15.0c (26/02/2002 - 17/03/2002)
Version 15.0b (20/02/2002 - 25/02/2002)
Version 15.0a (12/02/2002 - 19/02/2002)
Version 15.0 (19/01/2002 - 11/02/2002)
Version 14.1e (22/12/2001 - 10/01/2002)
Version 14.1d (22/11/2001 - 18/12/2001)
Version 14.1c (18/10/2001 - 19/11/2001)
Version 14.1b (11/8/2001 - 17/10/2001)
Version 14.1a (19/6/2001 - 9/8/2001)
Version 14.1 (13/4/2001 - 12/6/2001)
Version 14.0 (13/4/2001 - 12/5/2001)
Version 12.2f (7/3/2001 - 9/4/2001)
Version 12.2e (5/2/2001 - 7/3/2001)
Version 12.2d (29/12/2000 - 24/1/2001)
Version 12.2c (13/11/2000)
Version 12.2b (31/10/2000)
Version 12.2/12.2a (18/8/2000 - 29/10/2000)
Version 12.1 (4/7/2000 - 17/8/2000)
Version 12.0e (24/5/2000 - 3/7/2000)
Version 12.0d (27/4/2000 - 11/5/2000)
Version 12.0c (2/3/2000 - 27/3/2000)
Version 12.0b (2/3/2000 - 17/3/2000)
Version 12.0a (23/2/2000 - 1/3/2000)
Version 12.0 (11/1/2000)
Version 11.3f (30/11/1999 - 11/01/2000)
Version 11.3e (29/9/1999 - 28/11/1999)
Version 11.3d (13/9/1999 - 25/9/1999)
Version 11.3c (22/8/1999)
Version 11.3b (9/8/1999)
Version 11.3a (26/7/1999)
Version 11.3 (22/6/1999)
Version 11.2c (14/6/1999)
Version 11.2b (26/5/1999)
Version 11.2a (17/5/1999)
Version 11.2 (12/5/1999)
Version 11.1 (4/5/1999)
Version 11.0 (19/4/1999 - 3/5/1999)
Version 10.2b (12/4/1999)
Version 10.2a (31/3/1999)

24: Under construction....


25: About IVT

This is version 27.0 build 47950 of IVT Secure Access (64-bits).
This build was generated on Sat Jan 25 16:50:08 2025.

This is the commercial version of IVT, with integrated Kerberos V5 authentication and encryption.
This build also supports the SSH-2 Secure Shell protocol.
This build also supports X-Windows port forwarding over Kerberized sessions.
For sales information please contact sales@ivtssh.nl.
For technical support please contact support@ivtssh.nl.

IVT contains very complete, context sensitive documentation.
Just right-click on any button, dialog or menu-entry for help.
A printed manual would take about 902 pages, assuming 65 lines to a page.
You can also print parts of the manual.
If you prefer, there is also an HTML version of the manual (see Windows IVT start menu).

Click here for further help-on-help.


26: Table of contents



1: Introduction, highlights and main topics
  1.1: Global description
  1.2: Where can I obtain IVT?
  1.3: List of major features.
  1.4: Licence agreement
    1.4.1: Copyright for Open Source parts of IVT
  1.5: Copyright Notice PuTTY
  1.6: Command line parameters of IVT
  1.7: Version number of IVT
  1.8: The news screen explained
  1.9: Passing command line options
  1.10: Assigning script variables from the command line
  1.11: Specifying a hostname on the command line
  1.12: Passing a URL on the command line (-u)
  1.13: Integration with password managers (like SecretServer)

2: Several useful facilities of IVT
  2.1: The scrollback buffer
  2.2: Using the mouse
    2.2.1: Configuring the default mouse action.
    2.2.2: Simple cutting and pasting with the mouse
    2.2.3: Advanced copying and pasting with the mouse.
    2.2.4: Using multiple cut/paste buffers with the mouse.
    2.2.5: Programming the mouse in combination with the keyboard
    2.2.6: Cutting and pasting with the keyboard.
    2.2.7: Resizing the terminal window with the mouse.
    2.2.8: Clicking on the various parts of the status line.
    2.2.9: Selecting a session in the F4-S screen with the mouse.
    2.2.10: Interpret selection as host names and connect to them all
    2.2.11: Store text on clipboard from a script
    2.2.12: Kill all session but this one
    2.2.13: Show session events
  2.3: Themes (manage color themes)
  2.4: Locking the keyboard
  2.5: The "Scripts" menu
  2.6: Project files
  2.7: The session groups editor
  2.8: Fixing broken groups
  2.9: Starting a session in a new window.
  2.10: Learn mode & Keyboard macros
  2.11: Help on help - The IVT manual system
  2.12: Hypertext help keyboard commands
  2.13: Save current help-topic to a file.
  2.14: Encrypting .RC files
  2.15: Secure mode
  2.16: Challenge response protocol
  2.17: Show current cursor position

3: IVT FAQ: Frequently Asked Questions
  3.1: How do I start a new session?
  3.2: How do I exit a session?
  3.3: How can I select words/phrases with the mouse?
  3.4: How do I view scrolled-away data?
  3.5: How do I change and save the configuration of IVT?
  3.6: The status line of IVT is hidden by Windows. What to do?
  3.7: CAPSLOCK seems to have no effect!
  3.8: IVT beeps every time I touch a key
  3.9: Password learning fails if I don't HAVE a password
  3.10: Can I use ALT as meta-key for EMACS?
  3.11: Could IVT be used to emulate the MS Windows command prompt?
  3.12: Why is there no Linux (or Unix) version of IVT?
  3.13: Host-printing (controller mode) does not seem to work?
  3.14: HP-UX bizarre one-line display on bottom line problem.

4: How to create, close and switch between sessions

5: IVT and the Windows registry
  5.1: Saving IVT setup to the registry
  5.2: Removing IVT setup from the registry
  5.3: Exporting/importing IVT configurations

6: The IVT keyboard guide
  6.1: Summary of special IVT function keys
  6.2: CTRL+F6: Escape to operating system (Sub Shell)
  6.3: ALT+t: Toggle between two sessions
  6.4: ALT+a: Alert mode (ring bell on activity)
  6.5: ALT+0: Generate any character.
  6.6: Names of the VT220 programmable keys

7: The status line and what it can do for you
  7.1: Introduction to the status line
  7.2: Status line Modem indicator for serial lines
  7.3: The status line indicators and icons.
  7.4: Status line hostname
  7.5: Status line clock
  7.6: Status line size indicator.
  7.7: Status line activity indicator
  7.8: Status line comment

8: IVT menu bars and panel dialogs
  8.1: Introduction
  8.2: Menu bars
    8.2.1: Using the menu bars
    8.2.2: Setting menu bar colors
    8.2.3: Configuration of the CUSTOM menus
  8.3: Start-up general help
  8.4: The create session panel interface
  8.5: Repeat count
  8.6: List with previous host & users
  8.7: Host list filter expression

9: F3: IVT Setup dialogs
  9.1: Introduction to setup dialogs
  9.2: Setup propagation
  9.3: Protocol setup
  9.4: Proxy setup
  9.5: Configure delays
  9.6: IVT Tunnel setup
  9.7: Telnet setup
    9.7.1: Telnet setup: Send Are You There
    9.7.2: Telnet setup: Send break
    9.7.3: Telnet setup: Send Interrupt Process
    9.7.4: Telnet setup: Force Logoff
    9.7.5: Telnet setup: Show remote status
    9.7.6: Telnet setup: Binary mode
    9.7.7: Telnet setup: Suppress Go Ahead
    9.7.8: Telnet setup: Local flow control
  9.8: Kerberos setup
  9.9: X-Windows port forwarding
  9.10: SSH Setup
  9.11: SSH Port Forwarding
  9.12: SSH Key-exchange configuration
  9.13: SSH bug detection
  9.14: Stored SSH host keys
    9.14.1: GSSAPI Authentication over SSH connections
  9.15: Serial setup
  9.16: RLOGIN setup
  9.17: VT220 (basic) setup
    9.17.1: VT220 basics: Linefeed implies CR
  9.18: VT220 (more) setup
    9.18.1: Setup: Bell abuse settings
    9.18.2: Setup: Local echo mode
  9.19: Mouse setup
  9.20: Color setup
  9.21: Font and Keyboard
  9.22: Keyboard map exceptions
  9.23: BIDI Settings
  9.24: Log settings
  9.25: Windows setup
  9.26: Printer setup
  9.27: Keyboard macros
  9.28: Encrypting files
  9.29: ZMODEM setup
  9.30: Setup: Reset terminal
  9.31: Setup: Cancel scripts
  9.32: Setup: Dump data
  9.33: Setup: Flush printer
  9.34: Setup: Highlight strings on the session
  9.35: Setup: TABS bar properties

10: F4 - Help & Various functions
  10.1: F4-S: Session ordering
  10.2: F4-G: Create a named group of sessions
  10.3: F4-X: Managing scripts
  10.4: F4-K: Managing macro's

11: Protocols supported by IVT
  11.1: Overview of supported protocols
  11.2: Transport protocols
    11.2.1: The NetBios transport protocol
    11.2.2: The TCP transport protocol
    11.2.3: The WINSOCK transport protocol
    11.2.4: The SERIAL transport protocol
    11.2.5: The multiplex transport protocol
  11.3: The IVTMUX program
    11.3.1: The DUMMY transport protocol
  11.4: Session protocols
    11.4.1: The TELNET session protocol
    11.4.2: The RLOGIN session protocol
    11.4.3: Secure Shell (SSH-2)

12: Syntax of IVT.RC setup files
  12.1: Introduction to IVT.RC files and Table Of Contents
  12.2: General and miscellaneous settings
    12.2.1: 8BITCHARS (What to do with the 8th bit)
    12.2.2: ANSWERBACK (Response to ENQ from host)
    12.2.3: BITMODE (VT220 7 or 8 bit-mode)
    12.2.4: BUGGYBINARY (Host has buggy binary mode)
    12.2.5: CREATE (Creates groups of sessions automatically)
    12.2.6: CREATEGROUP (Start a logical group of CREATE statements)
    12.2.7: CRYPTPWD (Set passwords to use for decrypting files)
    12.2.8: DEBUG (Turn debugging on/off)
    12.2.9: DEBUG_TIMESTAMP (show elapsed times for protocol debuggers)
    12.2.10: DEFINE_PROFILE (Define a setup profile)
    12.2.11: DODEBUG (Developer debugging)
    12.2.12: DOMAIN (Set domain name for DNS resolves)
    12.2.13: DOWNLOAD (Specify directory for file transfers)
    12.2.14: ESCGET & ESCRUN (Access files/commands from remote)
    12.2.15: HISTORY (Number of roll-back screens)
    12.2.16: HISTORY_TIMEOUT (Quit pager after inactivity)
    12.2.17: HOSTLIST (Manage the address book of IVT)
    12.2.18: IDENTIFY (Sets response to CSI c inquiry command)
    12.2.19: INCLUDE (include files in an IVT.RC file)
    12.2.20: IPVERSION (Choose IPv4 or IPv6)
    12.2.21: MAXTYPEDHOSTS (Number of typed hosts stored in address book)
    12.2.22: MERCY_MODE (Show hosts some mercy)
    12.2.23: MLDEFCMD (Set default command for multiplexer)
    12.2.24: MLFILTER (Avoid certain bytes on multiplex links)
    12.2.25: OBJECT_ID (Show names of internal IVT objects)
    12.2.26: ONCONNECT (Script to run after 'Session Established')
    12.2.27: ONDISCONNECT (execute script when host disconnects)
    12.2.28: ONDROPFILES (action for drag/drop operation)
    12.2.29: ONERROR (call script when errors occur)
    12.2.30: ONLANGUAGE (Call script when user-language changes)
    12.2.31: ONMINIMIZE (Call script when window is minimized)
    12.2.32: ONRESIZE (Call script when window resizes)
    12.2.33: ONRESTORE (Call script when window is restored)
    12.2.34: ONSWITCHFROM/TO (Call script when session switch occurs)
    12.2.35: ONTABICON/TO (Call script when user clicks tab bar icon)
    12.2.36: OPTIONS (Specify command line options in IVT.RC file)
    12.2.37: PACKAGE (Logical groupings of scripts)
    12.2.38: PUBLIC (Publish items of a package)
    12.2.39: PUTTY_IMPORT (Import Putty setup data)
    12.2.40: PRIVATE_RC_FILES (Allow/deny private configuration)
    12.2.41: PROFILE (Load configuration)
    12.2.42: PROFILE with same name as host
    12.2.43: PROTOCOL (Specify the type of protocol to be used)
    12.2.44: REGISTRY (Load start-up config from registry yes/no)
    12.2.45: RESOLVE (Set name resolution sources)
    12.2.46: RESOLVE_TRACE (Show name resolution and DNS debugging)
    12.2.47: RLOGIN_LOCALUSER (Name of local user for RLOGINs)
    12.2.48: RLOGIN_REMOTEUSER (Name of remote user for RLOGIN)
    12.2.49: RLOGIN_TERM (Terminal type for RLOGIN sessions)
    12.2.50: SAVEGROUPNAME (Save chosen group name as if typed)
    12.2.51: SAVEHIST (Enable history pager yes/no)
    12.2.52: SHOWLICENCE (Show licence on screen during startup yes/no)
    12.2.53: STORE_CMD_PARAMS (Save host/user from command line)
    12.2.54: STRICT_CHECK (More rigid syntax/execution checks)
    12.2.55: TCP_FLOOD (Prevent too many TCP/IP sessions being created)
    12.2.56: TCP_KEEPALIVE (Enable/disable TCP socket level keepalive )
    12.2.57: TCP_NODELAY (Enable/disable Nagle algorithm)
    12.2.58: TIPS (Enable/Disable start-up tips)
    12.2.59: TYPEDHOSTS (Show manually entered hosts)
    12.2.60: UPLOAD (set upload directory)
    12.2.61: VERSION_SERVER (notify of new releases of IVT)
    12.2.62: WSOCKTIMEOUT (set timeout for connection setup)
    12.2.63: XAUTH_DELAY (Handle XAUTH locking problem)
    12.2.64: XTERM_256 (XTERM 256 color mode)
    12.2.65: ZMODEM_AUTO (Automatic ZMODEM start-up)
    12.2.66: ZMODEM_PACKET (Maximum size of transfer blocks)
  12.3: Look & feel
    12.3.1: ADDRESSBOOK_ONLY (Limit hosts to connect to)
    12.3.2: ADVANCED_MODE (Advanced user interface)
    12.3.3: ALT_IS_MENU (ALT by itself activates menu bar)
    12.3.4: ALT_ENTER (Alt+Enter does full screen)
    12.3.5: ALT_SCREEN (Allow alternate screen)
    12.3.6: AMBIGUOUS_CJK_WIDE (Treat ambiguous CJK characters as wide)
    12.3.7: ARABIC_SHAPING (Enable Arabic shaping of text)
    12.3.8: AUTOCONTRAST (Adjust colors automatically for contrast)
    12.3.9: AUTOCOMPLETE (Behaviour of the host name entry field)
    12.3.10: AUTOLOG (Generate session log files)
    12.3.11: AUTOLOG_HEADER (Generate header in AUTOLOG file)
    12.3.12: BACKSPACE (Code generated by BACKSPACE key)
    12.3.13: BELL (Action to take when BELL character is received)
    12.3.14: BELL_ABUSE (Prevent BELL noise overload)
    12.3.15: BIDI (Enable Bi-directional text)
    12.3.16: BIDI_ESC_RTL: Enable/disable special BIDI escape commands
    12.3.17: BIDI_RTL_LANGUAGE/BIDI_LTR_LANGUAGE: Switch keyboard
    12.3.18: BIDI_TYPE (set explicit character type for BIDI)
    12.3.19: BIT8COMMANDS (display/execute 8-bit commands)
    12.3.20: BIND (Bind a SCRIPT to a key)
    12.3.21: BOLD_STYLE (How to make character bold on screen)
    12.3.22: BRACKETED_PASTE (Support for bracketed paste)
    12.3.23: CAPSBUG (CAPS + SHIFT behavior)
    12.3.24: CAPSLOCK (Set mode for CAPS lock key)
    12.3.25: CHARSET (Set DECVT220 or IBMPC character set)
    12.3.26: CLICK (keyboard click on/off)
    12.3.27: CLOCK (Status line clock on/off, old-fashioned)
    12.3.28: CODEPAGE (Set Windows output code page)
    12.3.29: UTF-8 (What it is)
    12.3.30: CODEPAGEMOD (Modify current codepage)
    12.3.31: COLOR_CUT (Color of selected area during CUT operation)
    12.3.32: COLOR_READY (Specify screen colors for ready indicator)
    12.3.33: COLORS (Specify primary screen colors)
    12.3.34: COLORSCR (Detection of monochrome/color screen overrule)
    12.3.35: COLOR_HELP (Specify screen colors for these help screens)
    12.3.36: COLOR_SEARCH (Colors to use for searched text)
    12.3.37: COLOR_TIPS (Colors to use for tooltip windows)
    12.3.38: COLOR_ATTRIBUTE/FOR (use colors instead of video attributes)
    12.3.39: COLOR_BLINK (use colors instead of true blinking)
    12.3.40: COLOR_MARKER (use mouse to mark text)
    12.3.41: COLOR_TAB_SELECT/DESELECT/ERROR (Session tab colors)
    12.3.42: COLOR_UNDERLINE (use colors instead of true underlining)
    12.3.43: COLOR_VOLATILE (Setup colors of volatile items)
    12.3.44: COLUMNS (Default number of screen columns)
    12.3.45: CONFIRM_URL_CLICK
    12.3.46: COPYSPEED (Scroll speed during COPY)
    12.3.47: COPY_RICH_TEXT (Copy data to the clipboard in RTF format)
    12.3.48: COPY_STRICT (Strict or fuzzy COPY mode)
    12.3.49: COPY_TRIM (Trim trailing spaces after select)
    12.3.50: CRDIALOG (Use dialog to create sessions)
    12.3.51: CURSOR_BLINK (Blinking cursor yes/no)
    12.3.52: COLOR_CURSOR (Color of the cursor)
    12.3.53: CURSORMODE (Application/normal mode of cursor keys)
    12.3.54: CURSOR_HEIGHT (Height of text-mode cursor)
    12.3.55: CUTMODE (Line or Block CUT-mode)
    12.3.56: DEADKEYS (Enable/disable dead keys)
    12.3.57: EMACS (Set EMACS keyboard mode)
    12.3.58: EXPLICIT_EXIT (IVT has to be terminated explicitly)
    12.3.59: EXTRA_PANEL_ROOM (Horizontal spacing in dialogs)
    12.3.60: F1F4 (Reverse meaning of F1-F4 and CTRL+F1 - CTRL+F4)
    12.3.61: FLASH (Action to take for flashing screen)
    12.3.62: FONT_DISPLAY_0 (How to display "0" character)
    12.3.63: FOREIGN_ALT_NUMERIC (Recognize ALT-0/9 on foreign keyboard)
    12.3.64: FULLSCREEN (What to show in full screen mode)
    12.3.65: FONT (Set the screen font for session)
    12.3.66: FONT_QUALITY (Set font quality for all fonts)
    12.3.67: GUI_CLOSE (Disable Windows close button)
    12.3.68: GUI_ONTOP (Force window on top)
    12.3.69: GUI_RESIZE (allow resize of session)
    12.3.70: HIDEMOUSE (hide mouse pointer while typing)
    12.3.71: HIGHLIGHT (Highlight expressions on screen, act on them)
    12.3.72: HIGHLIGHT_MODE (Turn all HIGHLIGHT string on/off)
    12.3.73: INPUT_LANGUAGE (Keyboard input language)
    12.3.74: IVT_DIALOGSTATE (Configure dialogs and menus)
    12.3.75: IVT_LANGUAGE (Language used by IVT itself)
    12.3.76: KEYBOARD_MAP (Select XTERM/VT220 type of keyboard)
    12.3.77: KEYBOARDMOD (Modify keyboard codepage)
    12.3.78: KEYMACRO (Program any key to do anything)
    12.3.79: KEYNAME (Program VT220 keys)
    12.3.80: KEYPADMODE (change numeric keypad behavior)
    12.3.81: LANGUAGE_FILES (Add extra translation tables for scripts)
    12.3.82: LAST_POSITION (Restore last position and size)
    12.3.83: LAST_PROTOCOL (Restore last protocol on startup)
    12.3.84: LEAVE_COPY_SELECTION (Leave selected area visible)
    12.3.85: LF_IMP_CR (Linefeed implies Carriage return)
    12.3.86: LINK[UN]SELCOL (Color for (un)selected links)
    12.3.87: LOAD (Loads a learned key-definition file)
    12.3.88: LOCKTIMER (Locks keyword with PASSWORD after N minutes)
    12.3.89: MOUSE (Configure left/right mouse buttons)
    12.3.90: MENUBAR (Enable/disable menu bars)
    12.3.91: MOUSE_SELECTION (Select words/phrases with mouse)
    12.3.92: MOUSE_EXTEND_TO_LINE (Mouse copy behavior)
    12.3.93: MOUSE_KEY (Configure mouse in combination with keyboard)
    12.3.94: MOUSE_NOXTERM2 (Disable support for XTERM2 mouse mode)
    12.3.95: MOUSE_PUTTY_WORDS (Putty compatible word selection)
    12.3.96: MOUSE_PUTTY_SELECT (Putty compatible character classes)
    12.3.97: MOUSE_SCROLL_FACTOR/PAGESIZE (Mouse scroll tuning)
    12.3.98: MOUSE_USAGE (Show usage in status during select)
    12.3.99: NATIONALITY (Select national replacements)
    12.3.100: NUMERICF1F4 (Configure PF1-PF4 on numeric keypad)
    12.3.101: NUMLOCK_CORRECTION (Undo typing NUM-LOCK)
    12.3.102: PASSWORD (Set password for keyboard lock)
    12.3.103: PASTE_LAST_NL (remove trailing newline when pasting)
    12.3.104: PASTESPEED (regulate paste speed)
    12.3.105: PRECONNECT (Execute scripts BEFORE session is established)
    12.3.106: RGB (set RGB values for ANSI colors)
    12.3.107: RECONNECT (Automatic destruction of sessions upon logout)
    12.3.108: RETAIN_SESSIONS (Force manual termination of sessions)
    12.3.109: ROWS (Default number of screen lines)
    12.3.110: SCO_ANSI (enable/disable SCO ANSI mode)
    12.3.111: SCREENSAVE (activate screensaver after N minutes)
    12.3.112: SCRMODE (Define commands to change screen size)
    12.3.113: SESSION_OVERVIEW (Type of host shown in F4-S)
    12.3.114: SEARCH_CASE_SENSE (Case sensitivity for search default)
    12.3.115: SESWRAP (Configure behavior of CTRL+CURSOR keys)
    12.3.116: SHOWNEWS (show news screen for new version)
    12.3.117: SIZE4ALL (Resize all sessions simultaneously)
    12.3.118: SIZEFONT (size font when window is resized)
    12.3.119: SOFTBLINK (enables/disables software blinking)
    12.3.120: SPEED (Set default screen refresh/scroll speed)
    12.3.121: SPLASHTIME (Set maximum display time for splash screen)
    12.3.122: STATBORDERS (Show separators in GUI status line)
    12.3.123: STATMIDDLE (What to display in middle of status line)
    12.3.124: STATUS (Enable/Disable the status line).
    12.3.125: STATUSCLICKS (Enable/disable mouse on status line)
    12.3.126: SMOOTH (smooth scrolling)
    12.3.127: SUBSTITUTE_FONT (for line drawing characters)
    12.3.128: SMART_PASTE (Translate common Unicode characters on Paste)
    12.3.129: TABSBAR (Enable the TABBED interface)
    12.3.130: TITLEBAR (Set Window title)
    12.3.131: TOOLTIPS (Show tooltips for status bar)
    12.3.132: TRANSPARENCY (Set window transparency)
    12.3.133: VERTICAL_LINE (colored, vertical lines on session screen)
    12.3.134: VSCROLL (enable vertical scroll bar)
    12.3.135: VSPACE/HSPACE (extra border space)
    12.3.136: WINDOW_SIZE (Set the size of the IVT session window)
    12.3.137: WINDOW_POS (specify default window position)
    12.3.138: WRAP (set line wrapping mode)
  12.4: Printing and printer related settings
    12.4.1: AUTOLANDSCAPE (for text mode prints)
    12.4.2: CONFIRM_PRSCREEN (Confirm print screen)
    12.4.3: CONFIRM_PRINT_SELECT (Confirm print selection)
    12.4.4: PR_CONTROLLER (How to handle host printing)
    12.4.5: PR_INDENT (Create a left margin in printout)
    12.4.6: PR_LINES (Number of lines per page to use when printing)
    12.4.7: PRINTER (Define a logical printer)
    12.4.8: PRINTER_AUTO_FF (Send FormFeed when closing printer)
    12.4.9: PRINTER_FONT (Font to use for printing)
    12.4.10: PRINTER_PROMPT (Ask before overwriting/appending print files)
    12.4.11: PRSTATLINE (Print status line with print-screen yes/no)
    12.4.12: PRBLACKWHITE (Force black & white printing)
    12.4.13: PRINTER_FONT_SCALE (Adjust font to fit paper)
    12.4.14: PRTIMEOUT (Auto flush printer after N seconds)
    12.4.15: TIMESTAMP_PRSCREEN (Timestamp print screen output)
  12.5: Kerberos and DCE related settings
    12.5.1: DCE32 (Enable/disable use of DCE32.DLL)
    12.5.2: FORWARD_X (Enable/disable X-forwarding)
    12.5.3: FORWARD_X_DISPLAY (Specify DISPLAY for X-tunnel protocol)
    12.5.4: KRB5 (Enable/Disable Kerberos V5 authentication)
    12.5.5: KRB5_AUTODECRYPT (automatically start telnet decryption)
    12.5.6: KRB5_AUTOENCRYPT (automatically start telnet encryption)
    12.5.7: KRB5_COMERR_DLL (path to Kerberos error message DLL)
    12.5.8: KRB5_CRYPTDEBUG (show debugging for telnet encryption)
    12.5.9: KRB5_DLL (specify path of Kerberos V5 DLL files)
    12.5.10: KRB5_ENDLOGIN (terminate Kerberos login program after login)
    12.5.11: KRB5_FORWARD (forward credentials to telnet server)
    12.5.12: KRB5_LOGINPROG (Program to obtain credentials)
    12.5.13: KRB5_REALM (Change default realm)
    12.5.14: LICENCE (Point to a licence file)
  12.6: Proxy related settings
    12.6.1: Proxy overview
    12.6.2: PROXY_DEBUG (Turn debug on/off for proxy operations)
    12.6.3: PROXY_DNS (Name resolution when using a proxy)
    12.6.4: PROXY_EXCLUDE (Which hosts NOT to proxy)
    12.6.5: PROXY_HOSTNAME (Hostname/port of the proxy server)
    12.6.6: PROXY_TIMEOUT (Maximum time for proxy operations)
    12.6.7: PROXY_LOCAL (Use proxy for local addresses yes/no)
    12.6.8: PROXY_IPV6 (Proxy understands IPv6 addresses)
    12.6.9: PROXY_TELNET_CMD (Command string for a TELNET proxy server)
    12.6.10: PROXY_TYPE (Type of proxy server)
    12.6.11: PROXY_USER/PASSWORD (Login credentials for proxy server)
    12.6.12: PROXY_SCRIPT (IVT script to handle proxy)
  12.7: IVT tunnel related settings
    12.7.1: TUNNEL overview
    12.7.2: TUNNEL specification (LOCAL/REMOTE)
    12.7.3: TUNNEL PROGRAM (set local tunnel support program)
    12.7.4: TUNNEL DEBUG (Set debug/trace file for the tunnel program)
    12.7.5: TUNNEL CONFIG (Set extra configuration file)
    12.7.6: TUNNEL MINIMIZE (start ivttunnel program minimized)
  12.8: Telnet settings
    12.8.1: TELNET_KEEPALIVE (Set keep alive interval)
    12.8.2: TELNET_NEWENV (Enable/disable NEWENV RFC 1572)
    12.8.3: TELNET_NUL_AFTER_CR (Enable/disable sending NUL after a CR)
    12.8.4: TELNET_TRACE (Enable/disable telnet trace)
    12.8.5: TELNET_NEGOTIATE (Offer extra options to host)
    12.8.6: TELNET_TTYPE (Set TELNET terminal types)
    12.8.7: TELNET_TSPEED (Set TELNET terminal speed)
    12.8.8: TELNET_VAR (Set TELNET user variable)
    12.8.9: TELNET_LOCATION (Set TELNET location)
    12.8.10: TELNET_XDISPLAY (Pass X-display location)
    12.8.11: TELNET_XDISP_IP (Send display name with IP-address)
  12.9: Secure shell (SSH) settings
    12.9.1: SSH_ACCEPT (What to do with a new host key)
    12.9.2: SSH_AGENT (Enable authentication forwarding)
    12.9.3: SSH_BUGS (Configure detection of SSH bugs)
    12.9.4: SSH_CIPHERS (Specify SSH cipher preference)
    12.9.5: SSH_COMPRESSION (Enable SSH data compression)
    12.9.6: SSH_DATA (Send command as data to SSH server)
    12.9.7: SSH_DEBUG (Enable SSH debugging)
    12.9.8: SSH_DES_CBC (Enable non-standard use of DES in SSH)
    12.9.9: SSH_FORWARD (SSH Port forwarding)
    12.9.10: SSH_GSSAPI_AUTHENTICATE (Kerberos authentication over SSH)
    12.9.11: SSH_GSSAPI_DELEGATE (Forward credentials yes/no)
    12.9.12: SSH_GSSAPI_ORDER (Use MIT, Windows or private GSSAPI)
    12.9.13: SSH_GSSAPI_PREFERRED (Use GSSAPI when offered)
    12.9.14: SSH_GSSAPI_REVERSELOOKUP (Reverse lookup of hostnames)
    12.9.15: SSH_GSSAPI_SYSTEMUSER (Use Windows account as GSSAPI default)
    12.9.16: SSH_GSSAPI_USERDLL (Specify path to private GSSAPI DLL)
    12.9.17: SSH_HOSTKEYS (Saved files with SSH host keys)
    12.9.18: SSH_HOSTKEY_ALGS (configure host key algorithms)
    12.9.19: SSH_INTERACT_PWD (Enable SSH interactive passwords)
    12.9.20: SSH_KEEPALIVE (Set keep alive interval)
    12.9.21: SSH_KEX (Specify SSH key exchange preference)
    12.9.22: SSH_KEX_MINUTES and SSH_KEX_MBYTES (key-exchange maximums)
    12.9.23: SSH_KEYFILE (Specify private key file for SSH)
    12.9.24: SSH_LOGDATA (Log SSH packet data to file)
    12.9.25: SSH_PAGEANT_ALLOW (Allow use of Pageant)
    12.9.26: SSH_PAGEANT_PATH/AUTO (Start SSH authentication agent)
    12.9.27: SSH_PSEUDO_TERM (Enable allocation of SSH terminal)
    12.9.28: SSH_SENDENV (send environment variables on session)
    12.9.29: SSH_SHOW_AGENT (Show authentication agent being used)
    12.9.30: SSH_SHOW_DEBUG (Show SSH DEBUG messages on screen)
    12.9.31: SSH_TRIVIAL_AUTH (SSH allows trivial access)
    12.9.32: SSH_TERM (Set terminal type for SSH)
    12.9.33: SSH_XAUTH (Set SSH X11 authentication mode)
  12.10: Serial communications
    12.10.1: BAUD (Set baud rate for serial connection)
    12.10.2: CARRIERSTATUS (Serial status line indicator on/off)
    12.10.3: CTSRTS (Turn serial hardware handshake on/off)
    12.10.4: DBITS (Set number of data bits for serial lines)
    12.10.5: PARITY (Set serial line parity to odd/even/off etc)
    12.10.6: RING (Use PC-speaker as phone-ringer for serial lines)
    12.10.7: SBITS (Set number of stop bits for serial lines)
    12.10.8: SR_DSR (Serial Data Set Ready control)
    12.10.9: SR_DSR_INPUT (DSR Sensitivity)
    12.10.10: SR_DTR_CTRL (DTR flow control)
    12.10.11: SR_RTS_CTRL (Serial RTS/CTS flowcontrol)
    12.10.12: SR_WRITETIMEOUT (Serial data write timeouts)
    12.10.13: SR_XONOFF_OUT/SR_XONOFF_IN (Serial flow control)
    12.10.14: SR_XOFF_LIMIT (XOFF limit)
    12.10.15: SR_XON_LIMIT (XON limit)

13: The SCRIPT language
  13.1: Introduction to the IVT SCRIPT language
  13.2: Global syntax of a script
  13.3: Using strings and numbers in scripts
  13.4: Using expressions in scripts
  13.5: The STARTUP script
  13.6: SHUTDOWN and DESTROY scripts
  13.7: Using variables in scripts
    13.7.1: Hashes (associative arrays) and plain arrays
    13.7.2: Arrays (lists)
  13.8: List of all IVT defined SCRIPT variables
    13.8.1: Variable AUTOLOGIN: User wants auto-login yes/no
    13.8.2: Variable ANYCHAR: Character found by WAIT ANYCHAR
    13.8.3: Variable ANYCHAR_HEX: Character found by WAIT ANYCHAR
    13.8.4: Variable COLS: Number of columns on the current session
    13.8.5: Variable DFLTPROTOCOL: Default protocol.
    13.8.6: Variable DFLT_USER: Default user
    13.8.7: Variable ERRNO: Operating system error number
    13.8.8: Variable FORALLTYPE: Type of current variable
    13.8.9: Hash XXXMATCH (details of a HIGHLIGHT/WAIT/REGMATCH match)
    13.8.10: Variable HOSTNAME: Name of the host
    13.8.11: Variable HOSTNAME_ONLY: Hostname without the port number
    13.8.12: Variable HOSTNAME_PORT: Port number part of the hostname
    13.8.13: Variable HOSTPROMPT: Display when asking for new connection
    13.8.14: Variable HOSTLIST_DESCR (description from HOSTLIST)
    13.8.15: Variable HOSTLIST_EXTRA (hidden info from HOSTLIST)
    13.8.16: Variable HOSTLIST_SHORTNAME (short name used to create session)
    13.8.17: Variable IVT_DROP_COUNT: Number of dropped files.
    13.8.18: Variable IVT_FTP_DELAY: Delay after script FTP
    13.8.19: Variable IVT_GROUP_COUNT: Number of sessions in a group
    13.8.20: Variable IVT_GROUP_NAME: Name of group being created
    13.8.21: Variable IVT_IP_ADDR: IP address of session
    13.8.22: Variable IVT_IP_CANON: Canonical name of host
    13.8.23: Variable IVT_IP_FQN: Host name after resolving
    13.8.24: Hash IVT_LIC: Licence info
    13.8.25: Variable IVT_NETW: Network configuration information.
    13.8.26: Variable IVT_NETW_HOST: PC hostname
    13.8.27: Variable IVT_NETW_IP_ADDR: PC IP-address
    13.8.28: Variable IVT_NETW_DOMAIN: Name of the domain of the IVT PC
    13.8.29: Variable IVT_PROXY_PASSWORD: Proxy password
    13.8.30: Variable IVT_PROXY_USER: Proxy username
    13.8.31: Variable IVT_REPEATNR: Sequence number
    13.8.32: Variable IVT_SCREENCLASS: Registered name of IVT
    13.8.33: Variable IVT_SERIAL_PORTS: Detected serial hardware
    13.8.34: Variable IVT_SESSION_TABTEXT: Text in tab of CREATE statement
    13.8.35: Variable IVT_STATUS_DATETIME: Format of status line clock
    13.8.36: Variable IVT_STATUSHOST: Contents of HOST field in the status bar
    13.8.37: Variable IVT_TUNNEL_ACTIVE: Special tunneling is active
    13.8.38: Variable IVT_USER_COMMENT: Manually typed comment
    13.8.39: Variable IVT_URL_STARTUP: IVT started from a URL
    13.8.40: Variable IVTDOWN/UP/LOAD: IVT file transfer directory
    13.8.41: Variable IVTDIR: IVT installation directory
    13.8.42: Hash IVT_INFO (Generic information about the IVT environment)
    13.8.43: Hash IVT_SM (Windows System Metrics)
    13.8.44: Variable IVTPID (PID of IVT itself)
    13.8.45: Variable IVT_AUTOLOG_MODIFIED (user altered AUTOLOG)
    13.8.46: Variable IVT_CLONE_OF: Current session is a clone
    13.8.47: Variable IVT_CREATE_SESSION: Create Session is active
    13.8.48: Variable IVT_DIALOGS: Number of active dialogs
    13.8.49: Variable IVTTMPDIR: Work directory
    13.8.50: Variables for Kerberos authentication
    13.8.51: Variables for MOUSE_KEY actions
    13.8.52: Variable ONKEY?1/ONKEY?2: Code of keys during ONKEY
    13.8.53: Variable ONSEND_DATA: Data from ONSEND
    13.8.54: Variable ORIGINAL_HOSTNAME: Initial hostname and user
    13.8.55: Variable ORIGINAL_USER: Initial user name
    13.8.56: Variable PID: Process-ID of the current script or thread
    13.8.57: Variable PPID: Parent process-ID
    13.8.58: Variable PROTOCOL: Protocol used for the current session
    13.8.59: Variable PROTOCOL_SESSION: Session level protocol
    13.8.60: Variable ROWS: Number of rows of current session
    13.8.61: Variable SSH_GSSAPI_SERVER: Server principal name
    13.8.62: Variable SSH_GSSAPI_USER: User principal name
    13.8.63: Variable SSH_FURTHER_AUTH_REQ: Special login detected
    13.8.64: Variable SSH_LOGIN_ACCEPT: SSH login name
    13.8.65: Variable SSH_PAGEANT_ACCEPT: Pageant was used
    13.8.66: Variable SSH_PROTOCOL_LEVEL: SSH2 or SSH1
    13.8.67: Variable STATUSTXT: Status line comment
    13.8.68: Variable URLUSER: Default user for passed URL sessions
    13.8.69: Variable USER: User name to use for login
    13.8.70: Variable WAIT_IN: Matched character after a WAIT IN
    13.8.71: Variable WAITPID: PID of terminated thread
    13.8.72: Variable WAIT_VARIABLE: Name of assigned variable in WAIT
    13.8.73: Variable ZMODEM_AUTO: Current state of ZMODEM_AUTO flag
  13.9: SCRIPT statements
    13.9.1: BATCHMODE (non-interactive session indicator)
    13.9.2: BEEP (Perform the BELL function)
    13.9.3: BREAK (Break from a loop)
    13.9.4: CALL Script [params] (Function call to a script)
    13.9.5: CANCEL (Allow script to be cancelled yes/no)
    13.9.6: CAPTURE (capture received characters into variable)
    13.9.7: CLS (Clear the screen)
    13.9.8: COMMENTIGNORE (Ignore N attempts to set comment)
    13.9.9: CONTINUE (Start a new iteration of a loop)
    13.9.10: CSET (Create LOCAL variable dynamically)
    13.9.11: DELSCRIPT (Delete a script from memory)
    13.9.12: DESCRIBE (Describe purpose of the script)
    13.9.13: DELAY_APPLY (delay before applying configuration changes)
    13.9.14: DETACH (Detach a process from a terminal session)
    13.9.15: DIALOG (GUI dialogs in scripts)
    13.9.16: DISPLAY (Enable display of receive characters yes/no)
    13.9.17: DISPLAYLENGTH (Count number of UTF-characters in string)
    13.9.18: DO/UNTIL loop.
    13.9.19: DRAWBOX (Draw a box on the screen)
    13.9.20: ECHO (Display a string on the session screen).
    13.9.21: ENDSESSION (Abort current session)
    13.9.22: EXIT (Ends IVT)
    13.9.23: FOR/NEXT (For loop BASIC style)
    13.9.24: FORALL (Loop through hashes, arrays and variables)
      13.9.24.1: FORALL (Loop through existing variables, new syntax)
      13.9.24.2: FORALL (Loop through existing variables, old syntax)
      13.9.24.3: Syntax for iterating through a hash
      13.9.24.4: Syntax for iterating through an array
    13.9.25: FOREVER/NEXT (Infinite loop)
    13.9.26: GLOBAL (Change a global IVT.RC setting)
    13.9.27: GOTO (Jump to a label unconditionally)
    13.9.28: GOTO_OPT (Optional GOTO)
    13.9.29: GSET (Set global variable)
    13.9.30: GPSET (Set global PUBLIC package variable)
    13.9.31: HELP (Provide help from within a Script)
    13.9.32: HIDE (Hide a script from the F4-X screen)
    13.9.33: IF (Conditional statement)
    13.9.34: IGNCHILDREN (Ignore exit of child processes)
    13.9.35: IGNORE_ESCAPE (Ignore the next ESCAPE sequence)
    13.9.36: KEYBOARD (Enable/disable keyboard)
    13.9.37: KILL (Kill an IVT script process)
    13.9.38: LABEL (Define a target for IF/GOTO/WAIT etc)
    13.9.39: LOCAL (Declare a variable to be LOCAL)
    13.9.40: LPSET (Set a local/session PUBLIC variable)
    13.9.41: LSET (Set a local/session variable)
    13.9.42: MENU (configure menus on the menu bar)
    13.9.43: MENUTAB (configure context menus on the tabs)
    13.9.44: NEXT (End of a FOR/FORALL/FOREVER/WHILE)
    13.9.45: ONKEY (Jump to label when key is pressed)
    13.9.46: ONSEND (jump to label when data is about to be sent)
    13.9.47: PAUSE (Block, wait for interrupt)
    13.9.48: POPUP (Display popup, get result)
    13.9.49: RETURN (Return from a CALL statement)
    13.9.50: PUSHBACK (Push back data for a WAIT)
    13.9.51: SCRIPTDEBUG (Print script debugging into a file)
    13.9.52: SCOPE (Explicit scoping of variables)
    13.9.53: SECRET (Run script without status indicator)
    13.9.54: SEND (Send data on a session)
    13.9.55: SEND_KEYB (Send simulated keyboard data)
    13.9.56: SENDNULL (Send 1 or more NULL characters)
    13.9.57: SETDTR (Toggle serial DTR line (forces hang-up))
    13.9.58: SETPOS (Position cursor)
    13.9.59: SHAREMODE (Allow multiple script invocations yes/no)
    13.9.60: SLEEP (Suspend current script N seconds)
    13.9.61: STATUSHOST (Show string in status line)
    13.9.62: STATUSTXT (Show temporary comment in status line)
    13.9.63: STATUSTXTFIX (Show fixed comment in status line)
    13.9.64: SWITCHTO (Make a session the foreground one)
    13.9.65: TIMEOUT (Jump to label after N milliseconds)
    13.9.66: TRAP (Catch signals from KILL)
    13.9.67: UNSET (Delete variables)
    13.9.68: USLEEP (Wait for a specified number of milliseconds)
    13.9.69: VOLATILE (Mark IVT.RC changes as temporary)
    13.9.70: VTECHO (Send strings through VT220 engine)
    13.9.71: WAIT (Wait for several things simultaneously)
    13.9.72: WAITCARRIER (Wait for serial carrier state)
    13.9.73: WAITIDLE (wait for receive/transmit buffers to empty)
    13.9.74: WHILE/NEXT (Basic style loop)
    13.9.75: WINDOW (Create and manipulate text windows)
    13.9.76: WIN_MINIMIZE/MAXIMIZE/SHOW (Min-/maximize/show window)
    13.9.77: YIELD (Voluntarily give up the CPU)
  13.10: All function calls of the SCRIPT language
    13.10.1: ABS (Absolute numerical value)
    13.10.2: BROWSEFILE (Use Windows file selection dialog)
    13.10.3: BROWSEFOLDER (Use Windows folder selection dialog)
    13.10.4: CALL (Call a function that returns a value)
    13.10.5: CALLEDBY (Stack backtrace function)
    13.10.6: CLOSE (Close a file)
    13.10.7: CHDIR (Change directory)
    13.10.8: CHOOSECOLOR (Pick a color using a GUI dialog)
    13.10.9: COLORATTRIBUTE (Color code in a DIALOG)
    13.10.10: COMMANDOUTPUT (Run a command, capture output)
    13.10.11: COMPUTE (Perform simple calculations)
    13.10.12: CONCAT (Concatenate expressions into a string)
    13.10.13: COPYHASH (Copy (parts of) hashes)
    13.10.14: COPYFILE (Copy a file)
    13.10.15: COUNTCHARS (Count occurrences of characters in a string)
    13.10.16: CREAT (Create a file)
    13.10.17: CRYPTFL (Crypt a file)
    13.10.18: CRYPTFLPWD (Set the password to encrypt a specific file)
    13.10.19: CRYPTSTRING/DECRYPTSTRING (Crypt/decrypt strings)
    13.10.20: CURSOR_COL/CURSOR_ROW (Current cursor position)
    13.10.21: DECRYPTFL (Decrypt a file)
    13.10.22: DEFINED (Check for existence of a SCRIPT by name)
    13.10.23: DELHASH (Delete parts of hash)
    13.10.24: DIALOGADDEVENT (Generate a GUI dialog event)
    13.10.25: DIALOGEND (End a GUI dialog)
    13.10.26: DIALOGEVENT (Query user actions on GUI dialogs)
    13.10.27: DIALOGQUERY (Query state of GUI controls)
    13.10.28: DIALOGSORTCOLUMN (Sort a column of a LISTVIEW)
    13.10.29: ERROR (Invoke the standard error function)
    13.10.30: EXISTS (Test if a file or directory exists)
    13.10.31: EXPAND (Reference variables indirectly)
    13.10.32: GETFILESIZE (obtain the size of a file)
    13.10.33: FFLUSH (Flush buffer of an open file)
    13.10.34: ISDIR (Determine if something is a directory)
    13.10.35: NLS (Translate national language in scripts)
    13.10.36: FGSESSID (Foreground session ID)
    13.10.37: FILE_SEND/RECEIVE (X/Y/Zmodem/ASCII File transfer)
    13.10.38: FINDFILES (search for Windows files and directories)
    13.10.39: FINDPATH (Search PATH for a file)
    13.10.40: FLASHWINDOW (Flash the IVT window or button)
    13.10.41: FULLSCR (full screen control)
    13.10.42: FORK (Create a session from a SCRIPT)
    13.10.43: FROMASCII (Translate from ASCII to numeric)
    13.10.44: GETCLIPBOARD (Get contents of clipboard)
    13.10.45: GETCURDIR (Get current directory)
    13.10.46: GETFULLNAME (Get full path name of a file)
    13.10.47: GETLONGNAME (Get long name from an 8.3 file name)
    13.10.48: GETPAGERPOSITION (Get current scroll back position)
    13.10.49: GETSHORTNAME (Get 8.3 name of a long file name)
    13.10.50: GETTABTEXT (get text of the current tab)
    13.10.51: GETUSERNAME (Get Windows login name)
    13.10.52: GETVALUE (get value of variable in a STRICT environment)
    13.10.53: HOLDSESSION (block session)
    13.10.54: HUMANSIZE (Translate number to readable human format)
    13.10.55: IdentifierAs (How to interpret an identifier)
    13.10.56: IgnoreActivity (Suppress activity indicators)
    13.10.57: INSTR (Find characters in a string)
    13.10.58: IVTEVAL (Execute a dynamic script)
    13.10.59: IVTFUNCTION (Execute internal IVT function)
    13.10.60: JOIN (Combine members of an array)
    13.10.61: KRB5_ENCRYPT (Manage Kerberos encryption)
    13.10.62: LEFTSTR (Left-hand part of a string)
    13.10.63: LENGTH (Length of a string)
    13.10.64: LOWER (Translate string to lower case)
    13.10.65: LSEEK (Position in an open file)
    13.10.66: LTRIM/LTRIM/TRIM (Trim whitespace on left, right or both)
    13.10.67: MATCH (Wildcard string matching)
    13.10.68: MKDIR (Create a directory)
    13.10.69: MYERRORCOUNT (Return number of errors so far)
    13.10.70: MYSESSID (Return unique ID for this session)
    13.10.71: MYSESSNR (Return session number of current session)
    13.10.72: MYPACKAGE (Return name of containing package)
    13.10.73: NAMEOF (Determine real name of BYREFERENCE object)
    13.10.74: NRSESSIONS (Returns current number of sessions)
    13.10.75: OPEN (Open a file)
    13.10.76: PLAYSOUND (Plays a sound file)
    13.10.77: PUTENV (Creates, modifies, or removes environment variables)
    13.10.78: POP (Remove members from an array)
    13.10.79: POPEN/PCLOSE: Process pipes
    13.10.80: POPEN2 (Control stdin and stdout of a process)
    13.10.81: PROMPT (Ask a question on the bottom line)
    13.10.82: PUSH (Add members to an array)
    13.10.83: QUERYSCRIPT (Test if a script is active)
    13.10.84: QUERYSETTING (Obtain current configuration values)
    13.10.85: RAND (Generate a random value)
    13.10.86: READBYTE (read a single byte from a file)
    13.10.87: READLN (Read a line from a file)
    13.10.88: READHASH (Read a hash from a file)
    13.10.89: READRC (Read an IVT.RC file)
    13.10.90: REGCREATEKEY (Create a key in the Windows registry)
    13.10.91: REGDELETEKEY (Delete a value from Windows registry)
    13.10.92: REGDELETEVALUE (Delete a value from Windows registry)
    13.10.93: REGMATCH (Match regular expressions)
    13.10.94: REGQUERYENUM (Enumerate Windows registry keys)
    13.10.95: REGQUERYDWORD (Query Windows registry for an integer)
    13.10.96: REGQUERYSTR (Query Windows registry for a string)
    13.10.97: REGSETVALUEDWORD (Write an integer to the Windows registry)
    13.10.98: REGSETVALUESTR (Write a string to the Windows registry)
    13.10.99: RENAME (Rename a file or directory)
    13.10.100: REMOVE (Remove a file)
    13.10.101: RESOLVENAME (Translate name into an IP address)
    13.10.102: RESOLVENAME_EX (Translate name into IP addresses)
    13.10.103: REPLACE (Substitute occurrences of a string in a string)
    13.10.104: RIGHTSTR (Right-hand part of a string)
    13.10.105: RMDIR (Remove a directory)
    13.10.106: RUBOUT (Erase contents of variable at delete-time)
    13.10.107: SAVEHASH (Save (parts of) a hash to a file)
    13.10.108: SCREENATTR/SCREENTXT (Contents of screen buffer)
    13.10.109: SCROLLBACKLINES (Number of lines in scroll back buffer)
    13.10.110: SETICON (Change icon for the session)
    13.10.111: SETTABCOLORS (Set colors of the session Tab)
    13.10.112: SETPAGERPOSITION (Activate pager in a given position)
    13.10.113: SETTABTEXT (Set text in TAB for this session)
    13.10.114: SETTABICON (Set icon in TAB for this session)
    13.10.115: SHELLEXECUTE (Run a Windows command)
    13.10.116: SNDMSG (Sends a datagram to an IP-address and port)
    13.10.117: SOPEN (Shared open of a file)
    13.10.118: SPLIT (split a string using separator characters)
    13.10.119: SPRINTF (Format a string)
    13.10.120: SQRT (Square root)
    13.10.121: STAT (Status/attributes of a file)
    13.10.122: SUBSTITUTE (regular expression based string replacement)
    13.10.123: SUBSTR (Take part of a string)
    13.10.124: SRAND (Seed the random number generator)
    13.10.125: STRICMP (Case insensitive string compare)
    13.10.126: STRPTIME (Convert data/time string to numbers)
    13.10.127: STRSTR (Find a string in another string)
    13.10.128: SYSTEM (Run a command on the PC)
    13.10.129: THREAD (Start an asynchronous thread)
    13.10.130: TIME (Get current date/time in various formats)
    13.10.131: TOASCII (Translate from numeric to ASCII)
    13.10.132: TOTRAY (Minimize IVT to tray)
    13.10.133: TYPEOF (Determine type of a variable or part of a hash)
    13.10.134: UNLINK (Remove a file)
    13.10.135: UPPER (Translate to upper case)
    13.10.136: VARDEF (Test if a variable exists yes/no)
    13.10.137: VLINES (Query/change VERTICAL_LINES on session)
    13.10.138: WAIT_ONCONNECT (Wait for an ONCONNECT to finish)
    13.10.139: WAITTHREAD (Wait for a thread to exit)
    13.10.140: WRITE (Write to a file)
    13.10.141: WINDOW_ATTR (Query attributes of a WINDOW)
    13.10.142: WINEXISTS (Test status of a WINDOW handle)

14: X/Y/Zmodem file transfer

15: Kerberos V5 authentication/encryption
  15.1: Introduction to Kerberos
  15.2: Install and configure Kerberos on your PC
  15.3: Kerberos ticket forwarding
  15.4: Kerberos based encryption/decryption
  15.5: Kerberos & SSH licence

16: IVT Escape sequences
  16.1: Standard VT220 sequences in IVT
    16.1.1: IVT Control codes
    16.1.2: VT220 8-bit control codes
    16.1.3: VT220 escape sequences
    16.1.4: VT220 CSI sequences
    16.1.5: IVT VT420 extensions
  16.2: IVT-only special escape sequences
  16.3: VT52 mode
  16.4: IVT XTERM escape sequence support
  16.5: SCO ANSI compatibility mode

17: What the users say...
  17.1: Anonymous (January 2013)
  17.2: Seij Larsen (June 2012)
  17.3: Editors review at www.fiberdownload.com.
  17.4: Peter Hartland (May 1, 2011)
  17.5: Win7Dwnld site (September 2011)
  17.6: Rob Lowe, Creative Impulse Limited, March, 2011.
  17.7: Laszlo Magyar (February, 2011)
  17.8: Olli Laukkanen, August 27, 2009.
  17.9: Sam Ferencik, March 3, 2009.
  17.10: Brown, Mason - (Turner) [mbrown@tcco.com], May 10, 2006.
  17.11: John Wilkins [jdw242b@yahoo.com], April 19, 2006.
  17.12: Alan Lodge, October 13, 2005.
  17.13: John [hulleyj@hotmail.com], August 19, 2005.
  17.14: Bhatt, Avinash, August 17, 2005.
  17.15: Bill Wire, June 23, 2005.
  17.16: John Hulley [hulleyj@hotmail.com], May 5, 2005.
  17.17: Chris Barr [Chris.Barr@marketmax.com], March 1, 2005.
  17.18: Ruud Hanegraaf [r.hanegraaf@laurus.nl], February 28, 2005.
  17.19: Frans Geerts, March, 2005.
  17.20: Jan Bymark [Jaby@Q8.DK], February 9, 2005.
  17.21: Colin Raven [duiker@haggis.nl], December 18, 2004.
  17.22: Toby Titone [otobyt@iastate.edu], December 7, 2004.
  17.23: Alain Hache [ahache@mail.mobistar.be], August 19, 2004
  17.24: Arthur Yeung [arthuryeung198@hotmail.com], August 5, 2004.
  17.25: Stephen Dennis [stephen@digital-knowledge.com.au], July 30, 2004.
  17.26: Jonas Martinsson [jonas.martinsson@ecitele.com], July 29, 2004.
  17.27: Fernando Toledo, July 20, 2004.
  17.28: Daniel Cioconea [daniel_cioconea@yahoo.com], April 23, 2004.
  17.29: Peter Ottis [pottis@shaw.ca] April 16, 2004.
  17.30: Peter Kaplan [pkaplan@navis.com], September 13, 2003.
  17.31: Peter Klar [pklar@robert-schulz.de], September 7, 2003.
  17.32: Marcello.Missagia@comune.treviso.it, September 2, 2003.
  17.33: Mondragon, Todd [ToddMondragon@ca.slr.com], August 22, 2003
  17.34: Gerald Newell, Quality Manager, July 30, 2003.
  17.35: Kramer, Monte [MKramer@guaranty-bank.com], July 3, 2003.
  17.36: Sotiris Papageorgiou [Sotiris.Papageorgiou@bodyline.gr], July 8, 2003.
  17.37: Andy Verbunt [andy@nexar.be], July 3, 2003.
  17.38: Peter Klar [p.klar@robert-schulz.de], June 10, 2003.
  17.39: Paul Yeh [ppyeh@yahoo.com], May 29, 2003.
  17.40: Julian, march 31, 2003.
  17.41: Alejandro Dinamarca [Alejandro.Dinamarca@py.cl], February 14, 2003.
  17.42: Andries Venter <andries@sun.ac.za>, November 6, 2002.
  17.43: Langdon, Andy [andrew.langdon@eds.com], October 2, 2002.
  17.44: Ben Lees [ben.lees@mps.com.au], June 20, 2002.
  17.45: Aleksandar Stapar [astapar@gmx.co.uk], June 10, 2002.
  17.46: Warren Humphreys [Warren.Humphreys@EVGL.com], February 19, 2002.
  17.47: Rimmi Juha [Juha.Rimmi@elsacom.com], March 8, 2002.
  17.48: Frank Schmautz [schmautz@hotmail.com], November 4, 2001.
  17.49: Javier Laiz, Telefonica Sistemas [jlaiz@ts.es], October 2, 2001.
  17.50: Dagoss@ra.rockwell.com, May 2, 2000.
  17.51: Oscar Aviles [oscar.aviles@usa.net], Apr 28, 2000.
  17.52: Tom Maes [tom.maes@expandedmedia.be], July 28, 2000.
  17.53: Ellis Pritchard, ellis@nuke.dircon.co.uk.
  17.54: Oscar Rodriguez, Madrid, Spain [orod@bigfoot.com], May 13, 2001.
  17.55: Darian Sharp [kafiend@cyberspace.org], May 19, 2000.
  17.56: Juan Lupion [juan@lupion.com], Telefonica, Spain, Oct 26, 2000.
  17.57: Kiril Karagiozov [Kiril@web.de], Nov 26, 2000.
  17.58: Larry Kahler [larry.kahler@bull.com], May 25, 2000.
  17.59: Benedikt Hochstrasser [bhoc@pentagroup.ch], Feb 17, 2000.
  17.60: Chris Johnsen [chris_johnsen@yahoo.com], Apr 13, 2000.
  17.61: Gert Leerdam [Gert.Leerdam@getronics.com].
  17.62: Goocher [goocher@goocher.com], Sept 12, 2000.
  17.63: Alexander McKenna [alex@alexmckenna.com], March 25, 2000.
  17.64: philippe.beillas@free.fr, June 9, 2000.
  17.65: Jose De Leon, of InVision DSL, Sept 15, 2000.
  17.66: Preston, Chris (CCI-San Diego) [Chris.Preston@cox.com].
  17.67: Tad Marko [tad@earthling.net] Dec 13, 1999.
  17.68: Todd Peterson [tpeter@mcs.net], Oct 31, 1999.
  17.69: Garry P. Cramins [gcramins@cramins.net] Feb 4, 2001.
  17.70: Philippe, philippe.beillas@free.fr.
  17.71: Paolo Ciceroni [jclksh70@yahoo.com], Jan 9,2001.
  17.72: Benjamin T. White, MD [bewhite@wfubmc.edu], Sept 18, 1999.
  17.73: Carlos Jorge dos Santos Sousa [greenisleazores@netc.pt], Oct 21, 1999.
  17.74: Magnus Hjorth [magnus.hjorth@home.se].
  17.75: Tommy Sundling [tommy.sundling@ams.amv.se]
  17.76: jp [dabman@home.se].

18: PWDLEARN.IVT: The password learning & autologin system
  18.1: Introduction
  18.2: Password learning: Security
  18.3: Password learning: Configuration
    18.3.1: Enable/disable auto-login
    18.3.2: Enable/disable password learning
    18.3.3: Enable/disable help window
    18.3.4: Disable/Enable learning for current host
    18.3.5: Store passwords on disk
    18.3.6: Auto-login meta system
    18.3.7: Set/alter password on database
    18.3.8: Delete selected users from database
    18.3.9: Add users/passwords manually
    18.3.10: Fine-tune the learning system
    18.3.11: Change default user for this host
  18.4: Password learning: Using IvtLogMeIn in your own scripts
  18.5: Password learning: Hooks in the IvtLogMeIn system
    18.5.1: Hooks: The IvtWaitLoggedIn function
    18.5.2: Hooks: The PwdAddLoginScript function
    18.5.3: Hooks: The PwdAddFindScript function
    18.5.4: Hooks: The IvtLogMeInWait variable
    18.5.5: Hooks: The IvtPwdCfgAutoLogin variable
    18.5.6: Hooks: The IvtPwdCfgLearn variable
    18.5.7: Hooks: The IvtPwdAlwaysSendUser variable
    18.5.8: Hooks: The IvtPwdSkipMetaSearch variable
    18.5.9: Hooks: The IvtPwdDebug variable
    18.5.10: Hooks: The IvtPwdLoginRS232 variable
    18.5.11: Hooks: The "TERM =" prompt handler
    18.5.12: Hooks: The custom login prompt variables
    18.5.13: Hooks: The IvtPwdCustomQuestion variable
    18.5.14: Hooks: Various look and feel variables

19: Thycotic: IVT plugin for integration with SecretServer
  19.1: Introduction
  19.2: Configuring the SecretServer plugin
  19.3: Integrating SecretServer with IVT address book

20: Support programs for IVT
  20.1: PRIVT: Print Unix files on any IVT printer
  20.2: socks4FW.c: Socks4 server, client and port forwarder
  20.3: TERMQUERY: Query a terminal from Unix
  20.4: EMU_TYPE: Determine type of emulator used at login-time
  20.5: CLICK.C: Mouse interface for Unix scripts!
  20.6: LOGINC: IVT Challenge/Response protocol client for Unix
  20.7: KEYP: Program your (IVT/VT220) keys from Unix
  20.8: IVTUPGRADE: Automatically upgrade an IVT installation

21: List of startup tips

22: Examples
  22.1: Introduction to examples
  22.2: Script to replace numbers on screen by human-readable versions
  22.3: Manipulate the registry in scripts
  22.4: Script to read line from keyboard.
  22.5: Waiting for any sort of prompt
  22.6: Sending files via escape sequences from PC to host
  22.7: A custom SCREENSAVE script
  22.8: Logging in to a host automatically
    22.8.1: General technical design
    22.8.2: Snooping the user-id and password when you login
    22.8.3: Storing passwords in an encrypted file
    22.8.4: Managing the popup windows that document what is going on
    22.8.5: managing a complex dialog (the password maintenance menu)
  22.9: Script to maintain common passwords (shared between users)
  22.10: Script to provide a context menu per host
    22.10.1: The TRIX project file
    22.10.2: The ITShop project file
    22.10.3: A script to parse the $HOSTLIST_EXTRA information
    22.10.4: A script to handle the MENU=XXX EXTRA clause
  22.11: Script to program the Unix PS1 prompt
  22.12: Script to hop from one system to another.
  22.13: Script to broadcast what you type to all sessions
  22.14: Script to process an arbitrary hash
  22.15: Managing projects
  22.16: Increasing/decreasing the current font
  22.17: ALT-Click on text, start URL
  22.18: Script to dial out through modems
  22.19: Keyboard watcher that translates what you type
  22.20: Automatically set a proxy for some hosts and not others
  22.21: Keeping a session alive
  22.22: Intercepting 'Shell will timeout'
  22.23: Dropping files on the IVT Window
  22.24: Extending the escape sequence command set of IVT
  22.25: Real-life example of programming a microprocessor board
  22.26: Testing IVT with VTTEST, or use it with VAX-VMS

23: History of changes and updates to IVT
  23.1: Version 27.0 (21/03/2024 - 25/01/2025) Build 47950
  23.2: Version 26.8 (16/1/2022 - 21/03/2024) Build 47408
  23.3: Version 26.7 (08/3/2020 - 09/01/2022) Build 45898
  23.4: Version 26.6 (08/10/2019 - 08/03/2020) Build 44331
  23.5: Version 26.5 (11/02/2019 - 08/10/2019) Build 43762
  23.6: Version 26.4 (05/12/2018 - 10/02/2019) Build 42319
  23.7: Version 26.3 (12/10/2018 - 11/12/2018) Build 41963
  23.8: Version 26.2 (26/09/2018 - 06/10/2018) Build 41757
  23.9: Version 26.1 (13/10/2017 - 25/09/2018) Build 41727
  23.10: Version 26.0 (09/06/2017 - 13/10/2017) Build 39809
  23.11: Version 25.3 (09/04/2016 - 09/06/2017) Build 39099
  23.12: Version 25.2a (01/12/2016 - 09/04/2017) Build 38715
  23.13: Version 25.2 (04/07/2016 - 09/10/2016) Build 38361
  23.14: Version 25.1 (01/01/2016 - 04/07/2016) Build 37531
  23.15: Version 25.0 (25/08/2015 - 01/01/2016) Build 36582
  23.16: Version 24.0d (07/07/2015 - 25/08/2015) Build 35525
  23.17: Version 24.0c (22/02/2015 - 07/07/2015) Build 35251
  23.18: Version 24.0b (09/02/2015 - 22/02/2015) Build 34785
  23.19: Version 24.0a (05/01/2015 - 09/02/2015) Build 34730
  23.20: Version 24.0 (28/01/2014 - 17/12/2014) Build 34651
  23.21: Version 23.3a (25/11/2013 - 28/01/2014) Build 33066
  23.22: Version 23.3 (12/06/2013 - 25/11/2013) Build 32950
  23.23: Version 23.2 (25/01/2013 - 12/06/2013) Build 32404
  23.24: Version 23.1b (08/08/2012 - 25/01/2013) Build 31675
  23.25: Version 23.1a (04/04/2012 - 08/08/2012) Build 31320
  23.26: Version 23.1 (25/05/2011 - 04/04/2012) Build 30833
  23.27: Version 23.0a (25/05/2011 - 18/01/2012) Build 30255
  23.28: Version 23.0 (1/12/2010 - 17/04/2011) Build 29957
  23.29: Version 22.3a (20/10/2010 - 01/12/2010) Build 29225
  23.30: Version 22.3 (18/06/2010 - 08/10/2010) Build 29130
  23.31: Version 22.2a (12/03/2010 - 18/06/2010) Build 29020
  23.32: Version 22.2 (27/01/2010 - 12/03/2010) Build 28765
  23.33: Version 22.1b (18/11/2009 - 27/01/2010) Build 28538
  23.34: Version 22.1a (23/08/2009 - 18/11/2009) Build 28239
  23.35: Version 22.1 (14/08/2009 - 23/08/2009) Build 27594
  23.36: Version 22.0b (17/04/2009 - 13/08/2009) Build 27576
  23.37: Version 22.0a (18/02/2009 - 17/04/2009) Build 27050
  23.38: Version 22.0 (5/05/2008 - 18/02/2009) Build 26482
  23.39: Version 21.2a (1/02/2008 - 13/02/2008) Build 24826
  23.40: Version 21.2 (20/01/2008 - 27/01/2008) Build 24807
  23.41: Version 21.1c (20/08/2007 - 20/01/2008) Build 24774
  23.42: Version 21.1b (20/08/2007 - 05/10/2007) Build 23760
  23.43: Version 21.1a (12/04/2007 - 20/08/2007) Build 23551
  23.44: Version 21.1 (09/02/2007 - 12/04/2007) Build 22768
  23.45: Version 21.0 (10/12/2006 - 09/02/2007) Build 22397
  23.46: Version 20.2a (10/12/2006 - 02/01/2007) Build 21922
  23.47: Version 20.2 (10/12/2006 - 21/12/2006) Build 21730
  23.48: Version 20.1e (24/10/2006 - 10/12/2006) Build 21575
  23.49: Version 20.1d (08/09/2006 - 23/10/2006) Build 21100
  23.50: Version 20.1c (30/05/2006 - 07/09/2006) Build 20810
  23.51: Version 20.1b (23/04/2006 - 30/05/2006) Build 20552
  23.52: Version 20.1a (23/04/2006 - 25/04/2006) Build 20053
  23.53: Version 20.1 (22/03/2006 - 23/04/2006) Build 20039
  23.54: Version 20.0 (27/11/2005 - 22/03/2006) Build 19661
  23.55: Version 19.1 (14/10/2005 - 27/11/2005) Build 18121
  23.56: Version 19.0c (23/06/2005 - 14/10/2005) Build 17616
  23.57: Version 19.0b (30/05/2005 - 23/06/2005) Build 17152
  23.58: Version 19.0a (12/05/2005 - 30/05/2005) Build 17075
  23.59: Version 19.0 (12/11/2004 - 12/05/2005) Build 17005
  23.60: Version 18.1b (12/11/2004 - 01/01/2005) Build 16224
  23.61: Version 18.1a (13/10/2004 - 31/10/2004) Build 15997
  23.62: Version 18.1 (13/08/2004 - 13/10/2004) Build 15775
  23.63: Version 18.0b (4/06/2004 - 13/08/2004) Build 15336
  23.64: Version 18.0a (25/05/2004 - 03/06/2004) Build 15150
  23.65: Version 18.0 (30/01/2004 - 23/05/2004) Build 15133
  23.66: Version 17.0e (30/01/2004 - 16/03/2004) Build 14337
  23.67: Version 17.0d (25/11/2003 - 30/01/2004) Build 13552
  23.68: Version 17.0c (19/10/2003 - 23/11/2003) Build 13449
  23.69: Version 17.0b (25/09/2003 - 19/10/2003) Build 13216
  23.70: Version 17.0a (10/09/2003 - 25/09/2003) Build 13132
  23.71: Version 17.0 (3/8/2003 - 10/09/2003) Build 13039
  23.72: Version 16.4c (18/5/2003 - 3/08/2003) Build 12592
  23.73: Version 16.4b (14/4/2003 - 18/05/2003) Build 12142
  23.74: Version 16.4a (8/4/2003 - 13/04/2003) Build 11998
  23.75: Version 16.4 (3/2/2003 - 08/04/2003) Build 11942
  23.76: Version 16.3a (29/11/2002 - 03/02/2003) Build 11697
  23.77: Version 16.2d (12/11/2002 - 29/11/2002) Build 10821
  23.78: Version 16.2c (04/11/2002 - 11/11/2002) Build 10670
  23.79: Version 16.2b (25/10/2002 - 04/11/2002) Build 10156
  23.80: Version 16.2a (18/10/2002 - 25/10/2002)
  23.81: Version 16.2 (06/09/2002 - 18/10/2002)
  23.82: Version 16.1a (08/08/2002 - 06/09/2002)
  23.83: Version 16.1 (04/07/2002 - 22/07/2002)
  23.84: Version 16.0a (24/05/2002 - 04/07/2002)
  23.85: Version 16.0 (22/05/2002 - 24/05/2002)
  23.86: Version 15.0e (02/04/2002 - 22/05/2002)
  23.87: Version 15.0d (19/03/2002 - 02/04/2002)
  23.88: Version 15.0c (26/02/2002 - 17/03/2002)
  23.89: Version 15.0b (20/02/2002 - 25/02/2002)
  23.90: Version 15.0a (12/02/2002 - 19/02/2002)
  23.91: Version 15.0 (19/01/2002 - 11/02/2002)
  23.92: Version 14.1e (22/12/2001 - 10/01/2002)
  23.93: Version 14.1d (22/11/2001 - 18/12/2001)
  23.94: Version 14.1c (18/10/2001 - 19/11/2001)
  23.95: Version 14.1b (11/8/2001 - 17/10/2001)
  23.96: Version 14.1a (19/6/2001 - 9/8/2001)
  23.97: Version 14.1 (13/4/2001 - 12/6/2001)
  23.98: Version 14.0 (13/4/2001 - 12/5/2001)
  23.99: Version 12.2f (7/3/2001 - 9/4/2001)
  23.100: Version 12.2e (5/2/2001 - 7/3/2001)
  23.101: Version 12.2d (29/12/2000 - 24/1/2001)
  23.102: Version 12.2c (13/11/2000)
  23.103: Version 12.2b (31/10/2000)
  23.104: Version 12.2/12.2a (18/8/2000 - 29/10/2000)
  23.105: Version 12.1 (4/7/2000 - 17/8/2000)
  23.106: Version 12.0e (24/5/2000 - 3/7/2000)
  23.107: Version 12.0d (27/4/2000 - 11/5/2000)
  23.108: Version 12.0c (2/3/2000 - 27/3/2000)
  23.109: Version 12.0b (2/3/2000 - 17/3/2000)
  23.110: Version 12.0a (23/2/2000 - 1/3/2000)
  23.111: Version 12.0 (11/1/2000)
  23.112: Version 11.3f (30/11/1999 - 11/01/2000)
  23.113: Version 11.3e (29/9/1999 - 28/11/1999)
  23.114: Version 11.3d (13/9/1999 - 25/9/1999)
  23.115: Version 11.3c (22/8/1999)
  23.116: Version 11.3b (9/8/1999)
  23.117: Version 11.3a (26/7/1999)
  23.118: Version 11.3 (22/6/1999)
  23.119: Version 11.2c (14/6/1999)
  23.120: Version 11.2b (26/5/1999)
  23.121: Version 11.2a (17/5/1999)
  23.122: Version 11.2 (12/5/1999)
  23.123: Version 11.1 (4/5/1999)
  23.124: Version 11.0 (19/4/1999 - 3/5/1999)
  23.125: Version 10.2b (12/4/1999)
  23.126: Version 10.2a (31/3/1999)

24: Under construction....

25: About IVT
    25.0.1: Compile options