Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Script Button with Modifier Key

  • Script Button with Modifier Key

    Posted by Kevin Snyder on April 29, 2022 at 3:58 pm

    Is it possible to use a modifier key on a script button? I would like a regular click of a button to run a function and a SHIFT + Click to run a different function. Example:

    button1.onClick = addAnchor

    button1.onClick + SHIFT = addAll

    Kevin Snyder replied 2 years, 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    April 29, 2022 at 4:19 pm

    I don’t think you can do exactly what you’re asking for, but you can check for modifier keys inside your onClick function. To check for the shift key key, you would do something like this:

    var myState = ScriptUI.environment.keyboardState;

    if (myState.shiftKey){

    // do shift + click function


    // do regular click function


    It’s in the JavaScript Tools Guide.

  • Kevin Snyder

    April 29, 2022 at 4:51 pm

    Thank you for making me look at it in a different way. Got it working.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy