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

Change Sort view via AppleScript?

Comments

12 comments

  • Benjamin Liddle
    Not via AS to Capture One.
    0
  • Sean Murphy
    Ok, thanks Ben. That would definitely be a feature request for us. Our digitechs use a script on each look that filters by green label and then sorts by rating and then reverse the order. Would be great if we could code that without the key commands/keyboard shortcuts.
    0
  • Eric Valk
    Hi Sean, what's your ubjection to UI scripting?

    BTW I have useful tools that will give the AS reference to any key you press.
    0
  • Benjamin Liddle
    [quote="SeanMurp" wrote:
    Ok, thanks Ben. That would definitely be a feature request for us. Our digitechs use a script on each look that filters by green label and then sorts by rating and then reverse the order. Would be great if we could code that without the key commands/keyboard shortcuts.


    I wholeheartedly agree.
    0
  • Sean Murphy
    Hey Eric,
    UI scripting is fine in cases but we have a large enough fleet of computers which use a large library of custom applications that we have developed. The requirement to give the applications Assistive Access for each application that uses UI is too much of a hindrance on the user when every minute they are delayed costs quite a bit of money. Plus many of those users are switching between different computers on a daily basis which just compounds the issue. We just have much fewer issues to deal with not using UI calls when possible.
    0
  • Jim_DK
    Sort order for collections has been added in Capture One 12
    0
  • Sean Murphy
    Thanks for the note Jim. I just saw that in the notes the other. Really looking forward to testing out 12.
    0
  • EPAIN
    Hello, I have a similar goal here (yet working in Capture One 10 FYI)
    Trying to sort the Browser by Date. When I run this from the Script Editor it works perfectly:

    try
    tell application "Capture One 10" to activate
    tell application "System Events"
    tell process "Capture One 10"
    set frontmost to true
    click menu item "Date" of menu 1 of menu item "Sort" of menu 1 of menu bar item "View" of menu bar 1
    end tell
    end tell
    on error errMsg
    display dialog "Error: " & errMsg
    end try


    However, from within CaptureOne I get:
    "Error: System Events got an error: Can’t get menu bar 1 of process "Capture One 10". Invalid index."

    Any thoughts on how to solve this?
    0
  • Eric Valk
    For an aplication to be allowed control of the user interface, it must be enabled to do so in the accessibility section of the the Privacy menu of the Security amd Privacy item of System Preferences. When Script editor is running a script, the script gets the privileges of Script Editor, which is very likely enabled in the Acessibility menu.

    But when Apple script is saved and run as an application then the application has to have these privileges. I have a script that automatically sets the brightnes of the display to the value used for screen calibration using UI controls, and this is what I had to do.

    I don't know off hand if it is useful or necessary for Capture One to have these privileges.
    0
  • EPAIN
    Thanks for the reply Eric!

    I believe I set that up properly and still have problems.
    So: Settings -> Security and Privacy -> Accessibility -> Add CaptureOne
    And that's it right?

    Since I get the "Invalid Index" rather than a permissions error I think I have something else happening.
    0
  • Eric Valk
    Good point.

    Now that you mention this it triggers a memory; There is another strange effect that sometimes happens and I think this a likely cause.

    The message is actually telling you two things
    1. There is no menu bar 1
    2. There are no menu bars. If there were menu bars, one of them would be assigned an index of 1.

    Conclusion: Name of the class “menu bar†is not what we expect it to be.

    When an Apple script is run as an application, instead of as a script, the some of the Capture One classes loose their names, and are expressed in RAW form. In this case the name starts with the left Chevron symbol “<<“.

    So I would write an application that does a “get every UI†command, convert to text and display. Run as a script of course.

    Check for unexpected names.
    0
  • Eric Valk
    Sorry for the confusing reply. Now that I hve rturned from work and have access to my Mac, here is a better one.

    Now that you mention this it triggers a memory; There is another strange effect that sometimes happens and I think this a likely cause.

    The message is actually telling you two things
    1. There is no menu bar 1
    2. There are no objects called "menu bar". If there were objects called "menu bar", one of them would be assigned an index of 1.

    Conclusion: Name of the class “menu bar†is not what we expect it to be.

    When an Apple script is run as an application, instead of as a script, the some of the Capture One classes loose their names, and are expressed in RAW form. In this case the name starts with the left Chevron symbol “«“, and ends with "»"

    Write this script and save it as an application. Grant the application Aaccessibility rights, then run it, and you will see the evidence.

    If you run the application as a script from Script editor, the result is this: "window; window; window; menu bar"
    If you run the the application from finder, the result is this: "window; window; window; [color=#0000FF:2mcrp2mq]«class mbar»[/color:2mcrp2mq]"
    (blue highlighting is mine)
    Note that every time you save your application you have to red-grant the accessibility.

    Thus the problem. I'm not sure how to get around it.

    tell application "System Events"
    tell process "Capture One 10"
    set theUIList to get every UI element
    set uiClassNameList to ""
    set seperatorString to ""
    repeat with someUI in theUIList
    set uiClassNameTest to (get (class of someUI) as text)
    set uiClassNameList to uiClassNameList & seperatorString & uiClassNameTest
    set seperatorString to "; "
    end repeat
    display dialog uiClassNameList
    end tell
    end tell
    0

Post is closed for comments.