Existing module for file browser

Discussion in 'Perl Misc' started by John Black, Mar 8, 2013.

  1. John Black

    John Black Guest

    Hi, I have some perl code that processes a file or files and I want an easy Windows familiar
    way for the user to specify the filename. I.e. my users are not really into "command lines".

    I have used Win32::GUI a little but I am looking for an off the shelf solution that someone
    has hopefully done to allow the user to use the windows file browser or something like it to
    traverse the directory tree, find their file and select it. This module would ideally just
    return a scalar variable containing the filename with path and then my existing code can take
    it from there. (extra credit to allow the user to select multiple filenames and have them
    returned in an array...)

    Does such a thing exist in the public domain? Thanks!

    John Black
     
    John Black, Mar 8, 2013
    #1
    1. Advertising

  2. * John Black wrote in comp.lang.perl.misc:
    >Hi, I have some perl code that processes a file or files and I want an easy Windows familiar
    >way for the user to specify the filename. I.e. my users are not really into "command lines".
    >
    >I have used Win32::GUI a little but I am looking for an off the shelf solution that someone
    >has hopefully done to allow the user to use the windows file browser or something like it to
    >traverse the directory tree, find their file and select it. This module would ideally just
    >return a scalar variable containing the filename with path and then my existing code can take
    >it from there. (extra credit to allow the user to select multiple filenames and have them
    >returned in an array...)


    Sounds like you want one of the Win32:: modules that expose a standard
    function like `GetOpenFileName`, Win32::GUI among them; there probably
    is nothing considerably more off-the-shelf.
    --
    Björn Höhrmann · mailto: · http://bjoern.hoehrmann.de
    Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
    25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
     
    Bjoern Hoehrmann, Mar 9, 2013
    #2
    1. Advertising

  3. John Black

    Dr.Ruud Guest

    On 2013-03-08 22:37, John Black wrote:
    > Hi, I have some perl code that processes a file or files and I want an easy Windows familiar
    > way for the user to specify the filename. I.e. my users are not really into "command lines".
    >
    > I have used Win32::GUI a little but I am looking for an off the shelf solution that someone
    > has hopefully done to allow the user to use the windows file browser or something like it to
    > traverse the directory tree, find their file and select it. This module would ideally just
    > return a scalar variable containing the filename with path and then my existing code can take
    > it from there. (extra credit to allow the user to select multiple filenames and have them
    > returned in an array...)
    >
    > Does such a thing exist in the public domain? Thanks!


    Or tell them to use a specific extension on the file,
    and configure your script to be the default opener for that extension.

    Because then they can just doubleclick on the file's name, in their
    favorite file browser, to let your script have it.

    You can also implement drag-and-drop, such that if the user drops a
    bunch of files on your icon, your script gets called.

    --
    Ruud
     
    Dr.Ruud, Mar 9, 2013
    #3
  4. John Black

    Klaus Guest

    On 8 mar, 22:37, John Black <> wrote:
    > Hi, I have some perl code that processes a file or files and I want an easy Windows familiar
    > way for the user to specify the filename.  I.e. my users are not reallyinto "command lines".
    >
    > I have used Win32::GUI a little but I am looking for an off the shelf solution that someone
    > has hopefully done to allow the user to use the windows file browser or something like it to
    > traverse the directory tree, find their file and select it.  This module would ideally just
    > return a scalar variable containing the filename with path and then my existing code can take
    > it from there.  (extra credit to allow the user to select multiple filenames and have them
    > returned in an array...)


    That's the kind of thing the "Windows-standard-File-Explorer-right-
    click-sendto-folder" is made for:

    First you write a "hello.bat" file that encapsulates a small perl
    prototype as follows:

    hello.bat:
    ----------------------
    @rem = '--*-Perl-*--
    @echo off
    perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
    goto endofperl
    @rem ';
    #!perl
    use strict;
    use warnings;
    for my $file (@ARGV) {
    print "File '$file' has been selected\n";
    # ... do stuff with $file ...
    }
    __END__
    :endofperl
    pause
    ----------------------

    Then you put the "hello.bat" file into your sendto-folder.

    (on my Windows 7, the sendto-folder is under C:\Users\zzzz\AppData
    \Roaming\Microsoft\Windows\SendTo\, you can use the start-icon on the
    lower-left corner of your screen and type "shell:sendto" to find out
    where the "sendto" folder is on your system...)

    Once the "hello.bat" is in your "sendto" folder, just fire up your
    File Explorer, any old directory will do, let's say you go straight to
    your C:\ directory, you select 2 or 3 files and you right-click and
    select sendto...

    Under sendto, you will find (amongst other things) a menu "hello.bat"
    -- go straight to that "hello.bat" and voilà: the names of the
    selected files appear in a dos-box.

    I hope this helps.
     
    Klaus, Mar 9, 2013
    #4
  5. what I do is to use one of the
    "zenity" , "kdialog" or "zenity for windows"
    some times I write a small vbs script for user input
     
    George Mpouras, Mar 10, 2013
    #5
  6. John Black

    John Black Guest

    In article <513b5304$0$6948$4all.nl>, says...
    >
    > On 2013-03-08 22:37, John Black wrote:
    > > Hi, I have some perl code that processes a file or files and I want an easy Windows familiar
    > > way for the user to specify the filename. I.e. my users are not really into "command lines".
    > >
    > > I have used Win32::GUI a little but I am looking for an off the shelf solution that someone
    > > has hopefully done to allow the user to use the windows file browser or something like it to
    > > traverse the directory tree, find their file and select it. This module would ideally just
    > > return a scalar variable containing the filename with path and then my existing code can take
    > > it from there. (extra credit to allow the user to select multiple filenames and have them
    > > returned in an array...)
    > >
    > > Does such a thing exist in the public domain? Thanks!

    >
    > Or tell them to use a specific extension on the file,
    > and configure your script to be the default opener for that extension.
    >
    > Because then they can just doubleclick on the file's name, in their
    > favorite file browser, to let your script have it.
    >
    > You can also implement drag-and-drop, such that if the user drops a
    > bunch of files on your icon, your script gets called.


    Cool idea thanks. I actually thought of this but 1) I need to use files with standard
    extensions like .csv and 2) I think the technology to select files with a browser within a
    perl script will come in handy for future projects too.

    John Black
     
    John Black, Mar 11, 2013
    #6
  7. John Black

    John Black Guest

    In article <>,
    says...
    >
    > * John Black wrote in comp.lang.perl.misc:
    > >Hi, I have some perl code that processes a file or files and I want an easy Windows familiar
    > >way for the user to specify the filename. I.e. my users are not really into "command lines".
    > >
    > >I have used Win32::GUI a little but I am looking for an off the shelf solution that someone
    > >has hopefully done to allow the user to use the windows file browser or something like it to
    > >traverse the directory tree, find their file and select it. This module would ideally just
    > >return a scalar variable containing the filename with path and then my existing code can take
    > >it from there. (extra credit to allow the user to select multiple filenames and have them
    > >returned in an array...)

    >
    > Sounds like you want one of the Win32:: modules that expose a standard
    > function like `GetOpenFileName`, Win32::GUI among them; there probably
    > is nothing considerably more off-the-shelf.


    This looks promising. Thanks!

    John Black
     
    John Black, Mar 11, 2013
    #7
  8. John Black

    John Black Guest

    In article <>, klaus03
    @gmail.com says...
    >
    > On 8 mar, 22:37, John Black <> wrote:
    > > Hi, I have some perl code that processes a file or files and I want an easy Windows familiar
    > > way for the user to specify the filename.  I.e. my users are not really into "command lines".
    > >
    > > I have used Win32::GUI a little but I am looking for an off the shelf solution that someone
    > > has hopefully done to allow the user to use the windows file browser or something like it to
    > > traverse the directory tree, find their file and select it.  This module would ideally just
    > > return a scalar variable containing the filename with path and then my existing code can take
    > > it from there.  (extra credit to allow the user to select multiple filenames and have them
    > > returned in an array...)

    >
    > That's the kind of thing the "Windows-standard-File-Explorer-right-
    > click-sendto-folder" is made for:
    >
    > First you write a "hello.bat" file that encapsulates a small perl
    > prototype as follows:
    >
    > hello.bat:
    > ----------------------
    > @rem = '--*-Perl-*--
    > @echo off
    > perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
    > goto endofperl
    > @rem ';
    > #!perl
    > use strict;
    > use warnings;
    > for my $file (@ARGV) {
    > print "File '$file' has been selected\n";
    > # ... do stuff with $file ...
    > }
    > __END__
    > :endofperl
    > pause
    > ----------------------
    >
    > Then you put the "hello.bat" file into your sendto-folder.
    >
    > (on my Windows 7, the sendto-folder is under C:\Users\zzzz\AppData
    > \Roaming\Microsoft\Windows\SendTo\, you can use the start-icon on the
    > lower-left corner of your screen and type "shell:sendto" to find out
    > where the "sendto" folder is on your system...)
    >
    > Once the "hello.bat" is in your "sendto" folder, just fire up your
    > File Explorer, any old directory will do, let's say you go straight to
    > your C:\ directory, you select 2 or 3 files and you right-click and
    > select sendto...
    >
    > Under sendto, you will find (amongst other things) a menu "hello.bat"
    > -- go straight to that "hello.bat" and voilà: the names of the
    > selected files appear in a dos-box.
    >
    > I hope this helps.


    I appreciate this idea but I think its a little kludgier than what I am looking for.

    John Black
     
    John Black, Mar 11, 2013
    #8
  9. John Black

    Guest

     
    , Jul 11, 2013
    #9
    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. Breaststroker

    listen to an existing browser

    Breaststroker, Mar 31, 2006, in forum: Java
    Replies:
    1
    Views:
    381
  2. nrm
    Replies:
    3
    Views:
    534
  3. Replies:
    0
    Views:
    190
  4. Jonno
    Replies:
    0
    Views:
    98
    Jonno
    Feb 19, 2014
  5. Jonno
    Replies:
    0
    Views:
    71
    Jonno
    Feb 19, 2014
Loading...

Share This Page