Re: Setting icon (Applescript-users Digest, Vol 2, Issue 108)
Re: Setting icon (Applescript-users Digest, Vol 2, Issue 108)
- Subject: Re: Setting icon (Applescript-users Digest, Vol 2, Issue 108)
- From: "Jonathan Levi, M.D." <email@hidden>
- Date: Tue, 15 Feb 2005 00:42:18 -0500
On Mon, 14 Feb 2005 16:05:02 -0500, Stephen Jonke <email@hidden>
wrote:
Is there a way via applescript to either set or remove the custom icon
of a disk, folder or file? When I get the Finder properties of anything
it always reports "missing value" for the icon, even if the
file/folder/disk in question has a custom (pasted on) icon.
Someone will probably have a better answer than mine, but...
My impression is that custom-icons for folders and disks are stored in
a resource-fork-only file "Icon\r", hence one could remove the custom
icon with something like
do shell script ("rm " & quoted form of ((POSIX path of the
folder/disk) & "Icon?"))
When I tested this script on a customized folder, the folder's "Icon\r"
file duly disappeared, but the custom icon persisted until i restarted
the computer.
For files (exclusive of bundles) I believe the file with a custom icon
gets a resource fork and 'icns' resource # -16455 in that fork. If
you're confident that the file doesn't need the resource fork for
anything else (most, but not all, files produced by MacOS X
applications, for instance) then you can delete the fork with
do shell script ("cd " & (quoted form of POSIX path of the file's
directory) & ¬
"; cp myfile tempfile && mv tempfile myfile")
and you will see the custom icon disappear.
As for setting custom icons, I have used System Events scripting to
copy the icon from one file's information window to the information
window of the second. Surely someone here will offer a better way of
doing it than that.
HTH,
Jonathan
_______________________________________________
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