Re: iconquestion
Re: iconquestion
- Subject: Re: iconquestion
- From: Richard 23 <email@hidden>
- Date: Tue, 3 Dec 2002 15:37:27 -0800
brmic asked:
>
>> how can i get the icon of any folder/app/file to the clipboard (or save
>
>> it anywhere)?
well, it kinda depends on what you want do with it once it's there.
If the goal is to automate a copy and paste from one Finder item
to another you can do it without using the clipboard
tell app "Finder" to set icon of file 1 to icon of file 2
I noticed that when pasting an icon by hand using the clipboard obtained
via script required that the resulting icon family be coerced to a
plain old record before the paste command was enabled.
tell app "Finder"
get icon of disk 1
set the clipboard to result
end tell
the clipboard
{class:record} & result
result as record
set the clipboard to result
a richer set of data is copied to the clipboard when copying an icon
from a Finder info window by hand than occurs via script. The icon
is copied as icon suite and as a PICT in addition to the icon family
data (large/small monochrome icon and mask, large/small 8 bit icon)
small monochrome icon and mask, 64}.
The Finder's Show Clipboard window only seems to recognize and display
the PICT data.
If you wanted to save one or more icons to a file you could store
them in a property of a script object and save the script object
to a file. A simple way to do that follows:
-- -------------------------------------
script
property parent : AppleScript
script
property icon : the clipboard
return my icon
end script
end script
run script result
store script result in file "Private:icon data"
-- -------------------------------------
Why the nested script object and the parent property set to AppleScript?
store script stores a script along with it's parent context (the script
which contains it). If you just want to store some values without the
extra baggage it helps to wrap that rascal otherwise the resulting file
is the same size as your original script + the data you're storing.
Hope this is helpful in some way.
Richard 23
_______________________________________________
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.