[Pythonmac-SIG] Re:2.3b2-b BuildApplet droplets not recognized as
apps
Bob Ippolito
bob at redivi.com
Sat Jul 12 15:12:57 EDT 2003
On Saturday, Jul 12, 2003, at 12:54 America/New_York, Chris wrote:
> Hi Russell
>
> Mac files have two hidden properties set when they are
> created.
>
> These are Type and Creator.Your dock problem has to do with
> Type.
> It should be set to "APPL" in your applet if you want the
> dock to
> take it. The creator type does not matter in this case.
>
> Get a shareware program called "File Property Editor" and
> drag your applet on to it. It will tell you what the file is
> set at. Just change the Type to APPL and the dock should
> accept it.
If you have Developer Tools installed, type: /Developer/Tools/SetFile
-t APPL <filename>
There's an open source utility that will let you turn shell scripts
into droppable applications. IIRC, it's called Drop Script.
Another solution, hopefully unsurprisingly, is just to use Python.
Here's a sample python session that shows how to do this:
[crack:~/test] bob% pythonw
Python 2.3b2 (#3, Jul 3 2003, 22:26:01)
[GCC 3.1 20020420 (prerelease)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Carbon.File, os
>>> open('tempfile', 'w')
<open file 'tempfile', mode 'w' at 0x10e2e0>
>>> os.system('/Developer/Tools/GetFileInfo tempfile')
file: "tempfile"
type: ""
creator: ""
attributes: avbstclinmed
created: 07/12/2003 14:02:15
modified: 07/12/2003 14:02:15
0
>>> fsspec = Carbon.File.FSSpec('tempfile')
>>> fsinfo = fsspec.FSpGetFInfo()
>>> fsinfo.Type = 'APPL'
>>> fsspec.FSpSetFInfo(fsinfo)
>>> os.system('/Developer/Tools/GetFileInfo tempfile')
file: "tempfile"
type: "APPL"
creator: ""
attributes: avbstclinmed
created: 07/12/2003 14:02:15
modified: 07/12/2003 14:02:15
0
I only executed GetFileInfo to demonstrate that applications other than
Python agree that the Type had changed. There is no reason to use some
shareware garbage when Developer Tools comes with an equivalent tool
and Python can do it in 5 lines.
Now someone can go dig into BuildApplet's code and figure out where
this code needs to be placed and submit a bug+patch on sourceforge.
-bob
More information about the Pythonmac-SIG
mailing list