You can replace the Win32::FileOp part with the code below. I used several modules from whatever example code I found and quickly copy/pasted into my (Edit: original) reply. It was intended to show that there are a few options out there.

I tested this on 64 bit Strawberry Perl. (Edit: My previous post was tested on 32 bit Strawberry Perl.)

use strict; use warnings; use Win32::GUI(); my $startdir = 'C:\Users'; my $output_file = Win32::GUI::GetSaveFileName( -title => "Save as...", -directory => $startdir, -file => "output.txt", -filter => [ "Text documents (*.txt)" , "*.txt", "All files" , "*.*", ], ); if($output_file){ print("Using $output_file as output."); } else{ print("No output file chosen."); }

I noticed that after I ran it once and chose a user directory it went to that same directory the next time. I assume it's a feature that it remembers. I found an option that seems to disable this kind of thing but haven't tried it. -nochangedir is 0 by default. It seems to be more to prevent the directory changing during the run so I'm surprised that the directory is remembered on the next run. Refer to http://perl-win32-gui.sourceforge.net/cgi-bin/docs.cgi?doc=Reference-Methods for more detail and other options.


In reply to Re^3: Best/Fast/Simple way to add a GUI to a batch process by Lotus1
in thread Best/Fast/Simple way to add a GUI to a batch process by vitoco

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.