Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > small applescript question

small applescript question
Thread Tools
Mac Elite
Join Date: Dec 2003
Location: I'll let you know when I get there...
Status: Offline
Reply With Quote
Jan 1, 2004, 07:02 PM
 
is there a way to copy the icon of one file and apply to another? if so how would I go about doing this?
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Jan 2, 2004, 06:14 AM
 
There is probably some way of doing it through UI scripting - but it seems that AppleScript does not do icons any more:

Code:
set chosenFile to choose file without invisibles tell application "Finder" get properties of chosenFile get info for chosenFile set theIcon to icon of chosenFile end tell
yields:

Code:
tell current application choose file without invisibles alias "WideBoy:Users:diggory:Desktop:Picture 1.pdf" end tell tell application "Finder" get properties of alias "WideBoy:Users:diggory:Desktop:Picture 1.pdf" {class:document file, name:"Picture 1.pdf", index:17, displayed name:"Picture 1", name extension:"pdf", extension hidden:true, container:folder "Desktop" of folder "diggory" of folder "Users" of startup disk, disk:startup disk, position:{-1, -1}, bounds:{-33, -33, 31, 31}, kind:"PDF Document", label index:0, locked:false, description:missing value, comment:"", size:7.5219E+4, physical size:8.192E+4, creation date:date "Wednesday, December 31, 2003 8:17:05 pm", modification date:date "Friday, January 2, 2004 12:10:10 pm", icon:missing value, URL:"file://localhost/Users/diggory/Desktop/Picture%201.pdf", owner:"diggory", group:"diggory", owner privileges:read write, group privileges:read only, everyones privileges:read only, file type:"PDF ", creator type:"????", stationery:false, product version:"", version:""} info for alias "WideBoy:Users:diggory:Desktop:Picture 1.pdf" {name:"Picture 1.pdf", creation date:date "Wednesday, December 31, 2003 8:17:05 pm", modification date:date "Friday, January 2, 2004 12:10:10 pm", icon position:{0, 0}, size:7.5219E+4, folder:false, alias:false, name extension:"pdf", extension hidden:true, visible:true, package folder:false, file type:"PDF ", file creator:"????", displayed name:"Picture 1", default application:alias "WideBoy:Applications:Preview.app:", kind:"PDF Document", locked:false, busy status:false, short version:"", long version:""} get icon of alias "WideBoy:Users:diggory:Desktop:Picture 1.pdf" missing value end tell
The file in question does have a custom icon.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:36 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2