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

Discussion in 'Perl Misc' started by Sylvia, Aug 26, 2005.

  1. Sylvia

    Sylvia Guest

    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
     
    Sylvia, Aug 26, 2005
    #1
    1. Advertising

  2. Sylvia

    John Bokma Guest

    "Sylvia" <> wrote:

    > 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.

    --
    John Small Perl scripts: http://johnbokma.com/perl/
    Perl programmer available: http://castleamber.com/
    Happy Customers: http://castleamber.com/testimonials.html
     
    John Bokma, Aug 26, 2005
    #2
    1. Advertising

  3. Sylvia

    Sylvia Guest

    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
     
    Sylvia, Sep 2, 2005
    #3
  4. Sylvia

    John Bokma Guest

    "Sylvia" <> wrote:

    > 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

    --
    John Small Perl scripts: http://johnbokma.com/perl/
    Perl programmer available: http://castleamber.com/
    Happy Customers: http://castleamber.com/testimonials.html
     
    John Bokma, Sep 3, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TGVl?=

    Prompt for Username/password on session time out

    =?Utf-8?B?TGVl?=, Aug 31, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    513
    Mark Rae
    Aug 31, 2004
  2. Matt
    Replies:
    3
    Views:
    541
    Tor Iver Wilhelmsen
    Sep 17, 2004
  3. David C
    Replies:
    7
    Views:
    681
    Monique
    Jun 17, 2008
  4. David C

    username and password prompt

    David C, Jun 10, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    421
    David C
    Jun 11, 2008
  5. Lance Hoffmeyer
    Replies:
    0
    Views:
    263
    Lance Hoffmeyer
    Nov 17, 2003
Loading...

Share This Page