Connecting to your ISP/Scripting


Installation and Setup FAQ
Presto!Links FAQ
Presto!Mail FAQ
Connecting to your ISP/Scripting
Selecting Netcom as your ISP
ISP and Compatiblity Notes

Do I need to know this?

When you connect to your Internet Service Provider (ISP), your device communicates with the provider using the Point-to-Point Protocol (PPP). With many ISP's, the provider starts to communicate via PPP as soon as you connect. If you have such a provider then you don't need to learn about scripting. Other ISP's require you to go through a sequence of commands before starting PPP. For these ISP's you'll have to provide a PPP Login Script and so you'll need the information contained in this document.

How do I know if my ISP requires a Script?

The Internet Setup scene (accessed by touching the Menu in the Diner) has a number of ISP configurations built-in. If you happen to subscribe to one of the built-in providers, you can go ahead and configure your provider card and Internet Setup will tell you if you need a PPP Login script when you touch the Add button.

If your ISP is not one of the built-in providers and you're not sure if you'll need a script, refer to your ISP documentation or tech support to see if the provider communicates via PPP immediately upon connection (no script required), or whether it requires you to execute some shell commands first (requires a script).

Creating and Editing a PPP Login Script

To create a script, you must have first created a provider card for your ISP. Consult the Presto documentation if you don't know how to do this. Once you have a provider card for your ISP, go to that provider's scene, tap the stamper, and then tap the PPP Login stamp to add it to the provider card. Next, tap the PPP Login stamp to edit the script. The script commands are described below.

Once you are through editing your script, touch the Save button to save your changes. Touching Revert restores the script to the original or to the last time you did a Save.

Scripting Commands

[:optional statement label] send <some text> | $login | $password [:optional goto label]

Sends the specified characters or your login name and password to the computer you are connecting to. The $login and $password variables are automatically set to the login name and password for the stamp that the script is assigned to. For example, PPP login stamp has a script associated with it, so the $login and $password variables are read from the PPP stamp at the time the PPP script is run.

Text to be sent must be enclosed in quotes. Ex. send "ppp\n" sends the string ppp followed by a Line Feed (the \n sequence).

Refer to the section strings for a list of other supported escape sequences.

[:optional statement label] expect [:optional timeout] <some text> [:$optional output variable][:optional goto label]

Waits until the specified characters are received from the remote computer before executing the next script statement. The value specified for "<some text>" is not case-sensitive. For example, you write:

expect "login:"

The remote computer sends the prompt "lOgIn:" The expect case will match and the script will proceed.

The Optional values

Optional values must be preceded by a colon <:>

[:optional statement label] and [:optional goto label]

is used for flow control. Statement and goto labels are delimited by a colon <:> and must be four (4) characters or fewer in length. They are case-sensitive. Use statement and goto labels when you want to control the order that script statements are executed in. You can also use numbers, but then you run the risk of getting them confused with timeout values. For goto labels to work correctly you must provide a corresponding statement label for the script interpreter to match. If there is no statement label corresponding to a goto label, the script will abort, you'll probably wonder why and end up calling technical support, so watch out.

Special Case - the :end label, the :END label and the :0 label. The label :end is a reserved keyword to tell the script to exit. Do not use the :end label for anything other than to tell the script that you want it to conclude.

The labels :END and :0 are reserved for internal use. Don't use them. Ever.

[:optional timeout variable]

Specifies the number of seconds the expect statement waits for the specified string before timing out and proceeding to the next statement. If this value is specified, it overrides the default timeout value specified in the corresponding stamp (PPP, POP connect, SMTP connect). If a timeout variable is specified, it must be preceded by a colon. For example, expect :15 "ogin:" waits 15 seconds for the text ogin: before displaying an error message indicating a timeout to the user.

[:$optional output variables]

Scripts may contain output variables of the form :$o1 :$o2 :$o3 etc. In fact, every script must set output variable $o1 in order for it to work. This means adding :$o1 after a string in an expect statement, usually the last expect statement. If the string matches when the expect statement is executed, the output variable gets set. Setting output variable $o1 is the only way a script can tell the Presto application that it succeeded. Setting output variable $o2 tells Presto that a password was incorrect. If no output variable is set while executing a script, it means the script failed.

For example, a script that works for Compuserve is

Tasty tidbit - the logical "OR"

An expect statement can contain multiple logical ORs simply by separating cases to match (and optional statement labels) by spaces.

Example: expect :10 "$" "%" ">" "incorrect" :end

This statement waits 10 seconds (overriding the default timeout value) to try and match one of the cases. It looks for either a $, % or > and if it matches goes to the next statement since neither $, % or > has a label following it. If it sees the string incorrect it branches to the statement marked :end and the script concludes.

Most people will never need to use the logical OR if they write a script to match their particular ISP's login procedure. We included this feature so we could write scripts that work for most people's ISPs out of the box.

Another tasty tidbit - adding a "delay"

Use the statement expect n timeout where n is the number of seconds to delay before going on to the next statement.

debug

If you need to see the dialogue between your communicator and the remote computer, place this statement at the end of whatever script you are trying to debug. It sets the scripting environment to debug mode which prints the send/expect dialogue between the remote computer and your communicater to the notebook page. In most cases you'll only need to debug the PPP connect script.

strings

You can use any character as part of a string, including the following special characters:

\n sends a Line Feed <LF> to the remote computer. In most cases you should follow your send statements with a \n which equates to pressing the Enter key.
\r sends a Carriage Return <CR> to the remote computer.
\t sends a Tab to the remote computer.
\v sends a Vertical Tab to the remote computer.
\b sends a Bell to the remote computer.
\f sends a Form Feed to the remote computer.
\a sends an Alert character to the remote computer.
\0 sends a Null character to the remote computer. Not to be confused with the reserved :0 label.

If your ISP tells you that you need to send other strange escape sequences, use the format: \xnn where nn is the hexadecimal equivalent of the desired escape sequence's ASCII value. Hint: if you don't know what an escape sequence is, you probably don't need to worry about this.

Known Required Scripts

Internet Express (usa.net)

send "\n"
expect "name:"
send $username "\n"
expect "word:"
send $password "\n"
expect:1 "incorrect: $o2 "continue"
send "ppp\n"
expect "ppp" :$o1

The Well - for UUNET access numbers only

expect :4 timeout
send "\n\n"
expect ":"
send $username "\r"
expect":"
send $password "\r"
expect "incorrect" :$o2 PPP :$o1

You must also remove the "WEN1/" from your "Mail Login" Name. It is not required for Mail Login, only for PPP Login.

Compuserve

expect :4 timeout
send "\r\n"
expect "e:"
send "CIS\r"
expect "D:"
send $username "/GO:PPPCONNECT\r"
expect ":"
send $password "\r"
expect "Invalid" :$o2 "PPP" :$o1

SpryNet

expect :4 timeout
send "\r\n"
expect ":"
send "SPRY01\r"
expect ":"
send $username "\r"
expect ":"
send $password "\r"
expect "correct" :$o2 "}" :$o1