food has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have zero experience writing perl to deal with gui and or win32 stuff. I'm looking for a pointer; a clue as to which direction I should be looking in. I run this, pretty much verbatim from manpage,
use Win32::IE::Mechanize; use strict; use warnings; my $ie = Win32::IE::Mechanize->new( visible => 1 ); $ie->get( "http://somesite.nu/work/fun-form.html" ); $ie->form_name( "form2" ); $ie->set_fields( message => 'yourname', email => 'dummy\@dummy.net' );
The snippet runs, then kind of falls off the edge and dies. What I will be wanting to do is to be populating a whole series of forms with the user verifying each dataset before the sequence moves on to submit_form, and the next form. I'm imagining that if I can give the explorer object 'focus' then perhaps the script will be in the holding pattern that I am looking for. I thought about telling it to wait for keyboard input, but I could see that interfering with form field tweaks. I've been scrolling through the active state perl docs, and the win32::ole browser, but I'm kind of at sea in this area. All I want to know is where I should be directing my attention, thanks

Replies are listed 'Best First'.
Re: Win32::OLE ; set focus?
by tachyon (Chancellor) on Sep 27, 2004 at 05:29 UTC

    If the user is expected to verify each dataset then there is no reason why they should not press the relevant submit button. For example this code will fill in the PM login fields and wait for me to submit the form. When I submit the form the content of the page changes so the script then continues, presumably to fill in another form. You can edit the form fields, to your hearts content and it will wait happily. You can probably hook a better on change handler but this work fine as is.

    use Win32::IE::Mechanize; my $ie = Win32::IE::Mechanize->new( visible => 1 ); $ie->get( "http://www.perlmonks.org" ); $ie->form_number( 2 ); $ie->set_fields( user => 'tachyon', passwd => 'passwd' ); my $content = $ie->content; while( $ie->content eq $content ) { # if the content is still the same we are on same page sleep 1; print "waiting!\n"; } print "Done!\n";

    cheers

    tachyon

      Ok. That's great. It wouldn't hadn't, obviously, have occurred to me to use the content like that. ta, food
      To set Focus for Edit Button In Win32 Application Just Try this method ........................ Edit Button name.SetFocus;