Oops, I made an error in my late script. I was concentrated to its behaviour when the folder to treat wasn’t on the boot volume and failed to check what it does when it is on the boot volume.
This oddity is now corrected but the icon is no longer displaid.
--[SCRIPT colle_icone_v5_2] (* utilise osxutils with a workaround for accented chars*)
on run open ((choose file) as list) end run
on open (sel) local tName, f, coF, nocoF, tStorage, tempCof, _ tell application "Finder" set f to (sel's item 1) as alias (* grab source file path *) set coF to (container of f) as alias (* grab path of container of source file *)
set {nocoF, tName} to {name of coF, "osxutils_slituxso"}
try set extF to name extension of f on error set extF to "" end try
if extF is "" then set tFname to tName else set tFname to tName & "." & extF end if
set tStorage to (path to temporary items ¬ from user domain) as alias set tcoF to (tStorage as Unicode text) & tName if exists item tcoF then delete item tcoF set tcoF to (make folder at tStorage ¬ with properties {name:tName}) as alias (* create a folder without 'accented' characters *) set tF to (duplicate f to tcoF) as alias (* duplicate the source file *)
set name of tF to tFname (* rename it without 'accented' characters *) end tell -- to Finder
do shell script "/usr/local/bin/seticon " & quoted form of POSIX path ¬ of tF & " " & quoted form of POSIX path of tcoF (* crée fichier icône dans le dossier intermédiaire create icon file in the temp folder *)
tell application "Finder" to update tcoF (* to reveal the icon *)
set icN to "icon" & return set {ticN, utcoF} to {((tcoF as Unicode text) & icN), ¬ (coF as Unicode text)} do shell script "ditto --rsrc " & quoted form of POSIX path of ticN & ¬ " " & quoted form of POSIX path of utcoF (* copy the icon file into the original folder *) tell application "Finder" to update coF (* try to reveal the icon *)
end open
--[/SCRIPT]
Yvan KOENIG
|