Delrina FreeComm 1.0 Scripting Manual Delrina FreeComm 1.0 1995, Delrina (Delaware) Corporation. All rights reserved. The use and copying of this product is subject to a license agreement. Any other use is prohibited. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system or translated into any language in any form by any means without the prior written consent of Delrina (Canada) Corporation. Information in this manual is subject to change without notice and does not represent a commitment on the part of the vendor. Federal copyright law permits you to make a backup of this software for archival purposes only. Any other duplication of this software, including copies offered through sale, loan, rental or gift is a violation of law, and subject to both criminal and civil penalties. Delrina (Canada) Corporation, as a member of the Software Publishers Association (SPA), supports the industry's effort to fight the illegal copying of personal computer software. Report copyright violations to: Software Publishers Association, 1101 Connecticut Avenue, NW, Suite 901, Washington, DC, U.S.A. 20036. Trademarks FreeComm is a trademark of Delrina (Wyoming) Limited Liability Company. WinComm PRO is a trademark of Delrina (Delaware) Corporation. FormFlow, PerForm, WinFax, DosFax, Delrina Fax and Delrina are trademarks of Delrina (Canada) Corporation. WinComm is a trademark of Delrina (Delaware) Corporation. Adobe and PostScript are registered trademarks of Adobe Systems, Inc. AT&T is a registered trademark of American Telephone and Telegraph Company Compaq is a registered trademark of Compaq Computer Corporation CompuServe is a registered trademark of CompuServe, Inc. dBASE and Paradox are trademarks of Borland International. DEC and VT, registered trademarks of Digital Equipment Corporation DESQView, registered trademark of Quarterdeck Office Systems Hayes, Smartmodem, and ESP, registered trademarks of Hayes Microcomputer Products, Inc. Hewlett-Packard, HP and LaserJet are registered trademarks, and Deskscan II is a copyright, of Hewlett-Packard Company. HyperPilot, HyperProtocol, HyperTerminal and HyperGuard are registered trademarks of Hilgraeve Inc. IBM, OS/2, PC AT and PC XT are registered trademarks, and DB2 is a trademark, of International Business Machines, Inc. Intel and SatisFAXtion are trademarks of Intel Corporation. Kermit, developed by Columbia University, is included at no additional charge. Microsoft, MS and MS-DOS are registered trademarks, and Windows is a trademark of Microsoft Corporation. Oracle and SQL*NET are registered trademarks, and Oracle Server and SQLPLUS are trademarks of Oracle Corp. Procomm and Procomm Plus are registered trademarks of Datastorm Technologies, Inc. TrueType is a registered trademark of Apple Computer, Inc. Type Director and Intellifont are registered trademarks of Agfa Corporation. All other product names are copyright, trademarks or tradenames of their respective owners. Delrina (Canada) Corporation Contents Chapter 1 =========== Editing or Writing Scripts 1.1 Introduction . . . . . . . . . . . . . . . .4 1.2 An overview of scripts . . . . . . . . . . .4 1.3 How to develop scripts in general. . . . . .5 1.4 How to examine, edit, or write a script. . .5 1.5 What to do when a script keeps stopping. . .6 1.6 Having a script type for you . . . . . . . .6 1.7 Keeping in step with a remote system . . . .7 1.8 Having scripts make decisions. . . . . . . .9 1.9 Taking alternate courses of action . . . . 10 1.10 Capturing text and printing with scripts . 10 1.11 Splicing two learned scripts together. . . 12 1.12 Transferring files with scripts . . . . . 13 1.13 Displaying local prompts or messages . . . 13 1.14 Prompting for keyboard input . . . . . . . 14 1.15 String, integer, and flag variables. . . . 15 1.16 Waiting for less predictable messages. . . 16 1.17 Comparing and dissecting strings . . . . . 17 1.18 Building strings . . . . . . . . . . . . . 18 1.19 Reading text from external files . . . . . 19 1.20 Writing text into external files . . . . . 20 1.21 Storing strings in the list. . . . . . . . 21 1.22 Passing inputs to scripts. . . . . . . . . 21 1.23 Using an escape key. . . . . . . . . . . . 22 1.24 Substituting your own error routine. . . . 22 Chapter 2 HyperPilot Functions. . . . . . . . . . . . . 23 1.1 Introduction ================== In the Delrina FreeComm User's Guide you learn how to create commands and scripts that handle routine, repetitive tasks that arise in communications. In this manual, you learn how to write scripts or edit learned ones, in order to automate many other aspects of communications. Here are some possible applications: þ Enhance learned scripts so that they vary their actions depending on events that occur during use þ Make scripts that can execute reliably even when you're not present, such as at night when phone rates are low þ Perform complex, custom functions beyond those provided by the FreeComm menus themselves þ Design your own custom menus to supplement the regular menus, or to eliminate the need to use regular menus Each script is a separate file that describes a process for Delrina FreeComm(tm) to perform. Scripts consist of word-like functions from the HyperPilot language, so they are relatively easy to read and understand. HyperPilot is the ideal tool for automating communications: Its functions can operate FreeComm, type characters to remote systems, wait for remote systems to respond, display prompts you've created, accept keyboard input, send files, receive files, manipulate files on your disks, and much more. An assortment of scripts is supplied with FreeComm; for a description of them, read the file SCRIPTS.DOC. You can use these scripts as is, edit them to suit your needs, or use them for reference when writing new scripts. Some of the FreeComm features use scripts. For example, the Call menu runs the CALL script when you place calls, and the Answer menu runs the ANSWER script. This manual explains the basic procedures for writing and editing scripts, and tells how to write routines to handle some of the more common needs and gives reference information on the HyperPilot language. This manual in conjunction with the Delrina FreeComm User's Guide will help you maximize the capabilities of FreeComm(tm). 1.2 An overview of scripts ============================= To help you decide how HyperPilot can best be applied to your needs, here is a quick overview of how scripts are run, how they are created, and the types of files involved. You can run scripts in these ways: þ The instant you connect with a system, the logon script you have listed for that system runs. þ You can run a script from anywhere in FreeComm by pressing the key to which it is assigned. þ You can run a script by pressing ALT-R and entering its name, and you can pass inputs to it as well. þ To run a script as you start FreeComm, enter DFC, a space, and the script name. As you do this, you can also pass inputs to the script. You can create scripts in these ways: þ Learn scripts while logging on to systems. þ Learn scripts by pressing ALT-L and performing the steps you want the script to learn. þ Write scripts using the Editor. þ Learn scripts and edit them, for increased power and versatility. About different kinds of script files: þ Each script is a file whose filename consists of its sequence name, plus an extension showing which type of script file it is. þ Scripts whose filenames have the HP extension (short for HyperPilot) are text files. When you write or edit scripts, this is the kind of script file you work with. þ Scripts whose filenames have the RDY extension (short for ReaDY) are encrypted binary files. When you run a script, it is the RDY file which is executed, not the HP file. þ After you learn, write, or edit a script, the resulting HP file is automatically compiled to create a RDY file with the same name, but with the RDY extension. þ After you finish developing a script and FreeComm has created the RDY file, you may remove the HP file to a backup disk; only the RDY file need be present to run the script. 1.3 How to develop scripts in general ======================================== Here is the general procedure for developing scripts: 1. Plan out what the script will do. (It's best to start with less ambitious applications.) 2. Familiarize yourself with the task the script will do. You need a clear grasp of each step the task involves, so practice doing manually any parts of the task that can be done by hand. 3. Write the script (or learn and edit it). 4. Let FreeComm compile the script. 5. Fix errors that display when compiling, and compile again. 6. Run the script. Check to see that it runs to completion and that it does what you intended. 7. Correct errors, compile, and run the script again. When automating a complex task, it is best to divide it into smaller tasks and write one part at a time. This section gives basic methods you are likely to need and the next gives important reference information. 1.4 How to examine, edit, or write a script ============================================== To examine, edit, or write a script, load the script into the Editor (or use an external editor). To do this, select "Edit a macro", "command" or "script" from the Keys menu and enter the script name without the extension. If you are creating a new script, you can enter a new name of up to 8 letters. You may find it convenient to copy functions from the list and paste them into your script. Note: Don't forget to substitute real arguments. Follow these guidelines for script construction (syntax): þ Each function is one or two words followed by parentheses. þ After each function are two, one, or no arguments in parentheses. When you use two arguments, separate them with a comma. Even when you use no arguments, include the parentheses. þ Substitute real arguments for the argument descriptions. Descriptions in quotes must be replaced with real arguments in quotes. Arguments in braces ({ and }) are optional and may be omitted. Arguments in uppercase are not to be replaced. þ For easier reading, indent all lines except those containing label names. Scripts are easier to understand if you include blank lines between groups of related lines. þ For clarity and reference, include plenty of comments (text to the right of a semicolon). Comments can be on the same line with functions (they must come after the functions) or on lines by themselves. þ Normally a script ends with the "end()" on a line by itself. When you exit the Editor after creating or changing a script, you are asked if you want the script compiled. It is generally best to answer "Yes". If you answer "No", the script compiles later, the first time you run it; compiling at run-time causes a delay which may make scripts that perform time-sensitive operations fail the first time you run them. Note: If "insufficient memory" displays during compiling, you can still compile from outside FreeComm. to do this, Quit FreeComm and at the DOS prompt enter DFCMP