Skip to main content
Participating Frequently
October 1, 2022
Answered

Is it possible to use keyboard shortcuts for CEP panel's function when the panel is out of focus?

  • October 1, 2022
  • 3 replies
  • 2921 views

Hi guys, Is it possible to assign keyboards shortcuts that will initiate my jsx function? I  am building CEP panel for after effects and I want to give a user an ability to quickly launch function using shortcuts rather than clicking on gui. I know it is possible to listen to keydowns/ups when panel is on focus, but how to listen globally in app?

Correct answer Mathias Moehl

That's a good suggestion for a workaround! Also see my tutorial here about configuring keyboard shortcuts for jsx scripts:

https://mamoworld.com/docs/automation-blocks/tutorials-ae/keyboardShortcuts

This tutorial is about Automation Blocks, but the same works with any other jsx script.
The jsx script that is triggered by the shortcut could also create an event that your CEP panel could listen to:
https://www.davidebarranca.com/2014/07/html-panels-tips-11-externalobject-cep-events/

 

3 replies

ConstantinMaier
Inspiring
October 6, 2022

I'm not sure what exactly you want to achieve but here's a suggestion: You could create a jsx file (or multiple ones) in AE's "Scripts" folder (not the "ScriptUI Panels" folder) which you can assign shortcuts to in AE's keyboard shortcuts dialog. (You can also add the shortcuts automatically by writing to AE's keyboard shortcuts file.) Now, I don't know about CEP panels but with a ScriptUI panel, you could call the panel from within your jsx file in the "Scripts" folder and hand over a global variable to tell the panel which function to execute. Or depending on what you want to do, just execute the function from the jsx file in the "Scripts" folder.

 

There's also a way to assign multiple shortcuts to a single jsx file while still being able to execute multiple functions. But it's complicated. See my explanation here:
https://creativecow.net/forums/thread/limit-to-after-effect-script-hotkeys/

Mathias Moehl
Community Expert
Mathias MoehlCommunity ExpertCorrect answer
Community Expert
October 7, 2022

That's a good suggestion for a workaround! Also see my tutorial here about configuring keyboard shortcuts for jsx scripts:

https://mamoworld.com/docs/automation-blocks/tutorials-ae/keyboardShortcuts

This tutorial is about Automation Blocks, but the same works with any other jsx script.
The jsx script that is triggered by the shortcut could also create an event that your CEP panel could listen to:
https://www.davidebarranca.com/2014/07/html-panels-tips-11-externalobject-cep-events/

 

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Mathias Moehl
Community Expert
Community Expert
October 2, 2022

As Mylennium says, there is no good, clean way to do that. I think the tool Excalibur  does this with a dirty hack - by running a process which monitors keystrokes in the background or something like that. Besides the security implications (nobody wants a tool to monitor everything that is typed) it causes limitations like the keyboard shortcut also being fired when a dialog is open.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Mylenium
Legend
October 1, 2022

I don't think it's in any way possible as the panel's event listener would block a lot of other functions and trigger a ton of errors, after which the script would stop and you'd have to relaunch it.

 

Mylenium