Skip to main content

⚠️ Please note that this topic or post has been archived. The information contained here may no longer be accurate or up-to-date. ⚠️

workaround for setting next capture copyright metadata?

Comments

9 comments

  • Eric Valk
    For the Apple script errors:

    Error 1: Try using "import settings" instead of "import options"

    Error 2: Try moving this line before the "Tell Block", this line has nothing to do with Capture One, but you're asking Capture One to do it.

    I recently helped snother user develop a backup script after each image capture, it too stored a bit of data on disk. Some commin elements to what you are trying to acheive.

    0
  • louis-philippe beauduin
    [quote="Eric Nepean" wrote:

    Error 1: Try using "import settings" instead of "import options"
    That works great. Thanks!

    Error 2: This seemed like an obvious mistake and an easy fix. But I was still struggling.
    I tried many different variations using file, alias, POSIX, as string ... no luck. Error stayed the same.
    set theDummyFile to path to resource "dummy.jpg"
    tell application "Capture One 12"
    tell newDoc to import theDummyFile ---> ERROR number -1700
    end tell
    Capture One 12 got an error: Can’t make alias "Macintosh HD:Users:MyUsername:MyScript.scptd:Contents:Resources:dummy.jpg" into type document.


    As I was writing this post for further advice, I figured it out after re-examining the script library:
    import v : Perform an image import according to what is defined in the document's import settings.
    ----import document
    --------source text or file : The file or folder to import into the document.

    Here's the correct syntax
    set theDummyFile to path to resource "dummy.jpg"
    tell application "Capture One 12"
    tell newDoc to import source theDummyFile
    end tell
    It works now.

    Thank you once again Eric, I appreciate your input!
    0
  • louis-philippe beauduin
    Sooo...

    After all this and some testing, I can confirm that this method in general does not work.
    CO does not recognise a previously imported file as a source for using Next Capture Adjustments with Metadata: 'Copy from Last'.
    Could have easily tested this before hand of course 🙄

    New approach:
    I have saved a metadata preset, which I plan to copy to CO's metadata presets folder at the start of the session and have the script replace text pName, YYYY, JobName and SessionName with specified input.
    This way the metadata will be only a few clicks away. Still better than typing it in manually I guess.
    <?xml version="1.0"?>
    <SL Engine="1200">
    <E K="Contact_Creator" V="pName" />
    <E K="Contact_CreatorsTitle" V="Photographer" />
    <E K="Name" V="generic-copyright-preset" />
    <E K="Status_CopyrightNotice" V="© YYYY pName" />
    <E K="Status_JobIdentifier" V="SessionName" />
    <E K="Status_Title" V="JobName" />
    <E K="Status_UsageTerms" V="All rights reserved" />
    </SL>


    Will update...
    0
  • louis-philippe beauduin
    1.The generic preset file is in the resources folder.
    2.The script copies preset file to the CO preset folder
    3.The following code should replace some of the text in the new preset file. Only it's not working for me. It wasn't clear from the replies I got where the error was occurring, so I added some code for troubleshooting.

    set theMetaPreset to (path to resource "cr.copreset")

    --test
    tell application "Finder"
    reveal theMetaPreset ---OK!!
    end tell
    --

    tell application "Finder"
    duplicate file theMetaPreset to folder ((path to home folder as string) & "â©Libraryâ©:Application Supportâ©:Capture One:Presets60:Metadataâ©:") with replacing
    end tell

    set newMetaPreset to ((path to home folder as string) & "â©â©Libraryâ©:Application Supportâ©:Capture One:Presets60:Metadataâ©:cr.copreset")

    --test
    tell application "Finder"
    reveal newMetaPreset ---OK!!
    end tell
    --

    set thePhotog to the text returned of (display dialog "photographer's name" default answer "")

    --replace pname--
    set stringToFind to "pname"
    set stringToReplace to thePhotog

    set theContent to read newMetaPreset as «class utf8» --->ERROR<---

    set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, stringToFind}
    set ti to every text item of theContent
    set AppleScript's text item delimiters to stringToReplace
    set newContent to ti as string
    set AppleScript's text item delimiters to oldTID
    try
    set fd to open for access newMetaPreset with write permission
    set eof of fd to 0
    write newContent to fd as «class utf8»
    close access fd
    on error
    close access newMetaPreset
    end try

    --replace yyyy--
    --replace SessionName--
    --replace JobName--
    ERROR: Can’t make "Macintosh HD:Users:USR1:â©â©Libraryâ©:Application Supportâ©:Capture One:Presets60:Metadataâ©:cr.copreset" into type file.

    Am I missing something?
    0
  • Eric Valk
    There are several different formats used for describing files, and I don't have it all at my fingertips just now.

    • Alias--> uses the ":" as separator, starts with "Macintosh HD:"
      • An Alias is locked to the file object and represents it, if you move the file, the alias changes--> the file MUST exist
        A string representation of an Alias is not locked to the object

    • POSIX--> uses "/" as separator, starts with "/"
      • a POSIX reference represents a file object but is not locked to the object

    • Finder's definition of file has some subtle differences, can't find the details just now


    Its not quite clear which line of your script is causing the error. But if you were to open Script Editor's Log History window, and select "Replies" it would show the last messages and replies before the error, and error itself. I find this very informative, if you could post that as "code" that would be informative and I might be able to help you better.

    Here is a snippet of code from something I did last October that works, it might give you a useful example.
    (I use "_ps" to designate a POSIX file reference which is a string, and "_as" to rperesent the string equivalent of an alias file reference)


    tell application "Capture One 12" to set theImageFilePath_ps to get path of parent image of primary variant

    set theImageFile_as to get (get alias POSIX file theImageFilePath_ps) as string
    tell application "Finder" to duplicate file theImageFile_as to folder backupFolder_as with replacing


    Here is another possbly useful example from my logging handler "InitializeLoqqing5()"

    -- create the document and the folder if necessary
    -- Do not use finder to test for the file existence because it has a bug that ignores leading 0's
    -- https://www.macscripter.net/viewtopic.php?id=45178
    set targetFolderParent_a to alias (get path to desktop folder as text)
    set targetFolderParent_p to get POSIX path of targetFolderParent_a
    set targetFolderName to "ScriptReports"
    set targetFolder_p to (targetFolderParent_p & targetFolderName)
    set ResultDocPath_p to targetFolder_p & "/" & DocName_Ext

    try
    set ResultDocPath_a to (get alias POSIX file ResultDocPath_p)
    on error
    try
    set targetFolder_a to (get alias POSIX file targetFolder_p) --x1
    on error
    tell application "Finder" to set newFolderRef to make new folder at targetFolderParent_a with properties {name:targetFolderName}
    set targetFolder_a to newFolderRef as alias
    end try
    tell application "Finder" to set newFileRef to make new file at targetFolder_a with properties {name:DocName_Ext}
    set ResultDocPath_a to newFileRef as alias
    set targetFileWasCreated to true
    end try
    0
  • Hank
    Maybe I am missing something?

    If you save a user preset with all the needed copyright information
    then you can apply the style during the capture.

    OK... so if I missed the point.... consider this:

    if you setup a "hot folder" and then copy a file with the metadata into that folder
    it will be "captured" and will show up in the "Recent Captures" collection.
    Copy from last may then work as you wanted (but I did not try it)
    0
  • Sean Murphy
    Hey LPb,
    I just started looking into a solution for applying metadata pre-shooting today, as well. After reading your initial steps I think you're really close. Instead of trying to load this preset into the Metadata Next Capture Adjustment you can set it as the Styles because it sees these metadata presets the same as an image User Style.

    So, as long as you know the name of the metadata preset file you've created then you can apply it to the Next Capture Adjustments with the following (**NOTE - exclude the file extension**):


    tell application "Capture One 11"
    set apply styles of next capture settings of current document to {("Name_Of_Preset_File")}
    end tell



    You can also use multiple metadata presets and/or User Style files by comma separating within the curly brackets. Example:

    set apply styles of next capture settings of current document to {("19-04-23 modelName AM1 B9 photogName W"), ("ASCCC1234567890"), ("onFig_storeName_white")}


    I have confirmed that these apply in Capture One 11 but don't have a camera on-hand to confirm that the data is correctly applied on capture. We use this daily for User Styles and that works as expected. Just haven't testing with metadata.

    [quote="LPb" wrote:
    Sooo...

    After all this and some testing, I can confirm that this method in general does not work.
    CO does not recognise a previously imported file as a source for using Next Capture Adjustments with Metadata: 'Copy from Last'.
    Could have easily tested this before hand of course 🙄

    New approach:
    I have saved a metadata preset, which I plan to copy to CO's metadata presets folder at the start of the session and have the script replace text pName, YYYY, JobName and SessionName with specified input.
    This way the metadata will be only a few clicks away. Still better than typing it in manually I guess.
    <?xml version="1.0"?>
    <SL Engine="1200">
    <E K="Contact_Creator" V="pName" />
    <E K="Contact_CreatorsTitle" V="Photographer" />
    <E K="Name" V="generic-copyright-preset" />
    <E K="Status_CopyrightNotice" V="© YYYY pName" />
    <E K="Status_JobIdentifier" V="SessionName" />
    <E K="Status_Title" V="JobName" />
    <E K="Status_UsageTerms" V="All rights reserved" />
    </SL>


    Will update...
    0
  • Sean Murphy
    Just confirmed this to work as expected with next shots.


    tell application "Capture One 11"
    set apply styles of next capture settings of current document to {("Name_Of_Preset_File")}
    end tell
    0
  • Sean Murphy
    Finding one issue with using the metadata preset in the Styles of Next Capture Adjustments. It seems to clear the metadata preset from NCA upon quitting of Capture One. Seems that it needs to be manually or programmatically set each time Capture One is opened. User Styles do not seem to clear, though. Just the User Presets.

    I'm only concerned about this with CO crashes or when a user restarts the app in hopes of clearing some other issue. Users forget to check these settings so we'll need to try re-setting with each new item that they photograph.

    Both Capture One 11 and 12 act in this way.
    0

Post is closed for comments.