EXIFtool script
Can someone point out where I am going wrong... Script keeps returning: error "Capture One 12 got an error: Error: File not found - 7773" number 1
set Aperture to 1.8
set theRespondedAperture to the text returned of ¬
(display dialog ¬
"What's the aperture value?" default answer Aperture ¬
with icon note buttons {"Cancel", "Continue"} default button "Continue")
tell application "Capture One 12"
set selectedVariants to get selected variants
repeat with i from 1 to number of items in selectedVariants
set this_item to item i of selectedVariants
set theID to id of (parent image of this_item)
do shell script "/usr/local/bin/exiftool -overwrite_original_in_place -preserve -m " & ¬
" -LensSerialNumber='1240777'" & ¬
" -Lens='Nikon Series E 50mm 1:1.8 LTii'" & ¬
" -LensModel='Nikon Series E 50mm 1:1.8 LTii'" & ¬
" -LensType='Nikon Series E 50mm 1:1.8 LTii'" & ¬
" -FocalLength='50'" & ¬
" -FocalLengthIn35mmFormat='54'" & ¬
" -MaxApertureValue='1.8'" & ¬
" " & quoted form of theID
--Remove the log statement when no longer needed. Used just for demo
-- log theID
reload metadata this_item
end repeat
end tell
0
-
Hi
One key issue is that you are asking Capture One to run a "do shell script" - but "do shell script" is not a command that you can send to Capture One - if you look in the Capture One Dictionary you will not find it.
"do shell script" is a command of Scripting Additions: Standard Additions: Miscellaneous Commands (see AppleScript Help, also the Applescript Dictionary for Standard Additions)
So you have to write: tell me to do shell script ..... which asks the entity which is running the the script to execute it, and this entity (Script Editor for now) will end up finding something in OSX to do it.
A second key issue is that the ID of an image is no longer its path in Capture One 12. The ID was the path, in previous versions of Capture One, but that was a poor implementation.This is better, now its just a number.
To get the file path, you need to use: get path of (parent image of this_item)
Below is a slight modification of your code, with the shell script part temporarily bypassed.
Open the Script Editor Log, and click on the replies window. When you run this script, you will see the values returned by Capture One in the replies window.
Once you are comfortable that this part is working, then you can remove the the "if false" (permanent) or replace it by "If true" (temporary).
I note that your ExifTool command doesn't write the value of theRespondedAperture to the file, you will probably want to fix that too.
use AppleScript version "2.4"
use scripting additions
set DefAperture to 1.8
set theRespondedAperture to the text returned of ¬
(display dialog ¬
"What's the aperture value?" default answer DefAperture ¬
with icon note buttons {"Cancel", "Continue"} default button "Continue")
tell application "Capture One 12"
set selectedVariants to get selected variants
repeat with i from 1 to number of items in selectedVariants
set this_item to item i of selectedVariants
set theID to id of (parent image of this_item)
set theFilePath to path of (parent image of this_item)
if false then
tell me to ¬
do shell script "/usr/local/bin/exiftool -overwrite_original_in_place -preserve -m " & ¬
" -LensSerialNumber='1240777'" & ¬
" -Lens='Nikon Series E 50mm 1:1.8 LTii'" & ¬
" -LensModel='Nikon Series E 50mm 1:1.8 LTii'" & ¬
" -LensType='Nikon Series E 50mm 1:1.8 LTii'" & ¬
" -FocalLength='50'" & ¬
" -FocalLengthIn35mmFormat='54'" & ¬
" -MaxApertureValue='1.8'" & ¬
" " & quoted form of theFilePath
--Remove the log statement when no longer needed. Used just for demo
-- log theID
reload metadata this_item
end if
end repeat
end tell0 -
Thanks that is super helpful! That makes sense as I got some of this from an old script I found on the net, it reference capture one 10...
I have not done anything with AppleScript, so I am learning the syntax as I go...
Guessing this is what your referring to... I see how it is finding the file. I set the respondedaperture variable but it's not updating that, so I must have something wrong there still...
tell application "Script Editor"
display dialog "What's the aperture value?" default answer 1.8 with icon note buttons {"Cancel", "Continue"} default button "Continue"
--> {button returned:"Continue", text returned:"1.8"}
end tell
tell application "Capture One 12"
get selected variants
--> {variant id "7780" of collection id "2" of document "Capture One Catalog"}
get id of parent image of variant id "7780" of collection id "2" of document "Capture One Catalog"
--> "7773"
get path of parent image of variant id "7780" of collection id "2" of document "Capture One Catalog"
--> "/Volumes/Data/Photography/2018/11/16/_DSF7797.RAF"
end tell
tell current application
do shell script "/usr/local/bin/exiftool -overwrite_original_in_place -preserve -m -LensSerialNumber='1240777' -Lens='Nikon Series E 50mm 1:1.8 LTii' -LensModel='Nikon Series E 50mm 1:1.8 LTii' -LensType='Nikon Series E 50mm 1:1.8 LTii' -FocalLength='50' -FocalLengthIn35mmFormat='54' -MaxApertureValue='theRespondedAperture' '/Volumes/Data/Photography/2018/11/16/_DSF7797.RAF'"
--> " 1 image files updated"
end tell
tell application "Capture One 12"
reload metadata variant id "7780" of collection id "2" of document "Capture One Catalog"
end tell0 -
Yes, that's it exactly.
I think what may be happening is that the script is trying to write the name of the variable instead of the value of the variable to the Aperture Value of the file. This is guaranteed to cause problems 😄
We should be seeing [color=#0000FF:38ukimbb]-MaxApertureValue='1.8' [/color:38ukimbb] in the reply
instead of [color=#FF4000:38ukimbb]-MaxApertureValue='theRespondedAperture' [/color:38ukimbb]
Possibly what has happened is that you have a line like this [color=#FF4000:38ukimbb]" -MaxApertureValue='theRespondedAperture'" & ¬[/color:38ukimbb]
where what you need is a line like this: [color=#0000FF:38ukimbb]" -MaxApertureValue='" & theRespondedAperture & "'" & ¬[/color:38ukimbb]
Here you are joing three strings together with the [color=#00BF00:38ukimbb]&[/color:38ukimbb] operator
string 1: [color=#0000FF:38ukimbb]-MaxApertureValue='[/color:38ukimbb]
string 2: the contents of the variable theRespondedAperture converted to a string
string 3: [color=#0000FF:38ukimbb]'[/color:38ukimbb]
As on every line in this shel script, the last [color=#00BF00:38ukimbb]&[/color:38ukimbb] operator joins all this to the string on the next line, with [color=#00BF00:38ukimbb]¬[/color:38ukimbb] as your line continuation character.0 -
Thanks!! That is exactly what was needed and completely makes sense...
Thanks for the help! Now I am going to try and build a script that will read the EXIF tags in the Fuji RAW files and set the Film Simulation to match...
tell application "Script Editor"
display dialog "What's the aperture value?" default answer 1.8 with icon note buttons {"Cancel", "Continue"} default button "Continue"
--> {button returned:"Continue", text returned:"1.8"}
end tell
tell application "Capture One 12"
get selected variants
--> {variant id "7780" of collection id "2" of document "Capture One Catalog"}
get id of parent image of variant id "7780" of collection id "2" of document "Capture One Catalog"
--> "7773"
get path of parent image of variant id "7780" of collection id "2" of document "Capture One Catalog"
--> "/Volumes/Data/Photography/2018/11/16/_DSF7797.RAF"
end tell
tell current application
do shell script "/usr/local/bin/exiftool -overwrite_original_in_place -preserve -m -LensSerialNumber='1240777' -Lens='Nikon Series E 50mm 1:1.8 LTii' -LensModel='Nikon Series E 50mm 1:1.8 LTii' -LensType='Nikon Series E 50mm 1:1.8 LTii' -FocalLength='50' -FocalLengthIn35mmFormat='54' -MaxApertureValue='1.8' -ApertureValue='1.8' '/Volumes/Data/Photography/2018/11/16/_DSF7797.RAF'"
--> " 1 image files updated"
end tell
tell application "Capture One 12"
reload metadata variant id "7780" of collection id "2" of document "Capture One Catalog"
end tell0 -
[quote="NNN636504158446775775" wrote:
Now I am going to try and build a script that will read the EXIF tags in the Fuji RAW files and set the Film Simulation to match...
There’s no need! At least, C1 automatically sets the right film sim for my x100f, x-t2 and x-t3 as long as the curve is set to “autoâ€.0 -
[quote="Emile" wrote:
[quote="NNN636504158446775775" wrote:
Now I am going to try and build a script that will read the EXIF tags in the Fuji RAW files and set the Film Simulation to match...
There’s no need! At least, C1 automatically sets the right film sim for my x100f, x-t2 and x-t3 as long as the curve is set to “autoâ€.
Hmm... Mine is not doing that... I took a shot with Arcos and the import dialog preview was right but once the import was complete it changed... I haven't imported anything into version 12 yet... Let me try...0 -
Woah, it works! It doesn't change to the correct film sim in the drop down menu, but it does match the image... That's definitely new to version 12... 0 -
[quote="NNN636504158446775775" wrote:
Woah, it works! It doesn't change to the correct film sim in the drop down menu, but it does match the image... That's definitely new to version 12...
Yep, that’s v12. Turned me into one happy camper!
Have a great weekend!0
Post ist für Kommentare geschlossen.
Kommentare
8 Kommentare