Hi

i just posted this and it came up as posted by an anonymous user, so I'm redoing it properly...bear with me

I would like to write a perl script that allows a user to select a file from windows explorer and use this as the input for the code within the perl script (like STDIN).

So the code would open windows explorer to the correct directory, the user would then click on (select) their file, and then the script would do it's business on the selected file as a variable (e.g. my $selectedFile).

I have found some code to open windows explorer:

my $explorer = 'c:/windows/SysWOW64/explorer.exe'; my $directory = 'C:\\testdir\\'; system($explorer,$directory);
...which works fine (based on Perl monks http://www.perlmonks.org/bare/?node_id=313539) to open windows explorer from the pl script.

How do I get the code to then recognise the file I click on in the explorer window, and create a variable from it? Is it possible or is Perl not the way to do it?

Cheers, Matt


In reply to open windows explorer and select file for processing by viennese_finger

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.