Page 1 of 1

Select timeline after running script

Posted: February 27th, 2014, 12:22 pm
by scribling
Is it possible to add code to a script to automatically select the timeline window?

I have scripts that run from a toolbar, but after they're run the selection stays on the toolbar. I'd like the selection to be the timeline so I can simply hit enter and rename the layer.

Any ideas?

Thanks

No? Not possible?

Re: Select timeline after running script

Posted: March 13th, 2014, 10:37 am
by lilsmokie
Is this what you're after?

app.activeViewer.setActive();

Re: Select timeline after running script

Posted: April 4th, 2014, 12:23 pm
by scribling
That's close.
That sets the viewer as the active window.
I need to the timeline as the active window, so I can hit enter and rename.

I tried changing "Viewer" to "Timeline" but that does nothing.

Thanks

Re: Select timeline after running script

Posted: April 13th, 2014, 3:53 pm
by pecollinni
you can do something like this. This will switch focus to the render queue panel first, and then move the focus to the active composition timeline.

Code: Select all

        tmpName = app.project.activeItem.name;   // specify the active composition name
        app.executeCommand(app.findMenuCommandId("Render Queue"));
        app.executeCommand(app.findMenuCommandId("Timeline: " + tmpName));
you must do 2 things in order for this to work.

first one is to make sure that your render queue panel is always active (tab opened) and it must be in the same frame where your timeline is. this means that you can't undock render queue panel and place it somewhere else, like on second monitor, or something like that. it must be in the same group as other composition panels (tabs) are, or this wont work. I usually leave it on the first place to the left, which is the default when you open ae.

the second thing is that you'll need to specify the active comp name (tmpName) somewhere in the script, before you (your script) switch the panel focus. be careful, because app.project.activeItem can be the current composition timeline opened, or the current item in the project panel selected.

hope it helps :wink: