Technical Support Contact Us   

Creating a Login Script


How to create a script to let PC Access for Windows log in to your MLS automatically. You should read this if the standard version of MAESTRO.SCR or MASTER.SCR does not work with your MLS. This document is also a good introduction to PC Access script language programming.


What is a script file?

A script file is a text file containing commands in the PC Access for Windows script language. Script files usually have the extension: .SCR. PC Access can run script files when you have the Terminal window open. You can run a script file manually by clicking the Play button at the top of the Terminal window.

What is a login script file?

You can also tell PC Access for Windows to run a script file automatically when the Terminal window opens. Generally you would do this to have the script file log you in to a remote computer service (such as your MLS). Such a script file is a login script file.

How do I tell PC Access for Windows to play a login script file?

The advanced version of the MLS Setup window has a Login Script File field. To reach this field:
  1. Click the Setup Menu button on the PC Access for Windows Main Menu window.
  2. Click the Advanced button on the Setup Assistant window.
  3. Click the MLS Setup button on the Advanced Setup Menu window.
  4. Click the Pick button to the right of the Login Script File field.
  5. Highlight a script file on the Open file selector window. Click the OK button to select the file to be your Login Script File.
  6. Click the OK button to close the MLS Setup window.

How do I tell PC Access for Windows to let me log in to my MLS manually

If you want to log in to your MLS manually (for example, if your current login script file does not work correctly), you need to delete the contents of the Login Script File field. (See above.)

How do I tell if PC Access for Windows is playing a login script file when I call my MLS?

When PC Access for Windows is playing a script file, the Play button at the top of the Terminal window is grey and not selectable, and the Stop button is selectable. When PC Access for Windows is not playing a script file, the Stop button is grey and not selectable.

How do I learn to write script files?

Double-click the PC Access Help icon in your PC Access for Windows group (Windows 3.1x) or folder (Windows 95). This opens a help window displaying the PC Access for Windows Reference Guide. Scroll down in the Contents topic until you see the Script Language heading. Read all the topics under this heading.

And, of course, read this document.


Does PC Access for Windows have any special script commands that it uses only in login script files?

Yes. See the topic Script File Pre-defined Macros in the PC Access for Windows Reference Guide for complete details. The macros of interest to us here are:
  • MLS_LOGIN
    • The value in the MLS Login Name field on the Agent Setup window for the current agent.
  • MLS_PASSWORD
    • The value in the MLS Password field on the Agent Setup window for the current agent.
When you use the above macros in a login script file, PC Access substitutes the values of the corresponding setup items into the script file. This lets you write one script file that multiple agents can use as a login script file. (Without these macros, you would have to write individual script files for each agent.) See below for an example of using these macros in a login script.

How do I create a login script file to use with my MLS?

Before you can create a login script, you must write down the steps you perform to log in to your MLS manually. After you dial into your MLS, you wait for the MLS computer to display a prompt, and then you send back a response by typing something and pressing the Enter key. (You only need to write down the last word or two the MLS sends you when it prompts you to send something. However, you must write down everything that you type to the MLS.)

Once you write this list of send-wait pairs, you can write a script file that will enable PC Access to play your role as though you were typing in responses to the MLS computer.

Consider an example: here is a version of MASTER.SCR, a login script file that works with many (but not all) BORIS Master Systems:

// PC-Access Master System Login Script File	    05-MAY-95
//
// This script performs the login function for Master Systems
//
// *************************************************************

label START;

send "^M";
delay 500;
send "^M";
delay 200;
send "^M";
delay 200;
send "login boris^M";
wait 20000 for "Name:" timeout goto TIMEOUT;
send "^!MLS_LOGIN^M";
wait 20000 for "assword" timeout goto TIMEOUT;
send "^!MLS_PASSWORD^M";
wait 20000 for "PHOTOCOM/MAC" timeout goto TIMEOUT;
send "2^M";
wait 20000 for "Color" timeout goto TIMEOUT;
send "2^M";
wait 20000 for "Okidata" timeout goto TIMEOUT;
send "1^M";
exit;

label TIMEOUT;                      // Timeout occurred, notify program and end

messagebox title "Login Failed" text "You will have to log in manually.";
exit;
Here is a line-by-line description of MASTER.SCR. As you read the description, you should look up each script command in the PC Access for Windows Reference Guide.
  • The first five lines are comment lines. PC Access ignores everything to the right of the comment character sequence (//).
  • label START;
    • Every PC Access script file must have at least one label statement before any script commands other than #include, #define , or comments. This particular label statement has no function other than to satisfy this requirement.
  • The next six lines contain three pairs of send and delay statements. Each send statement sends Ctrl-M to the MLS. This has the same effect as though you had typed the Enter key to the MLS. The delay statements pause briefly. These lines simulate you pressing the Enter key three times.
  • send "login boris^M";
    • This command simulates you typing:

      login boris

      and pressing the Enter key. When you do this manually, the MLS prompts you for your login name. The next script command waits for a portion of the prompt string that the MLS sends you. If the string doesn't arrive within 20 seconds,

  • wait 20000 for "Name:" timeout goto TIMEOUT;
    • This command tells PC Access to wait 20 seconds for the MLS to send the string: Name:. Remember, the wait command does not have to wait for the all the prompt text you expect the MLS to send. In fact, it's better to use a fairly small portion of the prompt text. That way your script has a better chance of working if your MLS provider decides to change their prompt text.
    • If the string does not arrive in 20 seconds, the timeout option tells PC Access to skip ahead in the script file to the statement:

      label TIMEOUT;

      The statement after this label contains a messagebox command. It displays an error.

  • send "^!MLS_LOGIN^M";
    • If the previous wait command succeeds (i.e., the MLS sends Name: within 20 seconds), this command tells PC Access to send the current agent's MLS Login Name to the MLS.
    • The ^! at the start of the macro name tells PC Access to regard the next word as a macro name. PC Access then translates the macro name into its value, and sends the value to the MLS. If you did not type the ^!, PC Access would send the name of the macro instead of its value.
  • The following four wait and send commands complete the remaining login steps.
Since every Board likes to customize its MLS, MFM has not been able to write single versions of MASTER.SCR and MAESTRO.SCR that work for everyone. To make a login script file work for your MLS, all you have to do is copy MASTER.SCR or MAESTRO.SCR to another file, then edit the wait and send commands so they do the right things. For example, the wait command is case-sensitive. If your MLS prompts for your user name with:
  • Enter user name:
then MASTER.SCR will fail, because it waits for:
  • Name:
You could fix the error by changing the first wait command in MASTER.SCR to:
  • wait 20000 for "name:" timeout goto TIMEOUT;
(Remember: the wait string only needs to be the last word or two of the prompt you are waiting for.)


Procedure Summary

To create your own login script file:
  1. Login manually to your MLS. Write down the exact text the MLS sends you when it prompts you for input, and exactly what you type in response. Pay attention to case (capitalization).
  2. Copy MASTER.SCR or MAESTRO.SCR to your own script file. For example, if your MLS is a BORIS Master System, open a DOS window and type these commands:
    C:
    CD  \PCAWIN
    COPY  MASTER.SCR  MYSCRIPT.SCR
    EXIT
    
    You may name your login script file anything you like, but use the .SCR extension. That way you will be able to select it with the Pick button on the MLS Setup window.
  3. Open Notepad (in your Accessories group), select File | Open from the menu, and open your login script file.
  4. Edit the wait and send commands to make them correct for your MLS.
  5. Select File | Save to save your changes, and close Notepad.
  6. Start PC Access for Windows.
  7. Tell PC Access to use your login script file.
  8. Click the Call MLS button on the PC Access for Windows Main Menu window. If your script file fails, see where it failed, edit the corresponding script command in Notepad, and try it again.

 

Copyright © 2005 - MFM Software, Inc.
11988 Tramway Drive
Cincinnati, OH 45241
Phone: 513.733.9229
Fax: 513.733.8775
Send comments to webmaster@mfm.com