Copy/Paste Metadata from Excel File?

Started by Rich S, October 13, 2012, 10:11:31 PM

Previous topic - Next topic

Phil Harvey

Hi Richard,

Yes, but you need to do something like quoted form of posix path of FOLDERNAME in your script to convert the folder name to a string you can use in an exiftool command.  (I'm not an expert here, but I recall seeing that in some of the AppleScript samples available from the ExifTool home page.)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Rich S

Tried this:

tell application "Finder"
   activate
   set source_folder to (choose folder with prompt "Choose PT Folder")
   open source_folder
end tell


set exiftool_path to "/usr/bin/"
set exiftool_args to "-csv=/Users/richardsc/desktop/cc_pt_automate.csv"
repeat with the_file in source_folder
   set exiftool_args to exiftool_args & " " & quote & POSIX path of the_file & quote
end repeat

do shell script exiftool_path & "exiftool " & exiftool_args


and got the "No file specified" error. The path to the csv file is accurate (cd'd & pwd'd in Terminal), so I have no idea why it isn't finding it. Attached is a screen shot of the script & the error...

Tempted to just give up at this point and manually copy/paste the metadata in LR. Wasting too much of your time.

Thanks again,

Richard



Phil Harvey

The problem is what you are doing in your loop.  If you just pass the folder name to exiftool it should work:

tell application "Finder"
activate
set source_folder to (choose folder with prompt "Choose PT Folder")
open source_folder
end tell

set theFolder to quoted form of POSIX path of source_folder
set exiftool_path to "/usr/bin/"
set exiftool_args to "-csv=/Users/richardsc/Desktop/cc_pt_automate.csv"

do shell script exiftool_path & "exiftool " & exiftool_args & " " & theFolder


I figured out what was going on by adding ""echo " & " at the start of the shell script to see what the command line looked like. (of course, echo strips the quotes, but you can't have everything)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Rich S

Holy shit. That was the sexiest thing I've ever seen (okay, maybe not, but close!!!)

It worked Phil! You have attained god status in my book. Hours of labor intensive work reduced to a few mouse clicks.

Thanks so much :)

Richard

http://www.richardschmon.com/