Mac Help Forums


Reply
 
Super Moderator
Walrus666's Avatar
Join Date: Jul 2007
Location: Chicago
Posts: 1,207
 
      5th November 2007
Hello, here's a pretty cool Apple Script that you might enjoy. I call it the "Iconizer". It transfers icons from files and folders to other files and folders and vice versa. I also threw in the Iconizer app and some cool folders to practice with. Enjoy!
Attached Files
File Type: zip Iconizer Apple Script & App.zip (522.2 KB, 43 views)
 
Reply With Quote
 
 
 
 
Super Moderator
Walrus666's Avatar
Join Date: Jul 2007
Location: Chicago
Posts: 1,207
 
      9th November 2007
Perhaps I should paste the script here for those who are a bit apprehensive of downloading. The script has one annoying limitation, however. If the source object is a jpeg with a generic icon (See attachment 1), the generic icon will be transferred to the target object. I have a shell script (sips -i "$@") that I made in to an app called "PictureIconizer" (See attacment 2) that I'd like to add to this Apple Script, which should solve this limitation, when I have the time (In the U.S. it's work, work and work!). Perhaps Ric could knock this out for us if he'd be so kind. Here's the Iconizer Apple Script-


on run {}
set theSourceObject to my DetermineLocationOfObject("source")
set theTargetObject to my DetermineLocationOfObject("target")
my ApplyCustomIcon(theSourceObject, theTargetObject)
end run

to DetermineLocationOfObject(ObjectType)
display dialog "Is the " & ObjectType & " object going to be a file or a folder?" buttons {"File", "Folder"} default button 2
if button returned of the result is equal to "File" then
set theObject to choose file with prompt "Please locate the " & ObjectType & " file."
else
set theObject to choose folder with prompt "Please locate the " & ObjectType & " folder."
end if
return theObject
end DetermineLocationOfObject

to ApplyCustomIcon(SourceObject, TargetObject)

my HandleInfoWindow("source", SourceObject)
my HandleInfoWindow("target", TargetObject)

end ApplyCustomIcon

to HandleInfoWindow(ObjectType, theObject)

tell application "Finder"
activate
set InfoWindow to name of (open information window of item theObject)
end tell

tell application "System Events"
tell application process "Finder"
tell window InfoWindow
keystroke tab
if ObjectType is equal to "source" then
keystroke "c" using command down
else
keystroke "v" using command down
end if
end tell
end tell
end tell

tell application "Finder"
close window InfoWindow
if ObjectType is equal to "target" then display dialog "Icon transferred." buttons {"OK"} default button 1 giving up after 5
end tell

end HandleInfoWindow
Attached Thumbnails
Iconizer-genericicon.jpg  
Attached Files
File Type: zip PictureIconizer.app.zip (72.4 KB, 31 views)
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting 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 Off



All times are GMT +1. The time now is 02:31 PM.
Mac-Help.com is an independent website and is not affiliated with Apple Inc.


Welcome!
Welcome to the Mac Help Forums
 


Latest Threads
New book about Steve Jobs << take part in it!
Arjan (4 Hours Ago, 09:37 AM)

Help! Stupid computer is automatically logging me out
Elizaboo (15 Hours Ago, 10:41 PM)

URGENT Help. Crazy talk Mac!
Joeker (16 Hours Ago, 09:42 PM)

PDF Document
yura (1 Day Ago, 12:13 PM)

Difficulties with internet speed (nothing to do with connection)
sammethh (1 Day Ago, 06:36 AM)

 


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51