Version 2 of Turn a tcl-tk script into an application

Updated 2002-06-26 08:44:31

Purpose: you have one or more .tcl scripts which work fine when you 'source' them into a Tk interpreter (or a tclkit). Now you'd like to distribute or package these scripts as something that looks as much like a platform-native application as possible.

There are two things you might wish to do:

(i) interact 'natively' on the given platform

(ii) package the files nicely (so the user sees a single executable)

Now, there is lots of discussion on (ii) -- tclpro, tclkit, freewrap, etc are all attempts to solve this problem (and are discussed elsewhere add links), but how about (i)?

(i) may require the following (depending on the platform):

  • (A) a nice icon which the user double-clicks on to launch your application.
  • (B) the ability to drop one-or-more files onto an icon to launch your application with those files (to process, edit, convert, email, etc...)'
  • (C) if your application is already running, the ability to drop one-or-more files onto an icon to process them using the existing process
  • (D) adding your application to the platform's list of available applications (for use by 'open with...' dialogs, etc).
  • (E) the ability to use your application as a command line tool (>yourapp fileone.txt filetwo.txt')
  • feel free to add more

How can we accomplish these on all sorts of different platforms? In its simplest form, how can a user make a single .tcl script appear like a real application as much as possible?

Windows

On windows, any .tcl script can be double-clicked on to launch it with 'wish'. A nice icon can be added, not to the .tcl script, but to a shortcut which is created to point to the script (and that shortcut can appear in the Start menu) [add refs]. This accomplishes part of (A).

If we add a batch file, we can do at least some of (E).

MacOS

?? The 'drag n drop tcllets' allows you to make little applications quite easily. Does this do enough?

Unix

does this depend on whether you use gnome or kde or? In what sense can a shell script appear as an application?

MacOS X

This is largely like Unix, except that we want to look like a native macosx application with an icon, appear in the dock, accept drag'n'drop, etc.


What would be very nice would be a small generic application executable, compiled for each platform (like a small tclkit) which contains enough code internally to perform all of the above, and to allow you to change the icon, change registered file types/extensions, register itself with the OS, etc, AND which can produce, on demand, a modified copy of itself which you can use for your application.