Hi,
is there a way to create a collection from a textfile with list of file names (fullpath like "/Path/To/My/Image.raw"?
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
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 to set ref2ResultAlbum to make new collection with properties {kind:album, name:theCollectionName}
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 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
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
tell application "Capture One 11" to add inside ref2ResultAlbum variants (get variants of (get first image whose path is theSearchPath))
Eric Nepean wrote:Now create a loop which reads lines of the text file
- Code: Select all
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
error "„TextEdit“ hat einen Fehler erhalten: „every paragraph of text“ kann nicht gelesen werden." number -1728 from every paragraph of text
/Volumes/DSLR/DSLR/ExtHDD 2503/EOS5DMKIII/RAW/2013/06/13/_z2a5452.cr2
tell application "TextEdit" to tell Input_Doc_ref to set paraCount to count of paragraphs of text
tell application "TextEdit" to tell Input_Doc_ref to set paraCount to count of paragraphs
tell application "TextEdit" to tell Input_Doc_ref to set theSearchPath to paragraph paracounter of text
tell application "TextEdit" to tell Input_Doc_ref to set theSearchPath to paragraph paracounter
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
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.
open for access file
Users browsing this forum: Eric Nepean and 0 guests