in reply to Best/Fast/Simple way to add a GUI to a batch process
If simple dialog windows to choose the files and present Yes or No kinds of questions would work then the following is pretty quick and easy. Instead of choosing an output file this uses a Save As dialog to input the file name. You could write to a temporary file and then copy to the file named in the Save As dialog when finished.
use strict; use warnings; use Win32::GUI(); use Win32; use Win32::FileOp qw(SaveAsDialog); my $startdir = 'C:\Users'; my $filename = Win32::GUI::GetOpenFileName( -title => 'Select a file' +, -directory => $startdir, -filter => ["Perl scripts (*.pl, *.pm)" => "*.pl;*.pm", "All files +" => "*.*", ],); if ($filename) { my $returnvalue = Win32::MsgBox("Use $filename ?",4,"Use it?"); if ($returnvalue == 6){ Win32::MsgBox("Using $filename as input."); } else{ Win32::MsgBox("Not using $filename as input."); } print "--- $filename\n"; } else { print "\$filename was not chosen by Win32::GUI::GetOpenfilename\n" +; exit; } my %parameters = ( title => "Output file", filters => {'Filter 1' => '*.txt;*.log', 'Filter 2' => '*.dat'}, filename => 'output.txt', ); my $output_file = SaveAsDialog %parameters , "output.txt"; if($output_file){ Win32::MsgBox("Using $output_file as output."); } else{ Win32::MsgBox("No output file chosen."); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Best/Fast/Simple way to add a GUI to a batch process
by vitoco (Hermit) on Aug 28, 2018 at 11:04 UTC | |
by Lotus1 (Vicar) on Aug 28, 2018 at 13:42 UTC | |
by marto (Cardinal) on Aug 28, 2018 at 11:22 UTC | |
by vitoco (Hermit) on Aug 28, 2018 at 19:25 UTC | |
by Lotus1 (Vicar) on Aug 31, 2018 at 13:36 UTC | |
by vitoco (Hermit) on Sep 02, 2018 at 20:51 UTC |