get file info script
-
Nice one. Do you know how to obtain data about lens (name of the lens) - within C1? I mean without external tools like Exiftool.
0 -
Thanks for the kind words.
You can't really get the lens through C1
Or more precisely, you can if C1 supports the lens profile *and* it has been applied as a lens correction.
Then you would use this version that uses the lens correction
use AppleScript version "2.4" -- Yosemite (10.10) or lateruse scripting additionsuse script "Dialog Toolkit Plus" version "1.1.3"-- Récupère les infos souhaitée et les présente dans une boite de dialogue-- Fonctionne sur une selection plusieurs photostell application "Capture One 21"set theSelectedVariantList to get selected variantsif 0 = (count of theSelectedVariantList) thentell current document to tell current collection to set theVariantList to every variantelseset theVariantList to theSelectedVariantListend ifend tellset theVariantCount to get count of theVariantListif theVariantCount = 0 then error "Did not find any variants in \"" & currentDocName & "\""repeat with theVariant in theVariantListtell application "Capture One 21"set ¬{{theDimL, theDimP}, theAltitude, theAperture, theCameraMake, theCameraModel, theCameraOwner, ¬theCaptureDate, theExposureCompensation, theExposureProgram, theFlashMode, theFocalLength, ¬theISO, theLatitude, theLongitude, theMeteringMode, theSpeed, theWB, theExtension, ¬theSize, theId, theName, thePath} ¬to get ¬{dimensions, EXIF altitude, EXIF aperture, EXIF camera make, EXIF camera model, EXIF camera owner, ¬EXIF capture date, EXIF exposure compensation, EXIF exposure program, EXIF flash mode, EXIF focal length, ¬EXIF ISO, EXIF latitude, EXIF longitude, EXIF metering mode, EXIF shutter speed, EXIF white balance, extension, ¬file size, id, name, path} ¬of parent image of theVariantset {theRating, theLocation, theCity, theState, theCountry, theColorTag} ¬to get ¬{rating, image location, image city, image state, image country, color tag} ¬of theVariantset {name_s, parent_s} to get {name, parent} of keywords of theVariantset theLens to get lens profile of lens correction of theVariantend tellset byteSize to theSize as integerset MBSize to (round (byteSize / 1.0E+5)) / 10 -- transforme en Mégaoctetsif theCameraOwner is equal to missing value then set theCameraOwner to ""set theProject to my getProject(thePath)set theKeywordPhrase to makeKeywordPhrase({name_s, parent_s})set theRatingStars to makeRating(theRating)set theColor to makeColorTag(theColorTag)set theBoldMessage to ¬theISO & space & space & space & space & theFocalLength & space & space & space & space & ¬theSpeed & space & space & space & space & theApertureset theMessage to ¬"Correction d'expo." & space & ":" & space & theExposureCompensation & space & "ev" & return & ¬"Programme" & space & ":" & space & theExposureProgram & return & ¬"Mode de mesure" & space & ":" & space & theMeteringMode & return & ¬"Flash" & space & ":" & space & theFlashMode & return & ¬"Balance des blancs" & space & ":" & space & theWB & return & ¬theLens & return & return & ¬theCaptureDate & return & ¬theLocation & return & ¬theCity & return & ¬theState & return & ¬theCountry & return & ¬"Latitude" & space & ":" & space & theLatitude & space & space & space & "Longitude" & space & ":" & space & theLongitude & return & ¬"Collection" & space & ":" & space & theProject & return & return & ¬"Fichier" & space & ":" & space & theName & return & ¬"Taille" & space & ":" & space & MBSize & space & "Mo" & return & ¬"Dimensions" & space & ":" & space & theDimL & space & "x" & space & theDimP & return & ¬"Propriétaire" & space & ":" & space & theCameraOwner & return & return & ¬theKeywordPhrase & return & ¬theColor & space & theRatingStars-- Placeholdders for different options in the displayed parameters-- thePath & return & ¬-- "Format" & space & ":" & space & theExtension & return & ¬-- "Fichier" & space & ":" & space & theName & return & ¬-- "Altitude" & space & ":" & space & theAltitude & return & ¬-- "Marque" & space & ":" & space & theCameraMake & return & ¬-- "ID" & space & ":" & space & theId & return--display dialog theMessage with title theName buttons {"OK"} default button 1 giving up after 15set accViewWidth to 300set {theButtons} to create buttons {"OK"} default button 1 given «class btns»:2set {instructionsLabel, theTop, theWidth} to create label theMessage bottom 0 max width accViewWidth aligns left aligned with multilineset {theRule, theTop} to create rule (theTop + 18) rule width accViewWidthset {boldLabel, theTop} to create label theBoldMessage bottom theTop + 12 max width accViewWidth control size large size aligns center aligned with bold typeset allControls to {instructionsLabel, theRule, boldLabel}if theCameraModel is missing value then set theCameraModel to "Info"set {buttonName, controlsResults} to ¬display enhanced window ¬theCameraModel acc view width accViewWidth ¬acc view height theTop ¬acc view controls allControls ¬buttons theButtons ¬giving up after 15 ¬with align cancel buttonend repeaton makeKeywordPhrase({name_s, parent_s})set theKeywordPhrase to ""set theStructuredList to {}repeat with i from 1 to count of name_sset {parentKeyword, aKeyword} to {get item i of parent_s, get item i of name_s}tryif parentKeyword is not equal to missing value thenif theStructuredList is equal to {} thenset theStructuredList to {{parentKeyword, {aKeyword}}}elseset keyFound to falserepeat with topic in theStructuredListif item 1 of topic is equal to parentKeyword thencopy aKeyword to the end of item 2 of topicset keyFound to trueend ifend repeatif keyFound is false thencopy {parentKeyword, {aKeyword}} to the end of theStructuredListend ifend ifend ifend tryend repeatrepeat with theLine in theStructuredListset theKeywordsLine to ""repeat with theWord in item 2 of theLineset theKeywordsLine to theKeywordsLine & theWord & ", "end repeatset theKeywordPhrase to theKeywordPhrase & item 1 of theLine & " > " & text 1 thru -3 of theKeywordsLine & returnend repeatreturn theKeywordPhraseend makeKeywordPhraseon makeRating(aRating)set theStars to ""repeat with i from 1 to aRatingset theStars to theStars & "★"end repeatreturn theStarsend makeRating-- Le projet est nommé du nom du dossier contenant la photoon getProject(thePath)set textFilep to POSIX file thePath as aliastell application "Finder"set theName to name of folder of textFilepreturn theNameend tellend getProjecton makeColorTag(aColorTag)if aColorTag = 0 thenreturn ""else if aColorTag = 1 thenreturn "🔴"else if aColorTag = 2 thenreturn "🟠"else if aColorTag = 3 thenreturn "🟡"else if aColorTag = 4 thenreturn "🟢"else if aColorTag = 5 thenreturn "🔵"else if aColorTag = 6 thenreturn "🌸"else if aColorTag = 7 thenreturn "🟣"end ifend makeColorTag0 -
Thanks. I have came to same conclusion.
0 -
A follow-up on your question: after me checking, C1 does keep the name of the lens in its internal database, which could be interrogated with the proper SQLite request. But not directly from the AppleScript Dictionnary. Check a utility such as DB Browser for SQlite to see the structure and tests some requests.
0 -
Hi, thanks. I have solved it with "brute force". A few ifs based on focal length - my lenses focal length don't over lap. In case I want to go deeper, then I will use Exiftool
0
Please sign in to leave a comment.
Comments
5 comments