• 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
How to copy the icon of a selected item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to copy the icon of a selected item


  • Subject: How to copy the icon of a selected item
  • From: Barry Fass-Holmes <email@hidden>
  • Date: Thu, 26 Jan 2012 15:37:00 +0000
  • Date: Thu, 26 Jan 2012 06:29:28 -0800

Hello,

The following script, which is intended to copy a selected item's icon (folder or file) and is based upon the script at http://hints.macworld.com/article.php?story=20091111215845472, returns an error.

set newIcon to selection as alias
tell application "Finder"
activate
set infoWindow to open information window of newIcon
set infoWindowName to name of infoWindow
end tell


tell application "System Events"
tell application process "Finder"
tell window infoWindowName
keystroke tab
delay 1
keystroke "c" using command down
close infoWindow
end tell
end tell
end tell


The error is as follows.

error "Can’t make insertion point after character 386 of text of document \"Copy icon of selected item.scpt\" into type alias." number -1700 from insertion point after character 386 of text of document "Copy icon of selected item.scpt" to alias

How should the set selection command be written instead of "as alias?"

Could someone please explain/teach me how come "as alias" is improper in the above script but works in the script at the referenced Mac OS X Hints page? I don't understand.

Many thanks in advance!

Barry

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to copy the icon of a selected item
      • From: KOENIG Yvan <email@hidden>
    • Re: How to copy the icon of a selected item
      • From: Christopher Stone <email@hidden>
  • Prev by Date: Re: repeat while or delay
  • Next by Date: Need infos about Final Cut Pro X
  • Previous by thread: Re: repeat while or delay
  • Next by thread: Re: How to copy the icon of a selected item
  • Index(es):
    • Date
    • Thread