Page 1 of 1

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

Posted: November 6th, 2021, 2:55 am
by manjunath7472

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>


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

Posted: November 6th, 2021, 10:41 am
by manjunath7472

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