Avoiding username/password prompt when using Win32::OLE to open doc

S

Sylvia

Hello,

Thanks to the generous help of some people here, I can via perl open a
word doc on the internet and get text from it.

My one remaining issue (I hope!) is that every time I open a doc, it
prompts me for a username/password, not once, but twice. I hit cancel
twice, and still get the doc, but this won't work when I'm trying to
parse through hundreds of docs.

Here's what I'm using:
***************************************************
***************************************************
use strict;
use Win32::OLE qw(in with);

my($input_file) =
'http://www.cityofbellevue.org/departments/Police/files/Press_2005_08_01_2000.doc';

my($word) = Win32::OLE->new('Word.Application', 'Quit') || die
"Couldn't run Word";
my($doc) = $word->Documents->Open($input_file);

$doc->{Saved} = 1;
$doc->Close;

exit(0);

***************************************************
***************************************************

Any idea on how I could avoid the login prompts?

Thanks much!
Sylvia
 
J

John Bokma

Sylvia said:
Hello,

Thanks to the generous help of some people here, I can via perl open a
word doc on the internet and get text from it.

My one remaining issue (I hope!) is that every time I open a doc, it
prompts me for a username/password, not once, but twice. I hit cancel
twice, and still get the doc, but this won't work when I'm trying to
parse through hundreds of docs.

Here's what I'm using:
***************************************************
***************************************************
use strict;

add
use warnings;
use Win32::OLE qw(in with);

my($input_file) =
'http://www.cityofbellevue.org/departments/Police/files/Press_2005_08_ 0
1_2000.doc';

no need to put () around $input_file.
my($word) = Win32::OLE->new('Word.Application', 'Quit') ||
die "Couldn't run Word";

ditto (), and I recommend using or instead of || (more readable)
my($doc) = $word->Documents->Open($input_file);

$doc->{Saved} = 1;
$doc->Close;

exit(0);

happens automatically.
Any idea on how I could avoid the login prompts?

If you download the document yourself (via browser), and change
$input_file to the local file, do you still get those password prompts?

If so, it might be possible to avoid them using OLE.
 
S

Sylvia

Thanks for the reply, John.

When I change $input_file to the local file, I do NOT get the prompts.
Do you know how I could get this same behavior for when I have an
internet doc file as the input file?

Thanks,
Sylvia
 
J

John Bokma

Sylvia said:
Thanks for the reply, John.

Hi Sylvia, try to quote the previous message, this can be done with Google
groups.
When I change $input_file to the local file, I do NOT get the prompts.
Do you know how I could get this same behavior for when I have an
internet doc file as the input file?

Yes, download the file and then open it.

See LWP::UserAgent, especially :content_file
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top