Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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 ( [id://1221264]=note: print w/replies, xml ) Need Help??


in reply to Re: Best/Fast/Simple way to add a GUI to a batch process
in thread Best/Fast/Simple way to add a GUI to a batch process

To try this example, I had to install Win32, Win32::GUI and Win32::FileOp, but the last one failed like in Win32::FileOp issues and aborted. Argh!!!! Any hint? It seems that this module is not maintained anymore (Anyone wants to take over Win32::FileOp?).

I'm thinking about to remove x64 version of Starwberry Perl from my Win10 machine and replace it with the 32 bits one...

  • Comment on Re^2: Best/Fast/Simple way to add a GUI to a batch process

Replies are listed 'Best First'.
Re^3: Best/Fast/Simple way to add a GUI to a batch process
by Lotus1 (Vicar) on Aug 28, 2018 at 13:42 UTC

    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.

Re^3: Best/Fast/Simple way to add a GUI to a batch process
by marto (Cardinal) on Aug 28, 2018 at 11:22 UTC

    "I'm thinking about to remove x64 version of Starwberry Perl from my Win10 machine and replace it with the 32 bits one..."

    Re^4: Win32::FileOp issues includes "I'm using 32bit perl".

      Mmmmm... Win32:FileOp was installed OK in a 32 bit WinXP virtual machine, and then the full example worked as expected.

      Then I packed it into an EXE using PAR, and try this in the same WinXP VM successfully.

      Finally, I copied the EXE to my (other) Win10 x64 machine and run it there... Successfully!!! I was dissapointed. I was sure it would fail.

      I said "other" because this is the Win10 machine at my office that also has x64 Strawberry perl, but no GUI modules. I'll not try to install any of them here anyway. The original machine where I tried all the GUIs is at home ;-) I can't recall if both of them are the same or different editions of Win10, and I don't know if this matters!

      It seems that if I take the Win32::GUI way, I'll have to coninue the development on a 32 bit WinXP VM to get a running app in EXE format.

        It seems that if I take the Win32::GUI way, I'll have to coninue the development on a 32 bit WinXP VM to get a running app in EXE format.

        Win32::FileOP was the module that wouldn't install on 64 bit Perl, not Win32::GUI. You posted this after I posted this example of how to do a File-Save dialog on 64 bit Perl so maybe you didn't notice but Win32::GUI works for 64 bit Perl. Another option is to use the portable version of 32 bit Strawberry Perl on whatever machine you want to use. The 32 bit version of Perl runs on 64 bit Windows machines.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1221264]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-19 14:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found