Zorg, the Borg wrote:
> Hi all,
>
> this is a copy of a message that I posted to comp.lang.perl.misc.
>
> i'm experiencing some strange problems when using the module Win32::OLE
> together with windows dialogs.
>
> In the following code snippet, I use an opendialog to pick a file. The
> dialog works as expected: when a different file type is selected in the
> combobox, the file listing changes accordingly.
>
> However, if I uncomment the two Win32::OLE lines, the behaviour
> changes: if
> I pick any file type the file list becomes empty, not even showing
> folders. The only way to have some file names displayed is typing
> something like '*.*' in the file name box and then clicking 'Open'.
>
> I first experienced this problem using Tk's getopenfile. I switched to
> Win32::FileOp as I was thinking it was a Tk problem (as it had other
> problem, like the handling od unicode file names).
>
> I'm using activestate perl 810, Win32::FileOp 0.14.1.0 and Win32::OLE
> 0.1702.0.0, both from http://www.bribes.org/perl/, and I get the same
> results under win98, win2000 and winxp sp2.
>
> anyone experiencing the same thing? any suggestions?
I got a similar result. Fixed 1 bug below, but that didn't help.
It does repopulate after clicking open button.
Not sure why having run the GetActiveObject would affect it like
it is and having an active connection doesn't help either.
> use strict;
> use warnings;
> #use Win32::OLE;
> #my $EXC = Win32::OLE->GetActiveObject('Excel.Application');
>
> use Win32::FileOp;
> use File::Slurp;
>
> my %parameters = (
> title => 'test',
> filters => [ 'log files' => '*.log;*.txt',
> 'Files .log' => '*.log',
> 'Files .txt' => '*.txt',
> 'All files' => '*.*'],
> defaultfilter => 1,
> dir => 'c:\\',
> options => (OFN_HIDEREADONLY, OFN_OVERWRITEPROMPT),
I think you want a scalar here rather than a list:
options => OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
> );
>
> my $file = OpenDialog %parameters;
> exit unless ($file);
> print "you picked $file\n";
> my $contents=read_file($file);
> print "----------------\n$contents\n--------------\n";
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs