lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev Scripting LYNX to follow links


From: Jeff Haferman
Subject: Re: lynx-dev Scripting LYNX to follow links
Date: Wed, 27 Oct 1999 10:52:43 -0700 (PDT)

In lynx-dev, you wrote:
>> it.  Just went back and added to my expect script, and now it works
>
>Any chance you'd be willing to share your script?
>
>__Henry
>

Okay Henry, 

I've cleaned the script up a bit and here it is.... it uses expect
and lynx to grab realtime stock quotes from infospace.com... it
assumes that you have an account, which is free, but one needs
to register.  Of course, you can modify it for your own needs.

I was not able to get the "stty -echo" to work, i.e. this script will
echo your login and password to stdout.

Suggestions welcome.  Save the file below into whatever you want to call
it, adjust the path to point to expect, enter your loginID and password,
chmod 700, and run.

Enjoy.

Jeff


---------------------------------- cut here -----------------------------------
#!/usr/contrib/bin/expect -f
# make sure path above points to proper location

# script to grab realtime quotes from infospace
# Jeff Haferman 1/27/99
# address@hidden

# because passwords/logins are embedded in this script, 
# permissions should be set via chmod 700 <scriptname>
# or chmod 750 and owned by a trusted group.

# this script assumes that the login and password will be valid

#########################################################################

stty -echo;         # turn echoing off  DOES NOT SEEM TO WORK?
set timeout -1;     # set infinite timeout
match_max 100000;   # set buffer size (bytes) for pattern matching

if {$argc != 1} {send_user "usage: $argv0 <symbol>\n";exit 1}

set url  http://in-133.infospace.com/info/rtq/login.htm
set lynx_opts  -cookies
set login  ""
set pw  ""
set symbol  $argv

if {$login == ""} {send_user "please set loginID\n";exit 1}
if {$pw == ""}    {send_user "please set password\n";exit 1}

spawn lynx $lynx_opts $url
send -- "/";        # not sure why, but need to send '/' twice here
send -- "/"
expect -re "(.*)"
send -- "LoginID"
send -- "\r"
send -- $login
send -- "\t"
send -- $pw
send -- "\t"
send -- "\r"
send -- "/"
expect -re "(.*)"
send -- "Symbol:"
send -- "\r"
send -- $symbol
send -- "\t"
send -- "\r"
send -- ")"
interact;          # give control back to user


# end of script



reply via email to

[Prev in Thread] Current Thread [Next in Thread]