Chapter 10
Automating Data Connections


MacComCenter Plus has several advanced features which can make your on-line communications sessions quicker and easier to manage by automating various functions.

MacComCenter Plus can quickly connect you to your accounts on some of the major on-line services. Before it can do this, however, you must set up MacComCenter Plus with the proper account information. When configured, you can connect to on-line services such as Dow Jones, CompuServe, and GEnie with a single click of the mouse.


Services Setup

The Services Setup dialog allows you to specify account information for the Dow Jones, CompuServe, and GEnie on-line services. Choosing Services from the Setup Menu opens the Services Setup dialog, which is where the actual account information is entered into MacComCenter Plus.

          [Services Setup]

Follow the appropriate section(s) for your on-line service account(s):

CompuServe If you will be calling CompuServe, use this section to enter your Account number and Password, and select the public network (Compunet, Telenet, or Tymnet) you want to access by entering the phone number and selecting the corresponding radio button.
Dow Jones If you will be calling Dow Jones, use this section to enter your Password and select the public network (Telenet or Tymnet) you want to access by entering the phone number.
GEnie If you will be calling GEnie, use this section to enter your User ID and Password. Do not enter the separating comma. Enter the telephone number needed to connect to GEnie in the GEnienet field.
       

Connecting to On-Line Services

                  [On-line Services]

Once the account information is entered, simply pull down the Data menu and select Run Script. Selecting the appropriate on-line service will automatically dial your modem, log you in, and enter your password. You can also select the desired on-line service from the Macros menu.


Macro Keys

The Macros Setup dialog allows you to define a custom meaning to the selection of command key combinations, Cmd-0 to Cmd-9. The Macros Setup dialog can be opened by selecting Macros... from the Setup menu. These macro keys can cause a user defined literal string to be transmitted or can be used to launch a script file. The macro key definitions are displayed on the Macros Setup dialog.

              [Macros Setup]

The ten text boxes on the Macros Setup dialog, allow you to enter the literal string you want transmitted when the selected command key combination is depressed, or to specify a script file name if you want a script file launched when the assigned keys are pressed. To assign a script file, select the Script check box and select the script file from the resulting file selection box. The text box may contain either a literal string or a script file name, but not both.


Scripts

Scripts are miniature programs within a program, and can totally automate your on-line sessions (for example, the on-line services modules are actually script files). Properly programmed, a script can call a BBS, log-on to it and automatically read your mail.

Running Scripts

The option under the Data menu allows you to have MacComCenter Plus execute a script file that has been created and stored on disk.

Selecting a Script File

After selecting the Run Script function, a file selection box will appear. Select the script you wish to run by double clicking the script file name when it appears in the file scroll box. The script will proceed to run. When a script is running, a message will be displayed in the status area of the Terminal Status Bar. You may abort script execution by pressing Cmd-. (Command - period).


MacComCenter Plus Script Language

The MacComCenter Plus script language is made up of commands that may be used to create a script file. A script file may be created using Simple Text.

The commands that comprise the script language may be entered in either upper or lower case. Each line of the script may contain only one command. The commands may be indented to any point you wish to enhance readability. Blank lines may also be inserted in the script files to show breaks in sections of the script statements.

You may include comments in the script file by starting the comment with "/*" and ending the comment with "*/". For example:

/* This is a sample comment */

When sending strings to a remote computer, a string may be defined to include a literal value, a carriage return character or an ASCII character represented by its decimal value. Literal character strings must be enclosed by double quotes. A return character is defined by including a '\r' in the command line. An ASCII character is defined by including a '\xHH' in the command line, where HH is the hexadecimal value of the ASCII character. For example, to send a Control-C to a remote computer the literal string would be:

Out("\x03");

The script must begin with the "main( )" function. This is the function that is first called during execution. It must be followed by an open curly brace "{" and the function must end in a closed curly brace "}". The actual script commands go in the lines between the curly braces and are followed by semicolons ";". A simple script file would look something like this:

/* Sample Script 1 */
main( )
{
    Script Command Line 1;
    Script Command Line 2;
}

Writing a Sample Script File

The best way to learn is by doing, so let's create a script which will automate logging in to Smith Micro Software's American E-Mail BBS. (This script assumes that you already have an account. If you don't, call American E-Mail to set one up, taking note of your User ID and password.)

When writing a script, thought should be given to the steps you would like the script to perform. In the case of logging into the American E-Mail BBS, a script must do the following:

  1. Dial the telephone number.
  2. Wait for the prompt to enter the User ID.
  3. Type out the User ID.
  4. Wait for the prompt to enter the password.
  5. Type out the password.
  6. Pass control to the keyboard to continue the on-line session.

The first two lines of the script should be:

main( )
{

You can put comments before this if you wish. Reviewing the list of commands, it can be seen that only three commands are needed in this script: Dial, In, and Out. The script must dial the American E-Mail BBS first, so the next line would be:

Dial("17143625822");

The actual script instructions may be typed with one tab stop before it in order to indent each line for easy reading later on.

Next, the script must wait for the User ID prompt, which is:

Otherwise type 'new':

It would also be nice if, after a certain amount of time with nothing happening while waiting for the prompt, the script would pass control back to the user. The In command can do all this, so the fourth line should be:

In("'new':",30);

This will wait for the prompt for 30 seconds before returning control to the keyboard.

After sensing the prompt, the script must type out the User ID, which calls for the Out command. The next script line should be:

Out("Your ID\r");

Your ID should be replaced with whatever the User ID of the account actually is. The \r tells the script to send out a carriage return, as if the Return key is pressed.

The prompt for the account password is:

Enter your password:

so the next line should be:

In("password:",30);

To type the password, the final script line should be:

Out("Your PW\r");

where Your PW is your actual account password.

To pass control back to the keyboard once the automation is finished, the last line should be a closing curly brace.

The script file should now look like this:

                  /*American E-Mail Script */
                  main()
                  {
                          Dial("17143625822");
                          In("'new':",30);
                          Out("Your ID\r");
                          In("password:",30);
                          Out("Your PW\r");
                  }

Save this file as an executable script with the file name "American E-Mail" in the MacComCenter v3 folder.    


Go to next Chapter

Return to the Contents page

Return to the top of Chapter 10