Hello
You may try GetFileInfo(1) command in Developer Tools to check the attribute bit for custom icon. Something like CODE1.
--CODE1
set p to POSIX path of (choose folder)
do shell script ("/Developer/Tools/GetFileInfo -ac " & quoted form of p)
set hasCustomIcon to result as integer -- 0 or 1
return hasCustomIcon
--END OF CODE1
cf.
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/GetFileI nfo.1.html
Or you may check the presence of actual icon file in the target folder. Something like CODE2.
*Note the fact that there is "Icon\r" file does not necessarily mean the enclosing folder has custom icon (at least under OS9/Classic). So CODE2 should NOT be used if your system is configured for both OSX and OS9/Classic (unless additional code is introduced to check whether "Icon\r" file actually contains "icns" resource).
--CODE2 (for OSX-only system)
set d to choose folder
return hasCustomIcon(d) -- true or false
on hasCustomIcon(d)
(*
alias d : folder alias
* CAUTION: "Icon\r" file may exist even when it does not contain custom icon.
(Under OS9/Classic, this file may also contain custom column setting in list view,
which under OSX is stored in ".DS_Store" file.)
*)
set nn to {"Icon" & return, ".VolumeIcon.icns"} -- list of possible icon file names
set dp to d as Unicode text
if dp does not end with ":" then error "Given alias is not directory: " & dp number 9000
repeat with n in nn
try
(dp & n) as alias
return true
on error -- the node does not exist
end try
end repeat
return false
end hasCustomIcon
--END OF CODE2
Hope this may help,
H