Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,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.]
  Post a comment  •  Comments (7)  
  • Currently 2.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[801 views] Email Article To a Friend View Printable Version
Move forward and back in iCal with the Magic Mouse Other Hardware
The Magic Mouse lets you navigate forward and backward between web pages in Safari or Firefox with a two-finger swipe.

The same two-finger swipe also moves you forward and back in iCal. It works just the same as clicking the forward and back arrows around the day/week/month view control at the top of the iCal window.
  Post a comment  •  Comments (4)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[617 views] Email Article To a Friend View Printable Version
Back up OS X to a Windows machine on the network UNIX
I know there are plenty of back up/synchronization packages for the Mac, and I know Time Machine is awesome. But as I have a Linux/FreeBSD background, I wanted to do it my way. And none of the software I tried was able to do it my way :-). So the command line seemed to be a good solution.

My office Windows machine has plenty of disk space on it, and it is rarely used. It was an ideal system (with not so ideal a file system) to do backups on. The solution I came up with requires:
  • A shared folder on the PC, mounted on the Mac.
  • The Unix app rdiff-backup, available via MacPorts.
  • Notifications are sent using growlnotify, part of the Growl notification system.
The final step was to write a custom shell script to back up my Mac to the mounted Windows shared folder; here's what that looks like:
#!/bin/bash
# my backup script in /Users/mkljun/backup.sh

DestinationIP="148.88.226.250"
SourceIP=`ifconfig | sed -n '/en0/,/media/p' | grep -v inet6 | grep inet | awk '{print $2}'`
LOGFILE="/Users/mkljun/backup.log"
SourceDir="/Users/mkljun"
DestinationDir="/Volumes/mkljunHome/BackupMac"
SambaDrive="smb://mkljun@MKLJUNDESKTOP/mkljunHome"

## delete a log file if bigger than 50M                                                                                                     
# check if the file exists otherwise create it                                                                                              
if [ ! -f $LOGFILE ]; then `touch $LOGFILE`; fi
LOGSIZE=`ls -l $LOGFILE | awk '{print $5}'`
echo "Size of $LOGFILE = $LOGSIZE bytes."  >> $LOGFILE 2>&1
if [ $LOGSIZE -gt 50000000 ]; then rm $LOGFILE; fi


echo "************************************************************" >> $LOGFILE 2>&1
date >> $LOGFILE 2>&1
echo "************************************************************" >> $LOGFILE 2>&1
echo "Pinging destination machine $DestinationIP:" >> $LOGFILE 2>&1
# ping destination (backup) ip address; output redirected to a log file
ping -c 1 $DestinationIP >> $LOGFILE 2>&1
# check if ping successful
if [ $? != 0 ]
then
    # if ping command not successful, print notification (echo should be in one line!!)
    echo "-t 'Backup failed' -m 'Your IP is $SourceIP. Backup PC $DestinationIP could not be reached'" | xargs /usr/local/bin/growlnotify
    echo "Pinging failed" >> $LOGFILE 2>&1
else
    # mount samba drive (it should be one line)
    osascript -e "try" -e "mount volume \"$SambaDrive\"" -e "end try" > /dev/null 2<&1
    # check if mount was successful
    if [ $? == 0 ]; then
      # this echo should be in one line with a pipe
      echo "-t 'Backup' -m 'Your IP is $SourceIP. Starting backing up now'" | xargs /usr/local/bin/growlnotify
      echo "Backing up" >> $LOGFILE 2>&1
      rdiff-backup $SourceDir $DestinationDir >> $LOGFILE 2>&1
      # if rdiff-backup 
      if [ $? == 0 ]; then
        echo "-t 'Backup' -m 'Backup completed successfully'" | xargs /usr/local/bin/growlnotify
        echo "Backup completed successfully" >> $LOGFILE 2>&1
      else
        echo "-t 'Backup failed' -m 'Something was wrong'" | xargs /usr/local/bin/growlnotify
        echo "Backup failed" >> $LOGFILE 2>&1
      fi
      # delete all backups older than 2 weeks
      rdiff-backup --remove-older-than 2W $DestinationDir >> $LOGFILE 2>&1
    fi
fi
You can read the entire tutorial on my blog, and download the latest version of the script.

[robg adds: I've copied the script as it currently exists here, just in case the blog entry ever goes away. However, check the linked blog entry first for a newer version, and to read the details on how it works.]
  Post a comment  •  Comments (0)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[745 views] Email Article To a Friend View Printable Version
Restore default bootloader without harming partitions Install
If your bootloader gets changed or corrupted, this fix will restore it without damage to your disk partitions.

This hint may be a bit esoteric, but I thought I was up for a long night of reinstallation pain before stumbling upon this fix. I made the mistake of trying to use an Ubuntu 9.04 boot CD to install Ubuntu to an external (USB) drive on my Mac.

Don't do this, unless you know the following: Regardless of the fact that you chose the external drive upon which to install Ubuntu, you won't be able to boot back into your Mac without changing the bootloader. I ended up with the dreaded question mark folder when I tried to reboot my Mac, and nothing worked to boot into my OS X partition.

Luckily, I have a bootable external drive with OS X on it, and I was able to boot into it by holding down the Option key (the primary partition still did not show up).
read more (226 words)   Post a comment  •  Comments (4)  
  • Currently 5.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[721 views] Email Article To a Friend View Printable Version
10.5: Sync Sunbird calendars using iSync Apps
Tiger only hintThis hint is for Tiger only -- you'll have to modify it on Leopard or Snow Leopard, because of changes to iCal's folder structure.

I've recently switched to Mozilla Sunbird because it looks a lot nicer and runs faster than iCal, although it can't directly use iSync, so I can't synchronize the calendars on my laptop with my phone. By looking around in iCal's folder, I found out that you can copy a calendar file (.ics) from Sunbird into iCal and use that to synchronize with iSync. You can then load that synchronized calendar back into Sunbird.

There's a lot of mucking about, but it's well worth it :).
read more (322 words)   Post a comment  •  Comments (4)  
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[834 views] Email Article To a Friend View Printable Version
Add a Show Desktop icon to the Dock System
Wouldn't it be nice to activate Exposé's Show Desktop mode via an icon on the Dock? Here's how to make one that does just that. However, be warned: this works only one way -- it shows the Desktop, but on clicking again, it does not bring the windows back. To get out of Exposé's Show Desktop mode, just click anywhere along the darkened screen border.
  1. Create an AppleScript application. Open AppleScript Editor (Applications » Utilities » AppleScript Editor in 10.6) and paste in this code:
    (* Show Desktop AppleScript by Mohan Noone, 2009 *)
    activate application "Finder"
    do shell script "/Applications/Utilities/Expose.app/Contents/MacOS/Expose 1"
  2. Save the script, name it something like Show Desktop, set the File Format to Application, and select the Run Only option in the Save dialog.
  3. Optional: change the boring script icon. Select the saved file in Finder and hit Command-I to open the Get Info Window, then do the same for the file with the icon you'd like to use. Then select the better icon from its Get Info Window, copy it (Command-C), select the script icon in the other Get Info window, and paste (Command-V).
  4. Drag the saved file to the Dock.
Your Show Desktop icon is ready for use!

[robg adds: This works in 10.5 and 10.6, at least. For use in 10.5, you'll need to take /Utilities out of the do shell script line. I'm also not sure why you need to activate the Finder first; it seems to work fine for me with just the shell script line. Note that you can activate Exposé's other modes in this manner -- change 1 to 2 and you'll get Exposé's Application Windows mode, and 3 gets you All Windows mode.]
  Post a comment  •  Comments (15)  
  • Currently 3.22 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (9 votes cast)
 
[1,174 views] Email Article To a Friend View Printable Version
10.5: Change a print job's scehduled print time System 10.5
Leopard only hintIf you need to hold a print job for a period of time, but forget to change the settings in the Print dialog before sending the job to the printer, here's a solution.

When the printer's window comes up, click the Hold button, then double-click the value under "When. For the date, you'll need to enter the Unix epoch timestamp for when you would like the job to print. In case you're not fluent in UNIX epoch timestamps, you can use this free converter to convert a standard date format into the Unix epoch equivalent.

For example, if I wanted to print something at 2pm Eastern time on November 10 2009, I would enter 1257879600 into the field.

[robg adds: It seems this won't work in 10.6, because there's no When column in the 10.6 print queue window. If I'm overlooking something, please correct me and I'll remove the "10.5 only" tag from the hint.]
  Post a comment  •  Comments (0)  
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[510 views] Email Article To a Friend View Printable Version
10.6: Work around an iWeb and Pages crash issue in 10.6.2 Apps
Snow Leopard only hintRecently, I was asked to set up a web site for a church; since I didn't want to spend days doing it, I decided to try iWeb.

Things worked well until I updated to 10.6.2. Suddenly, iWeb was crashing on startup, without fail. Fortunately, someone on the Apple forums figured out a work-around.

If you've been getting crashes with iWeb or Pages that blame the SFWordProcessing Plug In, try using Font Book to disable the font named Hoefler. Even though Font Book insists the font is valid, it appears to be triggering the crash.

Once the font is disabled, you will be able to launch iWeb (and Pages) again without crashing -- although all occurrences of the Hoefler font will be rendered incorrectly.

See this discussion (and many others) for more details.
  Post a comment  •  Comments (6)  
  • Currently 2.75 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[892 views] Email Article To a Friend View Printable Version
Launch login items via AppleScript to avoid login delays System
I found that most of my startup items were things that I didn't need right away (Google Quick Search Box, LaunchBar, etc.). A simple AppleScript can be used to avoid the pileup of programs all trying to open at once at login. The result: a much faster login time.

The script works by opening programs one by one, with a little time in between. This gives the programs time to load, and allows you to use your computer as soon as you enter your password. The code looks like this:
tell application "Google Notifier" to activate
delay 3
tell application "LaunchBar" to activate
delay 3
set volume 4
tell application "BOINCManager" to activate
tell application "Quick Search Box" to activate
tell application "RealPlayer Downloader Agent" to activate
So, immediately opened is Google Notifier. Shortly thereafter comes LaunchBar. Afterwards, the volume is set to half loudness, and some other programs open.
read more (264 words)   Post a comment  •  Comments (27)  
  • Currently 4.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (12 votes cast)
 
[2,313 views] Email Article To a Friend View Printable Version
Make OS X see expanded space in RAID setup Storage Devices
I expanded my RAID from 9TB to 13TB, and after it had finished, I noticed I had to resize the partition in order to use the new space. When I used Disk Utility, I got an error saying "Partition failed with the error: MediaKit reports partition (map) too small." After googling, I found the solution on the "life as i know it" blog, and thought I'd share the basics of the solution.

From the blog post, here's the essence of the problem and the solution:
Basically what’s going on here is that the GPT table is built only big enough for the drive it’s on. That’s a logical assumption - hard drives don’t magically get larger - unless they’re RAID arrays. We’re just removing the GPT partition information, and replacing it. Should things go crazy, as long as you’ve got the start and size information for the partition you care about, you should be good. No guarantees obviously, but I’ve done this three times and no data loss yet.
Read on for a summary of the fixes involved, and see the blog post for more details...
read more (174 words)   Post a comment  •  Comments (2)  
  • Currently 4.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[970 views] Email Article To a Friend View Printable Version