At 01:14 PM 3/6/2003 -0600, Mohammad Hassan wrote:
Hi,
i am sorry if this question is too trivial. i was trying to automate the
selectall-copy-paste sequence in internet explorer. i open a webpage in IE
and then select all the contents of the page , copy them and paste it in
the notepad and save it as a text file. i could have parsed the html data
using the html parser. but i wanted to try this way so that it will help
me in working with other microsoft applications in future.  the final
result is i just wanted a plain text file without any html tags. i am
trying with different methods and modules available.can anybody help me by
telling how to access the SelectAll(), Copy() and Paste() functions in
context with internet explorer object.thanks a lot in advance,
regards,
Hassan

This works for me. Tobias

use strict;
use Win32;
use Win32::Clipboard;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Internet Controls';

use constant URL => q{http://www.kahunaburger.com/blog/};

my ($ie,$clip,$loaded);
# handle to clipboard
$clip = Win32::Clipboard();
# empty it
$clip->Empty();
# start IE
$ie = Win32::OLE->new('InternetExplorer.Application');
# make sure IE is visible
$ie->{Visible} = 1;
# go to a known URL
$ie->Navigate(URL);
# wait until URL was completly loaded
while ($ie->Busy()) {
    Win32::Sleep(500);
}
# execute "Select All"
$ie->ExecWB(OLECMDID_SELECTALL,OLECMDEXECOPT_DODEFAULT);
# give it some time
Win32::Sleep(100) while ($ie->Busy());
# execute "Copy"
$ie->ExecWB(OLECMDID_COPY,OLECMDEXECOPT_DODEFAULT);
# give it some time
Win32::Sleep(100) while ($ie->Busy());
# wait for clipboard change
$clip->WaitForChange();
# quit IE
$ie->Quit();
my $text = Win32::Clipboard::GetText();
print "Clipboard contents: $text\n";

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to