Iconizer

Joined
Jul 21, 2007
Messages
1,252
Reaction score
15
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!
 

Attachments

  • Iconizer Apple Script & App.zip
    522.2 KB · Views: 388
Joined
Jul 21, 2007
Messages
1,252
Reaction score
15
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
 

Attachments

  • GenericIcon.jpg
    GenericIcon.jpg
    56.3 KB · Views: 452
  • PictureIconizer.app.zip
    72.4 KB · Views: 344
Top