Luckily, Sam Stephenson at 37signals provided me with a solution that will launch iPhoto when a camera is attached, but not when my iPhone is attached. Sam realized that within the preference pane of Image Capture, an arbitrary application can be set to launch whenever a camera is connected. This solution utilizes the shell command ioreg combined with grep to search through the USB devices connected to the computer.
The script is able to sort through the connected devices and see if a specific device is connected. If that device is connected, iPhoto will be launched. Since the application is set to run whenever a camera is connected, it provides a method of sorting between the iPhone and a digital camera. Sam does a really great job of explaining every step for those not proficient with the terminal or scripts.
While this is quite useful as is, I wanted a slightly more generic form. I wanted to launch iPhoto for every camera that was connected, but never for my iPhone. Instead of searching the I/O Kit registry for a specific camera, I decided to search for any entry containing the word Camera.
My first plan was to just edit Sam's script such that it would look for the word Camera and when found, launch iPhoto. That code looks like this:
--initialize variable to a known value
set cameraName to "0"
-- perform script to see if there is any attached USB
-- device that has the word "Camera" in its name
try
set cameraName to ¬
(do shell script "ioreg -Src IOUSBDevice | grep 'Camera'")
end try
-- if there is a camera attached, start iPhoto
if length of cameraName is greater than 6 then
activate application "iPhoto"
end if
Upon realization that grep throws an error if it cannot find what it is searching for, I decided to attempt a minimalist script. Below is a version that is slightly less intelligible by utilizing try to perform the logic.
try
do shell script "ioreg -Src IOUSBDevice | grep 'Camera'"
activate application "iPhoto"
end try
This works because if grep throws an error (i.e. the word Camera wasn't found), then the try routine is terminated before the activate... line is reached.
After copying/pasting either of these scripts into Script Editor and saving as an application, one can go to the Preferences in Image Capture and set this application to open when a camera is connected. This can be done by clicking on Other in the drop down menu, then selecting the application that was just created. Image Capture is located in the Applications folder.
I was even able to snag a snazzy icon from within the iPhoto 6 bundle to make my script look a little more professional. By control-clicking on iPhoto.app, choosing Show Package Contents and navigating to Contents » Resources, I found an image I like called import_camera.tiff. This can be set as the icon for the application by first opening import_camera.tiff in Preview and copying it to the clipboard (Command-C). Next, click on the application and bringing up the Get Info window by pressing Command-I. The process is completed by selecting the generic script icon in the upper left (with a click) and pasting the clipboard contents (Command-V) over the top.
This works well for me, but you might find Sam's specific method much more useful -- it depends on your situation. Both methods have issues when the camera and iPhone are connected at the same time.
[robg adds: This worked as described (both versions) in my testing.]

