1 person found this helpful
Nope, no way to do that as yet.
Looking for this as well.
var projectItem = app.project.rootItem.children;
for testing, but I want to retrieve the currently selected projectItem.
var projectItem = app.project.rootItem.children.isSelected(); //or similar
Does not work, but would be nice if it did.
Would be nice with both a single item return, and a Collection, if several are selected, we should write our own exceptions.
Panels can currently get notified whenever the project selection changes, but (as you've found) there is no current way to get or set the selection. I can make no specific commitments, but this is a highly requested feature near the top of our API backlog.
Thank you for your answer Bruce.
I think you can set the selection:
I think my current script is coming together, it searches through the timeline for shots with similar names. Just missing this bit to make it useable. Had an idea of stepping backwards through the most recently added projectItems, but its not very elegant.
You're correct; I should have said "While you can select and deselect individual items, you can't get/set the current project item selection, at one go."
Ok, I came up with a slightly more demanding solution, but it might work for this specific use-case.
Always selecting the lastly added item to root in project:
var projectLen = app.project.rootItem.children.numItems - 1;
var projectItem = app.project.rootItem.children[projectLen];
Which demands "constant cleaning", where the user puts away clips in bins after they are "placed" in the timeline, but it might be usable.