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
, etc. are all attempts to solve this problem, but this page addresses the other problem, (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).
30 December 2002) Somehow I missed this page when it was posted initially. We already have more than you think here. Your idea of adding the icon to the shortcut is the conventional way of doing desktop icons on Windows; (A) is pretty much solved. (B) is SOMETIMES done on Windows, but it's unusual; more conventional is to register file types under Windows
, so that the files that a given application manipulates can simply be double-clicked. (C) is solved by any of the Tcl COM extensions. (D) is also done with registering file types. (E) is also solved, completely, by adding .tcl to $env(PATHEXT).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. (If it could then, automatically perform some version of (ii) and bundle up a lot of others files at the same time, even better).
I envisage this, at least on Windows, MacOS (X), to be an executable that you run, and it pops up a Tk interface which asks you:
- name of application
- .tcl script for your application
- icon for application
- accepts drag'n'drop? (if so, then what types/extensions, and what Tcl procedure to call when items are dropped).
Then you hit 'go', and it creates a new executable 'yourapp.exe', say, which does all of the above.