Smith Micro Software Scripting in QuickLink II Fax for Windows/DOS Scripts are text files that allow you to automate data connections. With the scripting language provided in the OEM products, you typically would use it to automate the logon process only. However, you can also create simple scripts to help control the flow of data. Scripts are to be created in text editors only, such as Windows Notepad, DOS editor or the QuickLink Editor. In DOS and Windows, it's not necessary to save a script with a .SRP extension, but helps to use it for clarity. Scripts can be run by one of three ways: 1)Placing them in one of the Macro keys with the Script box checked 2)Pulling down the Connect menu and selecting Run Script 3)Using the data phone list to dial the number and including an associated script to continue the process after connection There are two basic scripting commands: the In statement and the Out statement. The In statement is used to suspend the script until you get to a particular prompt within the data connection. The Out statement is then used to output a given string in response to that prompt. As can be seen, most scripts will consist of a series of In and Out statements to control the logon sequence. Other script commands can be used to automate the settings for a session as well as to help control the flow. The syntax of the In Statement is: In "xxxx" n The xxxx is the last few characters of the prompt you're looking for while the n is the amount of time, in seconds, for the script to wait for the prompt. The syntax of the Out statement is: Out "xxxx" The xxxx is the string of characters to be sent to the remote location. You can use any character found on a standard keyboard as well as a Return (\r) and ASCII character. The ASCII characters are represented by their decimal equivalent and preceded by a backslash (\). For example, to send an Escape code, you would use \027. The ASCII character table is typically located at the back of our manuals. Below is a sample script that might log you on to a local BBS: CLS ;clears the terminal screen Echo "Sample script to log on to XYZ BBS" ;prints message ;to screen ;These are optional Baud "19200" ;sets the current baud rate Data "8" ;sets the current data bits Parity "N" ;sets the current parity Stop "1" ;sets the current stop bits LocalEcho "OFF" ;toggles Local Echo RtsCts "ON" ;toggles Rts/Cts flow control XonXoff "OFF" ;toggles Xon/Xoff flow control ;Main part of script Dial "xxx-xxxx" ;dials the given number In "=yes?" 20 ;waits 20 seconds for the string: =yes?. Out "y\r" ;outputs a y and a carriage return (\r) In "first name?" 20 ;waits 20 seconds for the string: first name? Out "John\r" ;outputs the proper response with a carriage return In "last name?" 20 ;waits 20 seconds for the string: last name? Out "Doe\r" ;etc... In "password?" 20 ;etc... Out "********\r" ;etc... End ;used to mark the end of a script, must use. ********************************************** You can also use the Wait command to have the script wait a given number of seconds before outputting a string. The following is a modification of the above script using Wait commands instead of In statements: ;Main part of script Dial "xxx-xxxx" ;In "=yes?" 20 Wait 5 Out "y\r" ;In "first name?" 20 Wait 5 Out "John\r" ;In "last name?" 20 Wait 5 Out "Doe\r" ;In "password?" 20 Wait 5 Out "********\r" End ********************************************** There's also another form of the In statement that can be useful that can be used to control the data connection past the login. The syntax for it is simply: In Instring. This process receives one character at a time and stores them into a variable called Instring up to a 40 character limit. You can then use an If/Goto statement to control whether to execute one part of a script or another. ;Main part of script Clearstring ;clears the variable Instring Dial "xxx-xxxx" In "=yes?" 20 Out "n\r" In "first name?" 20 Out "John\r" In Instring ;captures the next character (which should be a W) If Instring = "W" Goto Step1: ;if it's a W, script continues at Step1: below else Goto Step10: ;otherwise, the script continues at Step10: Step2: ;label for Goto statements In "password?" 20 Out "********\r" Step10: ;label for Goto statements... End ;ends script even though there's more text after it Step1: Wait 3 ;waits 3 seconds before going on to allow for prompt Out "Doe\r" Goto Step2: