Dial-Up Networking under the Windows® 95 Operating System

Section 4 - Automating Dial-Up Networking

Windows® 95 comes with a little known feature to help you automate dial-up networking. This feature, known as the Dial-Up Scripting Tool, allows you to tell it how to log into your ISP and start a PPP or SLIP session. This section shows you how to install, configure, and start the Dial-Up Scripting Tool. Unfortunately, this added bonus only comes with the CD-ROM version of Windows 95. The scripting tool is not available on the floppy disk version. Microsoft has made this tool available on their web site if your Windows 95 did not come with it. Here is a copy of the file for THIS TOOL.

If you have to download the scripting tool from the Microsoft web page then put the file you download in a new folder and double-click on it. This extracts all the files you need to install it.

The scripting tool works by following a "script" which defines how to respond to certain prompts. In other words, when your ISP prompts you for your password you can have the script type in your password for you.

4.1 Installing the Scripting Tool

The Dial-Up Scripting Tool is installed through the Control Panel's Add/Remove Programs icon. In this window click on the Windows Setup tab which brings up the window shown in Figure 4.1.


Figure 4.1 Windows Setup

At this time place your Windows 95 CD in your CD-ROM drive. Click on Have Disk which brings up the window in Figure 4.2.


Figure 4.2 Have Disk

In this window click on Browse. This brings up a file browse window, shown in Figure 4.3.


Figure 4.3 Browse

On your Windows 95 CD go to the \Admin\Apptools\Dscript\ directory and click on OK. If you downloaded the scripting tool from the Microsoft web page then go to the folder containing the extracted files. Click on OK again in the Browse window. The window shown in Figure 4.4 will open.


Figure 4.4 The Installation Window

In this window put a check-mark next to SLIP and Scripting for Dial-Up Networking and click on Install. Click on OK in the Add/Remove Programs window, shown in Figure 4.1.

There is one more necessary change to your configuration before the scripting tool will work correctly. In Section 2, the configuration section, we set the dialing properties for the connection that you made. Right click on the connection icon in the Dial-Up Networking folder and click on Properties. Click on Configure in the window that opens. A window with your modem properties will open. Click on the Options tab then remove the checkmark from Bring up terminal window after dialing. Click on OK then on OK again. You will not need the terminal window now since your script will be logging you in.

4.2 Using the Scripting Tool

Now that you have it installed you can start the tool by clicking on Start, Programs, Accessories, Dial-Up Scripting Tool. The window that opens up looks like Figure 4.5.


Figure 4.5 The Dial-Up Scripting Tool

As I explained in the introduction, the scripting tool works by following a "script". Luckily, the scripting tool comes with a few sample scripts to get the ball rolling. The sample scripts are stored in the C:\Program Files\Accessories folder. Section 4.3 will briefly cover the script language itself. For now, assume you called your script myscript.scp and put it in the C:\Internet folder. In the File name box in Figure 4.5, you would put C:\Internet\myscript.scp. Click on Close when you have the file name of your script entered.

4.3 Writing a Script

Before you sit down and write your own script you should check with your internet provider. They might already have done this work for you and written a script custom tailored for their service.

In order for you to accurately tell your script what key words to wait for and when to respond you should log on to your internet provider with a regular terminal program such as HyperTerminal and take careful notes. Write down the preceeding word or two you see on the screen before you are asked for input. Take careful note of any spaces and punctuation. Suppose your internet provider asked for your user name by saying Enter your user id:. Notice the space between user and id. Also notice the colon after id. Be on the lookout for those kinds of small things. If you tell your script to wait for "userid:", it would never find it and never be able to finish.

A sample script, C:\Program Files\Accessories\Pppmenu.scp is shown below, in Figure 4.6. Take a moment and look over the script.

;
; This is a script file that demonstrates how
; to establish a PPP connection with a host
; that uses a menu system.
;
; A script file must have a 'main' procedure.
; All script execution starts with this 'main'
; procedure.
;


; Main entry point to script
;
proc main

   ; Delay for 3 seconds first to allow host time
   ; to send initial characters.

   delay 3
   transmit "^M"

   ; Wait for the login prompt before entering
   ; the user ID

   waitfor "username:"
   transmit $USERID
   transmit "^M"

   ; Enter the password

   waitfor "password:"
   transmit $PASSWORD
   transmit "^M"

   ;
   ; This provider has a menu list like this:
   ;
   ;   1              : Our special GUI
   ;   2              : Establish slip connection
   ;   3              : Establish PPP connection
   ;   4              : Establish shell access
   ;   5              : Download our software
   ;   6              : Exit
   ;
   ;   annex:
   ;

   waitfor "annex:"

   transmit "3^M"       ; Choose PPP connection

endproc
Figure 4.6 Pppmenu.scp

There are a few key elements you should be aware of in writing your own script.

4.3.1 Comments

Any line that begins with a semi-colon is a comment line. The scripting tool ignores these lines. You can use a comment as a note to yourself or perhaps a future reader.

4.3.2 Waitfor

The waitfor statement tells the scripting tool to look for the character string specified in the quotes. For example, waitfor "password:" will look for "password:". It will wait at that statement in the script until the string comes in.

4.3.3 Transmit

The transmit statement tells the scripting tool to transmit the character string specified in the quotes to your internet provider. For example, transmit "johndoe" would transmit "johndoe". The transmit statement does not send the quotes.

The statement, transmit "^M", sends a carriage return. This is the same as hitting Enter on your keyboard. The "^M" is entered by typing a carret, Shift+6 on American keyboards, followed by an upper-case M.

4.3.4 Variables

You may have been wondering what the statement, transmit $USERID, does. Do you remember when you double-click on your connection in the Dial-Up Networking folder you are asked for your user name and your password? Well, those are put into temporary storage areas and can be referenced in your script by using a variable name. $USERID refers to the user name that you typed in. $PASSWORD refers to the password that you typed in. The statement, transmit $USERID, transmits your user name to your internet provider.

Using transmit $USERID may seem a little silly rather than just writing transmit johndoe. There are two main advantages to using variables rather than "hard-coding" the values in. The first is that you can easily change your user name or password in the first dial screen rather than having to edit the script to change that information. The second, and most important advantage, is security. It is not a very good idea to put your user name and password in a text file on your hard drive that anyone can read. You can safely give your script to friends and not have to worry about accidentally giving away your password.

Before concluding this section, take a look at a quick example. You might see the following on your screen when calling your internet provider.

Welcome to Acme Internet Services!

Enter your user id:
What is your password?

Your script would probably look something like this.

; waiting for the user name
waitfor "user id:"
transmit $USERID
transmit "^M"

; waiting for the password
waitfor "password?"
transmit $PASSWORD
transmit "^M"



Section 1 - Installing the Dial-Up Networking Adapter
Section 2 - Configuring for Dial-Up Internet
Section 3 - How to use Dial-Up Networking
Section 4 - Automating Dial-Up Networking
Section 5 - Troubleshooting
Glossary of Terms

The information in these articles is provided "as-is" without warranty of any kind.