Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copying icons in OS X?



On Wednesday, Oct 30, 2002, at 12:13 US/Pacific, Joshua Ochs wrote:

That will copy the entire resource fork, won't it?

Yes.

However, aren't the icons on files and the icons on folders handled a bit differently (different id's,
files' icons are in the resource fork of the file, folders have a separate file, etc).

Yes.

If this will work, I'm all for it. :)

In my experience, 'ditto -rsrc' always copies the icon of a file correctly. If you copy a folder from the same disk onto the desktop, it won't show up until a restart (but it is copied correctly). However I re-read your post and see you need something different...

If you need to copy individual icons (of any kind like ICON, ICN#, ics#, icl8, etc.) then the tools for this are 'Rez' and 'DeRez' and are located in /Developer/Tools. These tools can copy icons from resources in the resource fork to resources in the data fork if need be. They are also callable from "do shell script". I believe the specific icon resources you might be thinking of might be ID -16455 but am not entirely sure if you are creating so called "preview" icons which have other resources ('pnot' ???) and resource IDs.

For folders, its an invisible file with a trick name: I think it's "Icon\r". The resource fork of this icon will contain an 'icns' resource of ID -16455. I believe you also have to set a "custom icon" bit for the folder with "SetFile -C" (also found in /Developer/Tools).

For OS X volumes, it's ".VolumeIcon.icns" (very nice for burning CDs).

Good luck! Calling Rez and DeRez is not exactly the simplest scripting. Fortunately they have man pages and if it turns out you just need to copy 'icns' ID -16455 from one file to another, it shouldn't be too tricky.


Philip


- Joshua Ochs

----- Original Message -----
From: "Philip Aker" <email@hidden>
To: "Joshua Ochs" <email@hidden>
Cc: <email@hidden>
Sent: Wednesday, October 30, 2002 1:44 PM
Subject: Re: Copying icons in OS X?


On Wednesday, Oct 30, 2002, at 08:53 US/Pacific, Joshua Ochs wrote:

Essentially, is there any way to copy icons in OS X via AppleScript?

Try something like:

do shell script "ditto -rsrcFork path/to/src path/to/dest"


Philip Aker
http://www.aker.ca

Freedom of the press? America, look where you're at:
http://www.rsf.fr/article.php3?id_article=4116
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.



Philip Aker
http://www.aker.ca

Freedom of the press? America, look where you're at:
http://www.rsf.fr/article.php3?id_article=4116
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Copying icons in OS X? (From: "Joshua Ochs" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.