Problems saving applet with custom icon--icon gets stripped by PackageMaker
Problems saving applet with custom icon--icon gets stripped by PackageMaker
- Subject: Problems saving applet with custom icon--icon gets stripped by PackageMaker
- From: Kevin Walzer <email@hidden>
- Date: Sun, 02 Oct 2005 04:06:47 -0400
- Organization: WordTech Software
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I wanted to share a solution to a stubborn problem that I was having
with a custom icon for an AppleScript applet. Here are the particulars:
1. I wrote an AppleScript to provide a simple GUI ("display dialog"
only) for some command-line programs that I'm distributing. I saved the
script as an applet.
2. I used the "Get Info" window to change the icon of the applet from
the generic one (copy the icon preview of the custom image I want to use
and paste it in the "Get Info" window of the applet).
3. I correctly assembled my installer materials in PackageMaker, set
"keep resource forks" to yes, and did a test installation. Everything
was working, except that the custom icon I appended with the applet was
stripped off.
I know this can be avoided by saving the script as an application bundle
and customizing the icon, but part of my script runs under administrator
privileges, and when it's saved as an application bundle, the dialog
says "applet requires you to type in your password." Unacceptable. When
saved as a simple applet, the actual application name is presented in
the dialog box: "myapp.app requires you to type in your password." This
is what I'm after.
I also considered AppleScript Studio, but I find ASS maddening: it adds
a whole layer of complexity and unhelpful error message to AppleScript's
sometimes-obscure codes. If I need to write a full-fledged GUI
application, I work in Tcl/Tk. Plain AppleScript is really nice for
lightweight front-ends that require only dialog boxes.
So I was actually trying to figure out what happened to the icon, and in
fact, I was trying to figure out a more precise way to append the custom
icon than using the "Get Info" trick. There was very little information
about this in Google or anywhere else. Yet so many of the AppleScript
utilities that I download have custom icons that I knew it was possible.
The solution I eventually stumbled across (after combing the AppleScript
users list) was osxutils, a set of command-line tools that can be
downloaded from http://osxutils.sourceforge.net. There are a lot of
little tools in this package for manipulating OS X files, but the
relevant one is called seticons:
seticons sourcefile targetfile
with the sourcefile being the file with the relevant icon itself and the
targetfile being the icon you want to change.
Worked like a charm, and survived PackageMaker.
I'm surprised these tools aren't more widely publicized. The developer,
Sveinbjorn Thordarson, is also the author of the popular tool Platypus,
which puts a Cocoa GUI wrapper around scripts in many different
programming languages.
At any rate, I have found osxutils to be extremely valuable, and I hope
others take a look. I'd also be curious to hear how others address
similar problems.
- --
Cheers,
Kevin Walzer, PhD
WordTech Software
http://www.wordtech-software.com
sw at wordtech-software.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDP5UXJmdQs+6YVcoRAmcYAJ9ZILfJW7GPwMmDyGnbs/3xqakl6QCeIzHe
x6y607CMS2H3NhuzMLKc8Vo=
=bZ5f
-----END PGP SIGNATURE-----
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden