Am 09.06.2011 um 03.39 schrieb Arno Hautala:
On Wed, Jun 8, 2011 at 21:22, Jean-Christophe Helary
<[email protected]> wrote:
I'm thinking of associating files with an arbitrary extension to a
"standard" shell script so that when the file is double-clicked it
automatically launches the script and is used as its argument.
Is there a relatively trivial way to do that ?
You may be able to do this by wrapping your script with something
like Platypus.
Or perhaps an AppleScript.
I think associating a file type (or extension) requires a bundle
identifier. I'm not sure that Platypus or an AppleScript provides
this.
I've done something similar with applescript, to have files for
dividing long browser lists of documents in a folder, which should
show particular "divider" icons.
I had therefore created a small bundled Applescript program (which in
case of activation just displays a dialog stating that this is only an
"icon-provider"), altered the info.plist and the PkgInfo to my needs
(special creator, type and extensions and inserted (in the plist) the
CFBundleDocumentTypes I wanted. I have put in the resource folder the
desired resources (icons) and altered the name of the applet in the
MacOS folder to the name i entered in the info.plists
CFBundleExecutable. I created empty textedit files (although an empty
applescript doc would probably also be suitable), changed its creator
to the new applescript creator, type and extension to one of the new
document types in CFBundleDocumentTypes, and I got this way nice O kb
dividers of all sorts. Doubleclicking on it opens the respective
Applescript applet (although in my case, this is not a function I
needed)
I thinks, that approach could also function with a parameter copied
via applescript to the clipboard (although I'm not so familiar with
shell scripting....
_______________________________________________
MacOSX-talk mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/macosx-talk