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

Re: How to copy the icon of a selected item


  • Subject: Re: How to copy the icon of a selected item
  • From: KOENIG Yvan <email@hidden>
  • Date: Thu, 26 Jan 2012 17:19:40 +0100

Le 26 janv. 2012 à 16:37, Barry Fass-Holmes a écrit :

> 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!


Hi Barry I assume that you selected a file's icon.

If I'm right you must move the instruction
set newicon to selection as alias
in the tell application "Finder" block.
As is, the script decipher the selection as the one in the Script Editor.

Yvan KOENIG (VALLAURIS, France) jeudi 26 janvier 2012 17:19:36


 _______________________________________________
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


References: 
 >How to copy the icon of a selected item (From: Barry Fass-Holmes <email@hidden>)

  • Prev by Date: Re: How to copy the icon of a selected item
  • Next by Date: Re: repeat while or delay
  • Previous by thread: Re: How to copy the icon of a selected item
  • Next by thread: Re: How to copy the icon of a selected item
  • Index(es):
    • Date
    • Thread