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. ⚠️

Importing images and the import settings class

Comments

2 comments

  • Eric Valk
    Here's working code for your application; you can't use the "settings" variable as an intermediate


    use AppleScript version "2.4" -- always use this in the first line (specify 2.4 or 2.5)
    use scripting additions -- always use this in the first line to handle an obscure Applescript bug

    set debug_notify to true
    set debug_log to false
    set restore_CL to true


    set download_file_path_a to (get path to downloads folder)
    set import_folder__name to "Capture One Import"
    set import_folder__path to get POSIX path of (get download_file_path_a as string) & import_folder__name
    if debug_log then log "Import Folder "" & import_folder__path & """
    if debug_notify then display notification "Import Folder "" & import_folder__path & """

    tell application "Capture One 11"
    set theDoc to first document
    set theDestinationType to (destination type of import settings of theDoc) as text
    set destination type of import settings of theDoc to custom
    set destination folder of import settings of theDoc to import_folder__path
    ## Can't just use "current location" since this will fail if the localisation is not english
    if restore_CL or ("current location" = (get current location as text)) then set destination type of import settings of theDoc to current location
    end tell


    Edit
    • Fixed a problem in the last line

    • Handles the case when user has both catalogs and sessionsopen

    • improved the tell structure


    use AppleScript version "2.4"
    use scripting additions
    set debug_notify to true
    set debug_log to true
    set restore_CL to false


    set download_file_path_a to (get path to downloads folder)
    set import_folder__name to "Capture One Import"
    set import_folder__path to get POSIX path of (get download_file_path_a as string) & import_folder__name
    if debug_log then log "Import Folder "" & import_folder__path & """
    if debug_notify then display notification "Import Folder "" & import_folder__path & """

    tell application "Capture One 11"
    set theDocs to (get every document whose kind is catalog)
    if 0 = (count of theDocs) then error "There are no catalogs open"
    ## Do something if there is more than one catalog open?
    tell (get first item of theDocs) to tell its import settings
    set theDestinationType to destination type as text
    set destination type to custom
    set destination folder to import_folder__path
    if debug_log then
    set theProperties to (get properties) -- do not combine with the next line or you will get the properties of the script
    tell me to log {"Properties of "Import Settings": ", theProperties}
    end if
    ## Example - shouldn't use "current location" for logical tests because this will fail if the localisation is not English
    if restore_CL or (theDestinationType = (get current location as text)) then set destination type to current location
    end tell
    end tell
    0
  • iKenndac
    Hi Eric,

    Thank you very much for your help! I really appreciate it 😄
    0

Post is closed for comments.