Le 26 mai 2010 à 21:05, Luther Fuller a écrit :
On May 26, 2010, at 1:24 PM, Martin Michel wrote:
Some time ago I wrote a small tool to set an image as the icon for a certain file/folder, of course it also works with icns files. The name of the tool is a bit weird, but maybe you can use it:
I took a quick look at that page. It does not seem to work with folders.
In my experience, the only way to assign an icon to a folder is to first, copy the icon from a Get Info window, then paste the icon into the Get Info for the folder.
There may be other ways to do this, I just haven't seen one, yet.
--[SCRIPT colle_icone_v3]
(* utilise seticon
with a workaround for non-ASCII chars*)
on run
open ((choose file) as list)
end run
on open (sel)
local tName, f, coF, nocoF, coFut, Fut
tell application "Finder"
set f to (sel's item 1) as alias
set coF to (container of f) as alias
set {nocoF, tName} to {name of coF, "osxutils_slituxso"}
set name of coF to tName (* renomme provisoirement *)
end tell -- to Finder
do shell script "/usr/local/bin/seticon " & quoted form of POSIX path of f & " " & quoted form of POSIX path of coF
tell application "Finder"
set name of (coF as alias) to nocoF (* remet le vrai nom *)
update coF
end tell
end open
--[/SCRIPT]
-- "Macintosh HD:usr:local:bin:GetAliasTarget"
-- "Macintosh HD:usr:local:bin:seticon"
Which calls a shell command named from osxutil named seticon.
In this Web page you may find
an other example using seticon
and a python piece of code which seems to be OK under 10.6 (seticon isn't).
Yvan KOENIG (VALLAURIS, France) mercredi 26 mai 2010 21:41:54