As of this post, targeting items within Premiere via direct selection is not part of the API. Maybe this will come with CEP 8, but with CEP 7 it’s a no go.
So. The way I build my scripts most of the time, is I choose a bin to target and then perform actions on the items within that bin. This movie will help you get started with this workflow. In future movies, I will be using this function to build out other features.
It works by first declaring a global variable that we can bind within the function.
The function has two parameters.
1) the current “starting point” for the function
and
2) the bin name you are searching for, as a “string”
Once it has these of pieces of information, the function loops down through the items in your project. When it comes across a bin, it checks to see if that bin matches the name you are searching for. If it is not the desired bin, it then calls the function once again, with the starting point being the current bin.
There are two other ways to do this suggested by Adobe in their sample code (here and here), but this way works for me best. You can do some research and proceed with your favorite!