Version 0 of w3m

Updated 2002-06-28 13:17:17

Almost all you say here is about MS Windows. However, on Unix, Tcl can interact with browsers, too.

OLE? COM? CORBA? Some other complicated stuff? Not at all! Just plain old expect and plain (not so old) w3m (see http://w3m.sourceforge.net ).

    #!/bin/sh
    # magic \
    exec expect "$0" "$@"

    proc w3m:start {uri} {
        uplevel 1 spawn w3m $uri
    }

    proc w3m:quit {} {
        send qy\r
        expect eof
    }

    proc w3m:field_after_label {lab val} {
        send g/$lab\r\t\r$val\r
    }

    proc w3m:next_field {val} {
        send \t
    }
    proc w3m:dump_file {name} {
        file delete $name
        send "S$name\r"
    }
    proc w3m:dump_source {name} {
        file delete $name
        send "\033s\001\013$name\r"
    }

    w3m:open http://wiki.tcl.tk/Recent
    w3m:dump_file ~/wiki/recent.txt
    w3m:quit
    exec mail -s "wiki news" [email protected] < ~/wiki/recent.txt

et cetera.

The advantage of this method is the following: programming the browser is very similar to jore the page ls loaded; so, the script must expect some notification from lynx that it's ready to further input. In case of full-screen terminal application, it's not so sso simple. But for w3m, there is no such problem.

A/AK