• 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: set selection to clipboard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set selection to clipboard


  • Subject: Re: set selection to clipboard
  • From: Mr Tea <email@hidden>
  • Date: Fri, 19 Dec 2003 00:46:00 +0000

On 18 Dec 2003, at 11.32 pm, Guillaume Iacino wrote:


My problem is that I cannot find the word to use to get the selected item.

For the folder I have:
tell application "Finder" to set the source_folder to (folder of the front window) as alias

But:

set the source item to selection does not work.

Your variable name may be the problem. Try source_item instead.

tell application "Finder"
set source_item to selection
end tell

If just one item is selected, that will get you a reference to the item (eg, file "x" of folder "y" of disk "z" of application "Finder"). If more than one item is selected, the result will be a list of these references, separated by commas and surrounded by wiggly brackets (braces)

You need to coerce that reference into a path that you can usefully put on the clipboard. This works in OS X 10.3

tell application "Finder"
activate
set source_item to selection as text
set the clipboard to source_item
end tell

 and to do the same with the path to the folder of the front window

tell application "Finder"
activate
set source_Folder to target of Finder window 1 as text
set the clipboard to source_Folder
end tell

HTH


Nick
pp Mr Tea
_______________________________________________
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.

References: 
 >set selection to clipboard (From: email@hidden (Guillaume Iacino))

  • Prev by Date: Re: what have the Romans ever done for us?
  • Next by Date: Re: [OT] Verification required for ... protected by 0Spam.com.
  • Previous by thread: Re: set selection to clipboard
  • Next by thread: Re: set selection to clipboard
  • Index(es):
    • Date
    • Thread