Set photo titles to picture capture date in iPhoto
The titles iPhoto chooses for just-added photos is the annoying "IMG_nnnn" serial number from the camera. This AppleScript simply takes the date of the photo (EXIF info that iPhoto knows very well) and uses it as the photo title. The format is: yyyy-mm-dd-hh.mm.ss, so it's a bit easier to read than the ISO version, but also easily sortable. Here's the code: tell application "iPhoto" -- activate -- bring iPhoto back to front copy (my selected_images()) to these_images if these_images is {} then error "Please select some images before using this script." set thename to "" set thepaths to "" set thedates to "" repeat with i from 1 to the count of these_images set this_image to item i of these_images --set this_file to the image path of this_image set thename ...
published yesterday, 19 hours 52 minutes ago
Create Growl alerts for Address Book contacts' birthdays
I have a lot of people in my Mac OS X Address Book. I thought it would be a nice idea to have the system check the birthdays in Address Book, and inform me of any forthcoming birthdays via a Growl notification. So I've created an Apple Script to do that (with a lot of help from a few other peoples). First, install Growl if it isn't installed. Also install the Terminal growlnotify command, which you'll find in the Extras folder on the Growl disk image. Next, copy and paste the following into AppleScript Editor: delay 0.5 set isRunning to 0 set timer to the time of the (current date) repeat while isRunning = 0 tell application "System Events" set isRunning to ¬ ((application processes whose (name is equal to "GrowlHelperApp")) count) ...
published yesterday, 19 hours 52 minutes ago
Avoid a potential issue with voice control on iPhone 3GS
If you have entire albums, artists, or playlists excluded from shuffling in iTunes (The 'Skip when shuffling' flag is set), your iPhone 3GS will fail to play these albums, artists, or playlists when you select them using Voice Control if it has shuffle play mode enabled. The manner in which it fails makes it seem as if something is seriously amiss (hence this hint): It acknowledges your voice input, indicating that your selection is about to play (e.g., 'Playing album Avatar'), but then returns to whatever had been playing before. If nothing had been playing before you gave the voice command, the iPhone will remain resolutely silent after acknowledging your input. The solution to this 'issue' is, of course, to simply to turn off shuffle play mode. Unfortunately you can't do this with a voice command (as far as I know).
published yesterday, 19 hours 52 minutes ago
Experiment with GIMP's new single window mode
Are you curious, like me, about the new Single Window Mode (most excellent; see this article at Ars for more details) available in the newest unstable 2.7.x GIMP releases? Well, sadly, the final and stable GIMP 2.8 release won't come out before the end of this year, and there are still no experimental 2.7.x binary releases available for Mac OS X (via X11). One could always try to compile everything from source, but that might be quite complicated and time-consuming. So, let's look at another, definitely easier way of running GIMP 2.7.x on Mac OS X: not (semi) natively through X11, but through virtualization. First of all, we need a virtual machine with the latest Ubuntu 9.10 (Karmic), or even 10.04 (Lucid, in Alpha at this time) installed: you can create a 32- or 64-bit Ubuntu VM in...
published on Wednesday, the 10. March 2010
Use one bookmark to load different versions of a site
I have several sites that I access on both my iPhone and desktop, so I like to have quick access to them via the Bookmarks Bar. However, these sites have different versions for the desktop, for mobiles, and, in some cases, yet another version for the iPhone. Usually, the full version doesn't work so well on the iPhone, and the iPhone version is undesirable on the desktop. Instead of creating a plain bookmark, a little Javascript can make a bookmark context-sensitive, and allow you to have one bookmark that opens the right version of a page, depending on which platform you're browsing from. The basic idea is to use some client-side Javascript to check the browser's platform (a.k.a. operating system), and then tell the browser to access a URL based on that check. The code looks like this: javascrip...
published on Wednesday, the 10. March 2010
Poll updates - iPad results and new Intel/PowerPC survey
Two poll updates today. First, I've posted a new poll about the mix of Macs you're presently using -- Intel (via Apple), Intel (via build-it-yourself), PowerPC, or some mix of the above. I'm curious to see not only the mix of Intel and PowerPC, but how many are using self-built Intel powered Macs. The second poll update is that the iPad interest poll has now closed, with just over 10,000 votes. Of those who voted, nearly 44% are planning on buying iPad 1.0 when it comes out in April, with a virtual tie (two votes' difference) between then cheapest and the most expensive versions for the most-popular spot (11.3% each). In total, Mac OS X Hints readers will be buying at least (as the poll didn't allow for more than one purchase) $2.92 million worth of iPads! An additional 29% claim they'll buy the second gen...
published on Wednesday, the 10. March 2010
Disable AirPort when Ethernet cable is connected
At my office, I needed to find a way to turn of the wireless network when someone plugged in their network cable. I also did not want them to be able to turn the wireless network back on until the network cable was unplugged. I came up with the fallowing solution. I created a launchDaemon called com.companyname.ethernetmonitor, and saved it in /System » Library » LaunchDaemons: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/Prop..."> <plist version="1.0"> <dict> <key>Label</key> <string>com.companyname.ethernetmonitor</string> <key>ProgramArguments</key> <array> <string>/Library/Scripts/CompanyName/turnOffAirp...
published on Tuesday, the 9. March 2010
Clean .DS_Store, .Trash, and ._resources files prior to copy
Frequently we need to clean a directory before zipping it or copying it to an external USB drive to be used by Windows or Linux users. Apple Finder has the custom of populating directories with those unavoidable .DS_Store files, volumes with .Trashes, and some files (especially pictures) with ._resources. The following interactive script will safely remove these files prior to copying. #!/bin/sh # bash script to clean (delete) Finder .DS_Store, .Trashes and ._resources # Use cleandsstores.sh # juanfc 2010-03-06 if [ $# != 1 ] then echo "ERROR: use\n\t`basename $0` dirtoclean" exit 1 fi res=`find "$@" \( -name ".DS_Store" -or -name ".Trashes" -or -name "._*" \) -print` if [[ -z $res ]]; then echo "nothing to delete" exit 0 el...
published on Tuesday, the 9. March 2010
Create SuperDuper! backup reminders using Growl and cron
I use a couple of shell scripts that use Growl to remind me to run SuperDuper backups. The first script (backupcompleted) is set to run after each SuperDuper backup. It writes a timestamp into an invisible file called .lastbackup in my home directory; here's the script: #!/bin/bash # This script is run by SuperDuper each time a backup is completed. date "+%s" > ~/.lastbackup The second script (lastbackup) reads the .lastbackup file and calculates the time elapsed. It takes one argument: the desired number of hours to wait before showing an alert. If the elapsed time is greater than the time suppled to the script, it shows a Growl notification. If the elapsed time is greater than twice the time suppled to the script, it also increases the priority of the alert (so you can set a diferent colour for it in Growl preferences). Here's the script: ...
published on Monday, the 8. March 2010
10.6: Use AppleScript for precise trimming in QuickTime X
Most of us know that Quicktime X, included with Snow Leopard, can trim movie and audio files. However, this trim is less than precise, as you cannot specify an exact trim start and stop point. Worse yet, if you want to make 10 minute segments for YouTube, you have to write down the last trim end time, undo the previous trim after uploading, and hope the trim slider will let you select the same trim point to start your next clip. What a pain. Enter AppleScript -- trim is a scriptable function. Open your movie in Quicktime X, and open the AppleScript Editor in the Application » Utilities folder. In the AppleScript Editor enter this script: tell application "QuickTime Player" activate trim document 1 from start_trim to end_trim end tell Replace start_trim and end_trim with the time, in seconds, at which you wish ...
published on Monday, the 8. March 2010