Re: Get a file's icon???
Re: Get a file's icon???
- Subject: Re: Get a file's icon???
- From: JollyRoger <email@hidden>
- Date: Thu, 07 Mar 2002 07:48:33 -0600
On 3/6/2002 9:29 PM, "Robbie Newton" <email@hidden> wrote:
>
One thing I have noticed is that for a folder full of many different files
>
thus many different icons, there is only one file called icon. Does that one
>
file hold the icons for every file in the folder?
No. The icon for the _folder_ resides in the "Icon" file in the folder.
For each _file_, the icon is a resource in that file.
>
What process do I need to go through to correctly read the associated icon
>
with a certain file? Do you have any reference on doing this? Maybe some
>
sample scripts from when you did it before???
Michelle mentioned in private that you might use the Finder to do this
rather than a third-party scripting addition, like so:
tell application "Finder" to set myIcon to myFile's icon
This does return icon data; however because I have not figured out how to
*display* the data that the Finder returns, I am unable to verify whether
this is the icon data you are looking for.
Maybe someone else can help here. I've tried the following methods to
display what the Finder returns with no luck so far:
-- display dialog with the whole icon data structure:
display dialog (myFile as text) with icon myIcon
-- display dialog with one field of the icon data structure:
display dialog (myFile as text) with icon (myIcon's large one bit icon)
-- Dialog Director with the entire data structure:
set dTemplate to {size:{400, 103}, style:movable dialog, closeable:true,
name:"Icon Viewer", default item:3, contents:{,
{class:icon, bounds:{16, 16, 48, 48}, contents:(myIcon's large one bit
icon)}, ,
{class:static text, bounds:{64, 16, 384, 48}, contents:(myFile as
text)}, ,
{class:push button, bounds:{309, 64, 383, 84}, name:"OK"}}}
dd install with fonts {name:"Gadget", size:12} with grayscale
set theDialog to dd make dialog dTemplate
repeat
set itemHit to dd interact with user
if itemHit = -1 or itemHit = 3 then
exit repeat
end if
end repeat
dd uninstall
-- Dialog Director with one field of the data structure:
set dTemplate to {size:{400, 103}, style:movable dialog, closeable:true,
name:"Icon Viewer", default item:3, contents:{,
{class:icon, bounds:{16, 16, 48, 48}, contents:(myIcon's large one bit
icon)}, ,
{class:static text, bounds:{64, 16, 384, 48}, contents:(myFile as
text)}, ,
{class:push button, bounds:{309, 64, 383, 84}, name:"OK"}}}
dd install with fonts {name:"Gadget", size:12} with grayscale
set theDialog to dd make dialog dTemplate
repeat
set itemHit to dd interact with user
if itemHit = -1 or itemHit = 3 then
exit repeat
end if
end repeat
dd uninstall
JR
_______________________________________________
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.