AE Extension | Trigger 9 different functions with single button and keyboard Numpad 1-9

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
manjunath7472
Posts: 7
Joined: June 1st, 2015, 8:42 am

I want 9 different functions to be triggered by single button and keyboard numpad (1-9) in my After effects extension. I got some solution from stackoverflow and it works fine in online html editors but doesn't work in after effects. Below is the sample code. Can someone plz help.

<button type="button" id="b41" onclick="myFunction(event)">myButton</button>
<script>
const pressedButtons = {};

window.onkeydown = (e) => (pressedButtons[e.which] = true);
window.onkeyup = (e) => (pressedButtons[e.which] = false);

function myFunction(event) {

if (pressedButtons[97]) {
setOpacity_0();
} else if (pressedButtons[98]) {
setOpacity_100();
} else {
setOpacity_50();
}
}
</script>

manjunath7472
Posts: 7
Joined: June 1st, 2015, 8:42 am

This i achieved thru scriptUI object in jsx script using CSinterface. Thank you

Post Reply