There are TK tools out there to help you generate TK code. Neat idea.
Has anyone tried to write a light-weight TK browser that records the user actions
and generates WWW::Mechanize code?
Now, that would be cool. Anyone interested in taking up the challenge? :)

rkg
I posted this musing under "Meditations" rather than "SOPW", as I don't think such an app exists, and I'm musing rather than asking.

Replies are listed 'Best First'.
Re: Automatic mechanization
by Corion (Patriarch) on May 15, 2003 at 17:47 UTC

    I pondered doing such a thing with Internet Explorer, but it's quite hard to infer from a requested URL which link the user clicked on - so I went a level deeper and wrote WWW::Mechanize::Shell - a command line browser that uses IE (or any other browser) to display the HTML. It generates Perl scripts that use WWW::Mechanize.

    perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
Re: Automatic mechanization
by perrin (Chancellor) on May 15, 2003 at 21:26 UTC
Re: Automatic mechanization
by hardburn (Abbot) on May 15, 2003 at 17:33 UTC

    Hrm, might be better as a Mozilla plugin. No need to write a totally new browser, and Mozilla has much wider availability than Tk apps.

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated

Re: Automatic mechanization
by artist (Parson) on May 15, 2003 at 17:36 UTC
    It is possible to record browser events with Win32::OLE for Internet Explorer on Windows. We can grab the user actions from it and convert into appropriate forms to generate WWW:Mechanize code.

    artist

      Do you have any example code of this?

      We do have a tool that sends some data to sites by faking a user with MSIE and we do have a tool to help the admins set up the actions necessary, but being able to capture the events would be even better. :-)

      Update:Thanks Corion++ and Artist++. Sure Corion, the admins would have to modify the captured events to make this a bit more general, the "replay" tool already allows them to set conditional jumps, find links to click based on parts of URLs, fill form fiels by ID or name, run pieces of JavaScript, etc. etc. etc. And the admins do get notified if the site changes and the replay tool cannot do its job. Anyway the more help I can give them the better (don't believe anything the marketing says about technology! As usual.).

      Jenda
      Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
         -- Rick Osborne

      Edit by castaway: Closed small tag in signature

        While I do not have code directly for this, other people already did something similar which should be easily adaptable to your secondary intention (mad props to Google):

        1. Dave Roth on IE events
        2. Perlmonth on IE events
        I'm still not sure that you will be able to automate changing websites, but to record and replay user actions and the sequence of requests, this should be enough.

        perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
Re: Automatic mechanization (proxy)
by zby (Vicar) on May 16, 2003 at 07:43 UTC
    There was an interesting approach to use proxy to register the user actions. I thought it was a part of the Monkeywrench suit - but now reading the CPAN documents I can't find any trace about it.