Zum Hauptinhalt gehen

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

Create collection from Textfile with names?

Kommentare

16 Kommentare

  • Eric Valk
    Very likely possible.

    The lines in the text filepoint to image files - in your view have these image files already been imported into C1, or are they yet to be imported?

    How do the paths to the image files get into the text file?
    0
  • RobiWan
    Hi Eric,

    its for Files that are already in catalog.

    I do not understand what do you mean with "How do the paths to the image files get into the text file?". I know where my files are stored. My text file and C1 point to the same paths and files.
    0
  • Eric Valk
    Hi Robert
    Each data in the textfile is the path to the image, and is likely the same as a CaptureOnes images "path" property. If not identical, a small adjustment will make it so.

    For example when the CO selected variant belongs to an image file on drive "SSD_ss1"
    tell application "Capture One 11" to get path of parent image of primary variant
    --returns "/Volumes/SSD_ss1/evSSD/Photos/2014 GX7/GX7-14_0284.RW2"
    --properties "id" and "path" give the same result

    As a first draft outline, the Applescript should:
    • Open the textfile in TextEdit

    • tell C1 to make a new collection with a similar name as the TextFile

    • Read the Textfile line by line

    • for each line
      • Copy the line to a variable "theSearchPath"

      • tell C1 to find image whose path is theSearchPath"

      • tell C1 to set "foundVariant" to one of the variants of the "foundImage"

      • tell C1 to add "foundVariant" into the collection


    Now implement this in Applescript

    "Open the textfile in TextEdit"
    set theTextFileAlias to choose file with prompt "Choose TextFile:" of type {"public.text"} without invisibles
    tell application "TextEdit" to activate
    tell application "TextEdit" to set Input_Doc_ref to open theTextFileAlias


    "tell C1 to make a new collection with a similar name as the TextFile"

    tell application "TextEdit" to set theCollectionName to "TextList_" & (get name of Input_Doc_ref)
    tell application "Capture One 11" to tell current document to set ref2ResultAlbum to make new collection with properties {kind:album, name:theCollectionName}

    If you wanted to make that a little more robust (i.e. doesn't crash if the collection already exists) then you might do this:

    tell application "TextEdit" to set theCollectionName to "TextList_" & (get name of Input_Doc_ref)
    tell application "Capture One 11" to tell current document
    if not (exists collection named theCollectionName) then
    set ref2ResultAlbum to make new collection with properties {kind:album, name:theCollectionName}
    else
    if ("album" = (kind of (get collection named theCollectionName) as text)) then
    set ref2ResultAlbum to collection named theCollectionName -- if the album already exists then use it
    else
    error ("A collection named "" & theCollectionName & "" already exists, and it is not an album.")
    -- if the collection already exists but it is not an album then crash
    end if
    end if
    end tell

    Now create a loop which reads lines of the text file

    tell application "Capture One 11" to tell current document to set current collection to collection named "All Images"
    tell application "TextEdit" to tell Input_Doc_ref to set paraCount to count of paragraphs of text
    repeat with paracounter from 1 to paraCount
    tell application "TextEdit" to tell Input_Doc_ref to set theSearchPath to paragraph paracounter of text
    ## Put remaining code here
    ## Put remaining code here
    end repeat


    Now the remaining code (this goes inside the repeat loop
    • tell C1 to find image whose path is theSearchPath"

    • tell C1 to set "foundVariant" to one of the variants of the "foundImage"

    • tell C1 to add "foundVariant" into the collection

    tell application "Capture One 11"
    set foundImage to first image whose path is theSearchPath
    set foundIVariants to variants of foundImage
    add inside ref2ResultAlbum variants foundIVariants
    end tell

    When you debug all that and ensure that its working, then that last bit of code (5 lines of "remaining code") can be replaced by one line:

    tell application "Capture One 11" to add inside ref2ResultAlbum variants (get variants of (get first image whose path is theSearchPath))
    0
  • Eric Valk
    Hi Robert

    Further to the previous message and your comments, I wonder what your process is, and how much work it is, to enter the path information into that text file.

    If it's considerable work, then perhaps that step could be bypassed altogether, potentially the AppleScript could be simpler or even eliminated.
    0
  • RobiWan
    Hi Eric,

    thank you very much. I will test it

    Now my workflow or why I need it. My proffered system is Windows but C1 is with large catalog on windows not usable. So I switched to Photo Supreme as my DAM System. But I hope Phase One will fix the bugs in the future so I can use C1 as RAW Editor and DAM System.

    For now I will only read changed Metadata for selected files. I can change some Metadata in Photo Supreme and with Pascal Script (witch is Photo Supreme scripting language) I can put all selected files with path into textfile and import changed Metadta only for this selected files.
    0
  • RobiWan
    [quote="Eric Nepean" wrote:

    Now create a loop which reads lines of the text file

    tell application "Capture One 11" to tell current document to set current collection to collection named "All Images"
    tell application "TextEdit" to tell Input_Doc_ref to set paraCount to count of paragraphs of text
    repeat with paracounter from 1 to paraCount
    tell application "TextEdit" to tell Input_Doc_ref to set theSearchPath to paragraph paracounter of text
    ## Put remaining code here
    ## Put remaining code here
    end repeat



    This part won't work

    error "„TextEdit“ hat einen Fehler erhalten: „every paragraph of text“ kann nicht gelesen werden." number -1728 from every paragraph of text

    This is my example textfile
    /Volumes/DSLR/DSLR/ExtHDD 2503/EOS5DMKIII/RAW/2013/06/13/_z2a5452.cr2
    0
  • Rick Allen
    Have you tried this. Select the all images collection and then paste the list into the select by filename list which is under the edit menu. From there you could make a new collection.
    0
  • Eric Valk
    IHi Robert

    Try changing from this
    tell application "TextEdit" to tell Input_Doc_ref to set paraCount to count of paragraphs of text

    to this (i.e. deleteing "of text")
    tell application "TextEdit" to tell Input_Doc_ref to set paraCount to count of paragraphs


    Also, this line should be changed in the same way:tell application "TextEdit" to tell Input_Doc_ref to set theSearchPath to paragraph paracounter of text
    to: tell application "TextEdit" to tell Input_Doc_ref to set theSearchPath to paragraph paracounter
    This worked for me; I think the Applescript dictionary for TextEdit is a little wrong.
    0
  • Eric Valk
    I'm going to be away for a few days so here is a debugged and optimised version. The success path is tested and working.


    use AppleScript version "2.5"
    use scripting additions

    set theTextFileAlias to choose file with prompt "Choose TextFile:" of type {"public.text"} without invisibles
    tell application "TextEdit" to activate
    tell application "TextEdit" to set Input_Doc_ref to open theTextFileAlias

    tell application "TextEdit" to set theCollectionName to "TextList_" & (get name of Input_Doc_ref)
    tell application "Capture One 11" to tell current document
    if not (exists collection named theCollectionName) then
    set ref2ResultAlbum to make new collection with properties {kind:album, name:theCollectionName}
    else
    if ("album" = (kind of (get collection named theCollectionName) as text)) then
    set ref2ResultAlbum to collection named theCollectionName -- if the album already exists then use it
    else
    error ("A collection named "" & theCollectionName & "" already exists, and it is not an album.")
    -- if the collection already exists but it is not an album then crash
    end if
    end if
    end tell

    tell application "Capture One 11" to tell current document to set current collection to collection named "All Images"
    tell application "TextEdit" to tell Input_Doc_ref
    set paraList to every paragraph
    end tell

    repeat with thisPara in paraList
    set theSearchPath to get removeLeadingTrailingSpaces(removeTrailingCRLF(thisPara)) as text -- editted (1)
    try -- gracefully handles the case where the image cannot be found
    tell application "Capture One 11" to ¬
    add inside ref2ResultAlbum variants (get variants of (get first image whose path is theSearchPath))
    on error errormess
    log errormess
    end try
    end repeat

    on removeLeadingTrailingSpaces(theString)
    ## Public Domain, modified
    repeat while theString begins with space
    -- When the string is only 1 character long, then it is exactly 1 space, and the next operation willl crash. So return ""
    if 1 ≥ (count of theString) then return ""
    set theString to text 2 thru -1 of theString
    end repeat
    repeat while theString ends with space
    set theString to text 1 thru -2 of theString
    end repeat
    return theString
    end removeLeadingTrailingSpaces

    on removeTrailingCRLF(theText) -- editted (2)
    set crlfChar to {return, linefeed, character id 8233, character id 8232, " ", tab, character id 0}
    repeat while crlfChar contains the last character of theText
    if (1 = (count of theText)) then
    set theText to ""
    exit repeat
    else
    set theText to (get text 1 thru -2 of theText) as text
    end if
    end repeat
    return theText
    end removeTrailingCRLF


    ** Editted Twice
    0
  • RobiWan
    Many Thanks Eric :top:

    It works perfect, unfortunately my catalog I converted from Windows to OSX is very, very slow if I try search anything and Phase One can not or will not make it usable - I have a ticket with last entry 3 weeks ago "my colleague is showing what he can do" ☹️
    0
  • Eric Valk
    I know that they are having issues with Catalogs converted from Windows to OSX.

    I wonder if creating a blank catalog, and importing the converted Windows catalog into it, will result in a more useable catalog. The catalog structure is hopefully completely completely re-written when that is done.

    Another trick is to remove the "Filter Tool" from the Library tab.

    Filter tool consumes a lot of CPU if there are IPTC tags which are unique for every image, e.g. a date or an original file name, and there are 10s of 1000's of images.
    0
  • RobiWan
    [quote="Eric Nepean" wrote:
    I know that they are having issues with Catalogs converted from Windows to OSX.

    I wonder if creating a blank catalog, and importing the converted Windows catalog into it, will result in a more useable catalog. The catalog structure is hopefully completely completely re-written when that is done.


    I have tried several things - last time I have removed all previews and all metadata from catalog. Speed was OK but without metadata is this no wonder. Then ca. 14 days long created all previews and imported Metadata from xmp files. If I select something from filter tool I have to wait some minutes for result - beach ball ☹️

    I don't believe in it anymore but with version 12 I will give C1 a chance for the last time. Then I will finally switch to ON1 Photo RAW as RAW editor.
    0
  • Eric Valk
    Filter Tool is the issue then.

    There is a reason Filter Tool is not in any other imaging product - it is very hard to do efficiently. The equivalent to Filter Tool is not in Aperture, not in ON1, not in XNview, I think it is not in Light Room nor in Media Pro.

    Since the action of Filter Tool can be controlled, the logic of switching to another application to avoid Filter Tool delays is not clear.

    If it is on the active Tool Tab (i.e. visible), Filter Tool makes a sorted list of all unique values of every Metadata field.

    Consider that you have a folder with 10,000 images --- the browser sees 10,000 images.

    Consider that just one IPTC data field has a unique string for most of these images. Perhaps the original file name is copied to the IPTC Title.

    Referring to this one IPTC data field:
    Start by assuming that the IPTC data of the first image is unique.
    The IPTC data of the second image must be compared to the first IPTC data ==> 1 string comparison
    The IPTC data of the third image must be compared to the first 2 IPTC data ==> 2 string comparisons
    The IPTC data of the fourth image must be compared to the first 3 IPTC data ==> 3 string comparisons
    ...................
    The IPTC data of the last image must be compared to the first 9999 IPTC data ==> 9999 string comparisons

    Total: 49,995,000 string comparsions. The number of string comparisons is: 0.5*(number of images)^2
    Perhaps CaptureOne uses more efficient sorting algorithms - but the theoretical limit is approximately n*log(n) or 40,000 string comparisons for 10,000 images.

    If you have several problem IPTC Data fields the delay will be very long indeed.

    To avoid the delay of Filter Tool I remove it from the "Library" Tab, and make a custom tab for it named "Filter Tool". I only activate this tool tab in smaller collections, not the "All Images" Collection of large catalogs.

    In the large collections, I use the "Advanced Search" tool, which is much faster and has more flexibility.
    0
  • Rick Allen
    Eric you could also

    open for access file

    So that you dont need to be flicking between text editor
    0
  • Eric Valk
    Hi Rick
    I know. I'm just more confident and practiced with Text Edit right now because I use that as an output method from my scripts.
    0
  • RobiWan
    Hi Erick,

    thanks again. Phase One has many database issues ☹️
    I will check what happens if I remove filter tool, because normally I never use it. Maybe is this a workaround 😉 to stay by C1.
    0

Post ist für Kommentare geschlossen.