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

Issues running export script

Kommentare

5 Kommentare

  • Eric Valk
    I've done a lot of Applescrips for Capture One, but I've not run into these particular errors, probabaly because my scripts assume that Capture On eis already open and running.

    I've no comment on you way of starting your AppleScript, it seems complex but you probably do it that way because you're starting it from some other Application.

    I would add this line to ensure Capture One is using the intended document

    tell application "Capture One 12" to set current document to newDoc


    Regarding the intermittent errors, I would put them inside a try loop, like this below. Fine tuning tryMax and the delay should result in stable operation with a minimum of delay.

    set {trySuccess, tryMax, debug} to {false, 3, true} -- set debug to false after debugging finished
    repeat with tryCtr from 1 to tryMax
    try
    ## my problem line here
    set trySuccess to true
    exit repeat
    on error errmess
    if debug then tell me to log "Attempt " & tryCtr & " Error: " & (get errmess)
    delay 0.3
    end try
    end repeat
    if not trySuccess then error "Not successful after " & tryMax & " attempts"
    0
  • Benjamin Liddle
    Essentially I was going to suggest the same as Eric's previous response, but the quick/dirty/one-time-use way:

    ...
    if application "Capture One 12" is not running then
    tell application "Capture One 12" to activate
    repeat until isReady is true
    try
    tell application "Capture One 12"
    set newDoc to make new document with properties {kind:catalog, path:"some path"}
    end tell
    set isReady to true
    on error
    set isReady to false
    delay .1
    end try
    end repeat
    end try
    ...


    I haven't tested this yet, so probably go with Eric's suggestion 😊.
    0
  • Eric Valk
    I've been experimenting with your script and find several other issues.

    The first is clearly a Capture One bug. if you try to create a catalog with {kind:catalog, path:somePath} and no name property, as you have done, Capture One creates a catalog with the name "UntitiledSession"

    (Initially I thought that this was session, but that was not so, It is a catalog. I have cancelled Support Ticket #337761)

    For now, if you want Capture to create a new catalog reliably, then you must supply a name.

    Second, I observe that your script says that if Capture One is not running, then activate it and create a new document. (OK)

    But if it is already running, do nothing, and then the current document is used. But here you don't know if there is even a Capture One current document, if there is, what kind is it, nor what is its name, history and contents. (IMO not so OK).

    I would use a different approach:

    Use one Capture One catalog, with a designated name, and known location, as the vehicle for this script.
    Now you can easily check that it is open, does it exist, delete it, create it and so forth.

    Within this special catalog, create a new Project for each run of the script. Perhaps the Project name includes the date and Time. Within the Project there must be one album as a minimum, call it "EveryImage" if you like.

    This "EveryImage" album becomes the target collection for this Import. Now you can find your imported files, handy when you are processing them.

    At the end of the script you can keep everything, or you can delete the Project, or you can delete these images from the catalog
    0
  • Eric Valk
    [quote="ben_US" wrote:
    Essentially I was going to suggest the same as Eric's previous response, but the quick/dirty/one-time-use way:

    ...
    if application "Capture One 12" is not running then
    tell application "Capture One 12" to activate
    repeat until isReady is true
    try
    tell application "Capture One 12"
    set newDoc to make new document with properties {kind:catalog, path:"some path"}
    end tell
    set isReady to true
    on error
    set isReady to false
    delay .1
    end try
    end repeat
    end try
    ...


    I haven't tested this yet, so probably go with Eric's suggestion 😊.


    The risk with this script is that if something unexpected goes wrong (e.g. typo), the repeat loop will cycle for ever, hang the script and likely Capture One as well.
    I always include a limit so that I get an error message instead of a hang.

    I can't count the number of times I've put a try statement in place, only to discover that my typo is causing the error. 😄
    So, at least initially I log the error.
    0
  • Benjamin Liddle
    [quote="Eric Nepean" wrote:
    [quote="ben_US" wrote:
    Essentially I was going to suggest the same as Eric's previous response, but the quick/dirty/one-time-use way:

    ...
    if application "Capture One 12" is not running then
    tell application "Capture One 12" to activate
    repeat until isReady is true
    try
    tell application "Capture One 12"
    set newDoc to make new document with properties {kind:catalog, path:"some path"}
    end tell
    set isReady to true
    on error
    set isReady to false
    delay .1
    end try
    end repeat
    end try
    ...


    I haven't tested this yet, so probably go with Eric's suggestion 😊.


    The risk with this script is that if something unexpected goes wrong (e.g. typo), the repeat loop will cycle for ever, hang the script and likely Capture One as well.
    I always include a limit so that I get an error message instead of a hang.

    I can't count the number of times I've put a try statement in place, only to discover that my typo is causing the error. 😄
    So, at least initially I log the error.


    Good call 😊
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.