ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Adding a keyboard listener to script window

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jacob Roth
Adding a keyboard listener to script window
on Nov 14, 2019 at 6:28:18 pm

Hello all,

I'm trying to write a script that will let me parent layers with nothing but the keyboard. I've gotten to the point where the script can change the parent of a layer, but I can't get the script to execute without clicking a button.

I've read that event listeners no longer work in ExtendScripts. Is there another way to add a keyboard command onto a UI button?

var mainComp = app.project.activeItem;
var mainWindow = new Window("palette","The Parenter", undefined);

var groupOne = mainWindow.add("group", undefined,"groupOne");
groupOne.orientation = "column";

groupOne.add("statictext", undefined,"This script Parents your layers");
var theParent = groupOne.add("edittext", undefined, "Parent");
var firstChild = groupOne.add("edittext", undefined, "First Child");

var groupTwo = mainWindow.add("group", undefined, "Buttons");
groupTwo.orientation = "row";
var startButton = groupTwo.add("button", undefined, "Parent!");
var cancelButton = groupTwo.add("button", undefined, "Cancel")

startButton.onClick = function(){
cancelButton.onClick = function(){

function doThings(){
var setParent = parseInt(theParent.text);
var setChildren = parseInt(firstChild.text);
mainComp.layer(firstChild).parent = mainComp.layer(setParent);


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 All Rights Reserved