0

I´m working on an applescript to facilitate some workflows within FCPX 10.2.3 I am using UI Scripting for this task. I would like to select two or more assets in a certain file list (event browser). I can address the rows within the browser and select them but I can only achieve one selection at a time.

select *soundfile*

set selected of *soundfile* to true

set value of attribute "AXSelected" of soundfile to true

where soundfile is for example

row 5 of outline 1 of scroll area 1 of splitter group 1 of splitter group 1 of group 5 of splitter group 1 of window "Final Cut Pro"

works fine. Only it deselects all the other rows.

I am trying to find a way to send a command-select to the app.

Another idea: The parent element of the elements in question has an attribute "AXSelectedRows", but I´m not able to something with it. If it´s not empty it will return an array with item values of 'application "System Events" ' So I think it is not really implemented.

Is there a way to achieve the multiple selection?

Doesn´t have to be apple script...

1 Answer 1

1

There is a bug in Applescript. You can set the selected property of UI Element to false without changing other selected elements, but if you set it to true, it de-selects all other UI elements.

I also tried to play with "Key down {command}" and "click", but no way. The only workaround I found is to select all rows and unselect the rows not required.

The script bellow is an example of multiple rows selection in Mail. It first select all rows (all messages in the box) using "command a" short cut and it de-selects all the rows which are not in the list Rows_to_Select.

tell application "Mail" to activate -- just to make it front window
set Rows_to_Select to {1, 3, 5} -- the rows you want to select
tell application "System Events"
tell process "Mail"
    tell table 1 of scroll area 1 of group 1 of splitter group 1 of splitter group 1 of front window
        keystroke "a" using command down -- select all rows
        repeat with I from 1 to count of rows
            if I is not in Rows_to_Select then set selected of row I to false
        end repeat
    end tell
end tell
end tell
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! Unfortunately in my case unselecting an element takes between 1/3s to 1/2s. And the whole list will be between 80 and 400 entries ;) Actually I did a similar thing until I find a better solution: I calculate the biggest difference in row-number, select the row with the lowest row number then sending shift-arrow_down to the window in question until all items are included in the selection. Then will do the deselect loop as you mentioned it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.