Copy link to clipboard
Copied
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?
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 va
...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/
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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/
Copy link to clipboard
Copied
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/