Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello folks,

I'm a newbie. So please bear with me.

For learning purposes though, on MS-Windows I have a tiny Perl/Tk GUI application (which basically is: given a directory it simply lists out the names of the files in that directory) which I start it from the command line i.e.

c:\>perl .\gui_simple_app.pl
However, going forward (again, for learning purposes)I would like to start it from the desktop. i.e. double-clicking on an icon on the desktop should start the application. So I'm interested to know,

1. How to create a simple icon (or a bitmap if that works)
2. A one-time small installation script in perl which when executed will install this icon on the desktop.
3. Double clicking on this icon on the desktop should automatically execute the command: perl <appdir>\gui_simple_app.pl thereby launch the app.

I searched for prior posts as well as Tutorials section to see if this has already been asked. But couldn't find one. Hence any information on this would be helpful.

Many Thanks,

Replies are listed 'Best First'.
Re: A Perl/Tk GUI launching question
by zentara (Cardinal) on Sep 11, 2014 at 10:08 UTC
    I don't use Desktop icons, or Windows, but just as a learning exercise, lets see what it would take? First you would need to make a new icon on the Desktop, then you would have to assign it an image(or use the default one), then add a Caption Text, and the full path to the Perl Program to be executed. All these things can be done with right-mouse-clicks on most modern Desktops.

    I think it could be done but it's not a Perl problem, it's a WindowManager issue. What you probably are looking for, is a generic program installer for the Window's WindowManager.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: A Perl/Tk GUI launching question
by jellisii2 (Hermit) on Sep 11, 2014 at 11:40 UTC
    While PAR::Packer and its associated utility pp would work, there is the idea of using shortcuts within windows to do the same thing.

    Of course, this does mean that you'd have to have perl and all of its stuff installed on every machine you want to run this code on, which may or may not be the end game of this exercise. If you want to run it on more than your machine, I can highly recommend PAR::Packer and pp for making your code portable, and NSIS for creating an installer if you want to get that fancy.

    Do understand the caveats of pp though: One of the biggest is that it's not going to hide or obfuscate your code. It just packs enough perl into a self-extracting executable file along with your code. Depending on the end goal of whatever you're developing, this may or may not be important.

Re: A Perl/Tk GUI launching question (citrus cava pp)
by Anonymous Monk on Sep 11, 2014 at 10:26 UTC
Re: A Perl/Tk GUI launching question
by soonix (Chancellor) on Sep 12, 2014 at 22:01 UTC

    On Windows, a desktop icon is simply a "shortcut" (MS terminology for Unix "symbolic link") in your "Desktop" folder/directory. Knowing this, you can now google for "perl windows create shortcut" and find a helpful snippet here in perlmonks.
    The "path" in that shortcut would be your "perl whatever.pl".
    There is a "Desktop" folder for every user and a common one, which are merged on the desktop display, so that you can create shortcuts for "all users", which is what your installation script would have to do.

    if your installer script can rely on having perl installed on the target machine, you were done then. Otherwise, you'd have to package your installer (and likewise your gui_simple_app.pl) as already suggested by other monks.