Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

An AppleScript to reinstall custom icons after updates System
Like many people, I have customized many thing about my OS X setup, not the least of which were app and folder icons. Via programs like CandyBar or LiteIcon, or manually, any and all folder/file/app icons can be changed.

Personally, I like the pure|icns set from Interfacelift. However, there is a problem when programs update -- in my case, Dropbox -- and change their icons back to a boring old Leopard blue. To return my custom icons, I wrote an AppleScript. Since this only happens every now and then, I didn't make the script executable; I just call it from Google's quick search box whenever I need it.

At any rate, this script will copy an icon from some location (file, folder, *.icns), and paste it via the Get Info window for any second location (file, folder, app) that you desire. Of course, change the first two POSIX paths to (1) where the icon should come from, and (2) where the icon should go.
set newIcon to (POSIX file "/this/is/the/path/to/the/icon") as alias
set theItem to (POSIX file "/this/is/the/path/to/the/location") 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
    end tell
  end tell
end tell

tell application "Finder"
  close infoWindow
  set infoWindow to open information window of theItem
  set infoWindowName to name of infoWindow
end tell

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

tell application "Finder"
  close infoWindow
end tell
This script contains modified code from this script.

[robg adds: I haven't tested this one.]
    •    
  • Currently 2.60 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (15 votes cast)
 
[8,398 views]  

An AppleScript to reinstall custom icons after updates | 9 comments | Create New Account
Click here to return to the 'An AppleScript to reinstall custom icons after updates' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript to reinstall custom icons after updates
Authored by: Mac Berry on Nov 20, '09 09:20:44AM

I don't get it? How can it possibly be better to modify a script with two new paths, then run it, than to cmd>i copy, cmd>i paste?

Even if the suggestion is to save a copy with the paths for each app you might update, the time saving vs the time used must be minuscule.

If it interupted any update process to copy old icon, then paste into the new version, maybe, but I'm afraid this strikes me as yet another script to solve a problem that doesn't exist.

Sorry.



[ Reply to This | # ]
An AppleScript to reinstall custom icons after updates
Authored by: Andrew J Freyer on Nov 20, '09 10:47:12AM

For most of my applications using the Sparkle framework, I have set up automatic updates. I find that whenever a program updates in this fashion, customized icons are ignored and replaced with default icons..

Additionally some apps, Dropbox in particular, change icons without updating. Dropbox for instance likes to change my folder icons to a default icon nearly every time I restart the program.

So, for both of these reasons, I find that my Dropbox icons are changing several times per week.

You're right that it does only take but a moment to fix these icons manually, but it's irritating to have to do this as often as as I do.

So, my solution was to automate this via script to save me small moments of minor irritation several times per week - arguably the very point of automation scripting. :)

Edited on Nov 20, '09 10:51:16AM by Andrew J Freyer



[ Reply to This | # ]
An AppleScript to reinstall custom icons after updates
Authored by: Mac Berry on Nov 20, '09 01:09:25PM

Thanks Andrew. I guess I can see that having a script prepared for a given app, if that app returns to default several times a week, could be handy, though your hint didn't describe that problem.

I think I'd be asking why this is happening though - I have all my apps set up to auto update, and yet very rarely see an icon change. Maybe I just don't use custom icons enough for it to be an issue, though I do use them.

Perhaps you could use your script as a folder action, tied to a folder that you know changes when an app updates? That way you wouldn't have to do ANYTHING?



[ Reply to This | # ]
An AppleScript to reinstall custom icons after updates
Authored by: Andrew J Freyer on Nov 20, '09 01:51:36PM

I actually do have a Hazel (noodlesoft.com) rule that does just that. However, the vast majority of the time, it is the restarting of Dropbox that changes the icon.

It's bad form on Dropbox's part, and I hope that it will be fixed soon.



[ Reply to This | # ]
An AppleScript to reinstall custom icons after updates
Authored by: Andrew J Freyer on Nov 20, '09 07:10:34PM
For anyone who is having trouble with the Dropbox problem specifically mentioned in the comments above - I have started a "Troubleshooting" thread on the dropbox forum:

Dropbox Troubleshooting Forum

Edited on Nov 20, '09 07:11:01PM by Andrew J Freyer


[ Reply to This | # ]
An AppleScript to reinstall custom icons after updates
Authored by: renaultssoftware on Nov 21, '09 09:37:30AM

Not all icons are replacable for folders, I have discovered. If you try to modify /System you usually get an error.



[ Reply to This | # ]
An AppleScript to reinstall custom icons after updates
Authored by: Andrew J Freyer on Nov 21, '09 11:14:18AM

Well, I'm an idiot.

It's FAR easier and FAR better to replace the icons from within the application bundle. DOH!!!

Dropbox - Show Package Contents
Contents>Resources>DropboxFolderIcon_leopard.icns

Replace that icon with the one that you prefer, and the icon ceases to change on restart!



[ Reply to This | # ]
Drivers foe OS 10.6
Authored by: Calin on Nov 23, '09 03:40:14AM

Hello

I want to install an exernal wireless modem, i have the driver for OS 10.5, do i have any chance to install it on OS 10.6

Thanks



[ Reply to This | # ]
An AppleScript to reinstall custom icons after updates
Authored by: aata844 on Mar 17, '11 02:49:44PM
You can also use a launch daemon. something like
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.changer.icns</string>
    <key>OnDemand</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/YOU/changer</string>
    </array>
    <key>WatchPaths</key>
    <array>
        <string>/Applications/Google Chrome.app/Contents/Resources/app.icns</string>
    </array>
</dict>
</plist>
And then obviously "changer" is an executable, that just moves your .icns to the application's.

[ Reply to This | # ]