Select timeline after running script

What type of scripts do you need?

Moderator: byronnash

Post Reply
scribling
Posts: 143
Joined: May 1st, 2005, 1:52 pm

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?
lilsmokie
Posts: 10
Joined: May 7th, 2008, 9:24 am

Is this what you're after?

app.activeViewer.setActive();
scribling
Posts: 143
Joined: May 1st, 2005, 1:52 pm

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
pecollinni
Posts: 6
Joined: November 3rd, 2013, 4:00 pm

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:
Post Reply