Permlink Replies: 3 - Pages: 1 - Last Post: 21-Jun-2012 22:02 Last Post By: RobM
RobM

Posts: 3,243
Registered: 4-Aug-2006
Mac OS AppleScript to download only new images from a camera card
Posted: 23-Mar-2010 23:18
  Click to reply to this thread Reply
This is of no use to PC users - sorry!
If you only want to have new images transferred from a card reader to your hard drive and you don't want to keep copies on the hard drive (at least until you empty the card itself) this script will help.

It transfers all images that have not been transferred before but will not transfer those that have been, but are no longer on your hard drive. After transferring the images it will confirm the number of images on the card, the number copied and give you the option of reviewing a list of all the images transferred. It also opens a Finder window and selects the last file downloaded from the card - making it easy to find the new images.

Before using the script two terminal commands need to be run
1. Without the card reader plugged in run this script
ioreg -Src IOUSBDevice | grep '^\+' > ~/ioreg
=

2. Plug in the card reader and then run this script
ioreg -Src IOUSBDevice | grep '^\+' | diff ~/ioreg - |    tail -1 | sed 's/^> \+-o \(.*\)@.*/\1/' | pbcopy && pbpaste
=

The terminal widow will show the name of the card reader and it will also be on the clipboard (you can delete the file 'ioreg' that is in your root folder.)
Open the AppleScript in the Script Editor and edit the following lines of code (at the top of the script)
-- Script to synchronise a camera's memory card to a folder
-- Set the destination folder that is to contain the copies of images
property destination_folder : ((path to home folder) as string) & "Pictures:Camera:"
-- Set the name of the device reader
property deviceName : "Mass Storage Device"
-- Set the path to the images on the card
property cardImages : "EOS_DIGITAL:DCIM:100CANON:"


Select the string 'Mass Storage Device' and replace with the contents of the clipboard.

Replace the string 'EOS_DIGITAL:DCIM:100CANON:' with the path to the images on your memory card (that is the name of the 'disk' and all folders up to the images).

Replace the string 'Pictures:Camera:' with the path to where you want your images transferring to.

Save the modified script as an application.
Open the 'Image Capture' application and in the preferences change the 'When a camera is connected, open:' to 'Process camera images' or whatever you named the application to.

Plug in a card and it will copy all the images across on the first run, images will be filed in folders by date order (yyyy m dd) e.g.
2010 3 18
2010 3 22

On subsequent connections it will only copy new images.
I've used this script for some time now without any problems - but use it at your own risk.

NB
It will create two text files in your 'Preferences' folder:
Camera card contents - the list of images transferred across
Camera card data - the last image to be transferred
RandomMan007

Posts: 1
Registered: 19-Jun-2012
Re: Mac OS AppleScript to download only new images from a camera card
Posted: 19-Jun-2012 01:32   in response to: RobM in response to: RobM
  Click to reply to this thread Reply
Hi,
Sorry to revisit this script after such a long time, I am just getting into AppleScript to import and process my images and came across your script which looks to be exactly what I want.

I am using a Firewire card reader on my machine though, if I replace the IOUSBDevice in your terminal script with IOFireWireDevice will that do the job for me? I am not great with terminal and don't want to break anything.

ie. ioreg -Src IOFireWireDevice | grep '^\+' > ~/ioreg

Thanks in advance for the help.

Random.

Edited by: RandomMan007 on 19-Jun-2012 01:33
RobM

Posts: 3,243
Registered: 4-Aug-2006
Re: Mac OS AppleScript to download only new images from a camera card
Posted: 20-Jun-2012 21:38   in response to: RandomMan007 in response to: RandomMan007
  Click to reply to this thread Reply
Hi, I will have to look into this and get back to you. You should be able to try your idea as all the terminal code is doing is to read information from the system andthen write it to a text file. If it doesn't work you will either get an error alert or a text file that can just be deleted.
RobM

Posts: 3,243
Registered: 4-Aug-2006
Re: Mac OS AppleScript to download only new images from a camera card
Posted: 21-Jun-2012 22:02   in response to: RandomMan007 in response to: RandomMan007
  Click to reply to this thread Reply
I have looked into this a bit more and it does not seem as easy to do this with FireWire. I have found this script http://apple.stackexchange.com/questions/8090/how-to-run-applescript-on-disk-mount, which is basically saying add a Folder Action script to the /Volumes folder. Using this script, targeting your drive name, you can then run the photo copying part of my script. Let. Me know if this solves the problem or if you want me to write the full script for you, it may take me a few days to get round to it though.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums