I use Adobe Lightroom as an integral part of my digital photography workflow, and I recently acquired a Canon EOS 5D Mark-II digital camera, which is capable of capturing 1920x1080 HD video.
The problem I am having is that Lightroom does not provide support for importing video, so every time I insert my compact flash card containing images and video captured using the 5D MKII, I am notified of videos on the card that cannot be transferred into my Lightroom database…I then have to click OK to dismiss this notification message, then I have to manually browse the card to find the movies and copy them to my computer manually…
While this might not seem like that big of an issue, I’ve become accustomed to this process being a completely automated, so to go back to having to perform a number of steps manually seems a bit too much like backtracking to me, so I was hoping that someone here might be able to help me automate this process via AppleScript…
[b] ¢ Ideally, a script that could be executed on my “EOS_Digital” volume (my CF card’s name, which will always remain the same), and will scour the contents of that volume for .MOV files, and upon finding such files, it would copy them all to my ~/Movies/ directory before then removing (deleting) them from the card completely…
¢ The CF card will also contain .THM files that correspond to the .MOV files to provide thumbnails of the .MOV files for Windows users...I would ideally like to have these moved along with the .MOV files to the ~/Movies/ directory (or trashed completely), because Lightroom give me a notification warning that they cannot be imported into the image database
¢ I would trigger the script via QuickSilver (or FastScripts, QuicKeys, etc), which I could do manually after inserting my CF card...[/b]
I know it’s a long shot that someone would be willing to help me out with this task, but any help at all would be greatly appreciated!!
Thanks so much, and I look forward to your responses!
this task can be done automatically using launchd.
¢ Create a folder launchd in ~/Library/Scripts/ (~ is your home directory).
¢ Save this script with name WatchingVolumesFolder.scpt in ~/Library/Scripts/launchd
property CFCard : "EOS_Digital"
property CFstate : false
if (CFCard is in (do shell script "/bin/ls /Volumes")) then
if CFstate is false then
set CFstate to true
set movieFolder to quoted form of POSIX path of (path to movies folder)
do shell script "/usr/bin/mdfind -onlyin /Volumes/" & CFCard & " -0 'kMDItemFSName = \"*.mov\" || kMDItemFSName = \"*.thm\"' | xargs -0 -J {} mv {} " & movieFolder
end if
else
if CFstate is true then set CFstate to false
end if
¢ Create a plain text file with this content
[code]<?xml version="1.0" encoding="UTF-8"?>
Label
WatchingVolumesFolder
LowPriorityIO
Program
/usr/bin/osascript
ProgramArguments
osascript
/Users/myUser/Library/Scripts/launchd/WatchingVolumesFolder.scpt
WatchPaths
/Volumes
[/code]
¢ replace [b]myUser[/b] with the short name of your user account
¢ save the text file UTF-8 encoded named [b]WatchingVolumesFolder.plist[/b] into ~/Library/LaunchAgents (if the folder doesn't exist, create it)
¢ in Terminal type [b]launchctl load -w '/Users/myUser/Library/LaunchAgents/WatchingVolumesFolder.plist'[/b] (replace again myUser)
If there are no error messages, all .mov and .thm files will be moved automatically to ~/Movies right after the card appears on desktop.
Thanks so much for your reply! I set everything up just as you said, but it doesn’t seem to have worked (even though no error messages were generated)??
Would it matter that the .MOV & .THM files are not in the root directory of the EOS_DIGITAL volume? If so, here is the folder structure that they will be located within:
Other thoughts as to why it might not have worked for me…
– You’d mentioned that “if there are no error messages, then the files will be moved right after the card appears on the desktop”…Would it matter if I have the Finder’s preferences setup such that external drives don’t appear on the desktop?
– Do I need to make anything executable, or change the permissions of anything in order for this script to run effectively? If so can you please provide me the terminal command to do so?
– Is the terminal command listed below something that I will typically want launched at start-up:
Would it in some way cause the process of copying the .MOV & .THM files to fail if I launched this process before the CF card was mounted?
On a side note…is there a way that the .MOV & .THM files can be moved to a sub-directory of my ~/Movies folder called “5D MKII Movies”, instead of just droppping them into the root of my Movies folder?
Thanks so much, and I look forward to hearing back from you so that I can get this process setup and working correctly!
No, it doesn’t matter, but the volume must not be excluded from indexed by Spotlight
No, the volume must just appear in the folder /Volumes
Also no, everything takes place in your home directory, there you have all rights.
But it could be a problem with uppercase/lowercase extensions.
If the extensions are all uppercase you should change this in the script
You have to run this command once after installing all the files. There is no further interaction required at startup.
as mentioned above, if the launchd agent is loaded once, it loads itself at startup
of cause, change this line
set movieFolder to quoted form of (POSIX path of (path to movies folder) & "5D MKII Movies")
if the CF card could not be indexed by spotlight,
here a version of the script using the find command of the shell.
According your screenshot the script assumes all files in the folder (and its subfolders) DCIM.
The script works case insensitiv, so .mov or .MOV doesn’t matter
property CFCard : "EOS_DIGITAL"
property CFstate : false
if (CFCard is in (do shell script "/bin/ls /Volumes")) then
if CFstate is false then
set CFstate to true
set movieFolder to quoted form of (POSIX path of (path to movies folder) & "5D MKII Movies")
do shell script "/usr/bin/find /Volumes/" & CFCard & "/DCIM -type f \\( -iname '*.mov' -or -iname '*.thm' \\) -exec mv {} " & movieFolder & " \\;"
end if
else
if CFstate is true then set CFstate to false
end if