• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Setting and getting a file's icon in OS X?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting and getting a file's icon in OS X?


  • Subject: Re: Setting and getting a file's icon in OS X?
  • From: Kai Edwards <email@hidden>
  • Date: Tue, 10 Sep 2002 21:28:58 +0000

on Mon, 9 Sep 2002 23:57:31 -0600, "W. Eric Tyson" <email@hidden>
wrote:

> Back in OS 9 it was possible to access the icon of files and folders
> like this:
>
> --- begin simple script ---
> set someFolderIPicked to (choose folder with prompt "select your
> folder") as string
>
> set theFolder to "Some:Path:to:a:Folder"
>
> set icon of folder (theFolder as string) to icon of folder
> someFolderIPicked
>
> --- end ----
>
> I think that's how it was done. anyway, i cannot seem to access the
> icons of files and folders in OS X 10.2. Does anyone know how to do
> this.

I believe 'icon' is a property of the Finder's class item - so you'd
probably have had a Finder tell block in there somewhere.

For example, this works for me in OS 8.1 thru OS 9.1 [1]:

-----------------------------------------------------------------
set copyItem to alias "Some:Item:To:Copy" -- change as appropriate
set pasteItem to alias "Some:Item:To:Paste" -- change as appropriate
tell application "Finder"
set icon of pasteItem to icon of copyItem
end tell
-----------------------------------------------------------------

However, last time I looked at an OS X Finder dictionary, the references to
icon looked something like this:

-----------------------------------------------------------------
icon icon family -- the icon bitmap of the item
Class icon family: (NOT AVAILABLE YET) A family of icons
-----------------------------------------------------------------

Try checking your Finder dictionary in OS 10.2. If the Class icon family
entry is still marked '(NOT AVAILABLE YET)', you may have to wait a little
longer to repeat the trick.

HTH

Kai

[1] IIRC, the composite Finder syntax may have caused problems in later
versions. I believe the workaround I used was to evaluate the icon data
first - something like this:

-----------------------------------------------------------------
tell application "Finder"
set theIcon to icon of copyItem
set icon of pasteItem to theIcon
end tell
-----------------------------------------------------------------

--
email@hidden
email@hidden
_______________________________________________
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.

  • Follow-Ups:
    • Re: Setting and getting a file's icon in OS X?
      • From: Seth Milliken <email@hidden>
  • Prev by Date: Re: port error (targeting)
  • Next by Date: Re: Window arrows - Thank you
  • Previous by thread: Setting and getting a file's icon in OS X?
  • Next by thread: Re: Setting and getting a file's icon in OS X?
  • Index(es):
    • Date
    • Thread