• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Get the icon to the clipboard?????
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get the icon to the clipboard?????


  • Subject: Re: Get the icon to the clipboard?????
  • From: Nigel Garvey <email@hidden>
  • Date: Fri, 8 Mar 2002 01:13:06 +0000

Robbie Newton wrote on Thu, 07 Mar 2002 15:37:14 -0500:

>Hello everyone,
>
>I am using this script below to get the icon of a file or folder (I think).
>
>tell application "Finder"
> try
> set myFile to (choose folder with prompt "Select a file to get the
>icon...")
> on error errMsg number errNum
> if errNum = -128 then
> error number -128
> end if
> end try
> set myIcon to the icon of myFile
> set myImage to myIcon as picture
> set the clipboard to myImage
>end tell
>
>I do not understand why this will not work.

Leave out the 'as picture' line and activate the Finder to bring it to
the front. Only the frontmost application has access to the clipboard.

set myFile to choose file
tell application "Finder"
activate -- bring the Finder to the front
set myIcon to myFile's icon
set the clipboard to myIcon
end tell

You then 'activate' your other application and paste from the clipboard.
Alternatively, if your other app is scriptable and can accept the icon
from a variable, leave out the clipboard altogether and just tell the
other app to do whatever with 'myIcon'.

NG
_______________________________________________
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.

  • Follow-Ups:
    • Re: Get the icon to the clipboard?????
      • From: Robbie Newton <email@hidden>
  • Prev by Date: Re: Microsoft's AppleScript support (was Re: What sort of monopoly...)
  • Next by Date: Re: Get a file's icon???
  • Previous by thread: Re: Get the icon to the clipboard?????
  • Next by thread: Re: Get the icon to the clipboard?????
  • Index(es):
    • Date
    • Thread