Hello~
I am currently working on a menu bar app written in Swift.
When the user presses a shortcut only when the front app is a keynote, I want the Apple Script built into the menu bar app to work to influence the keynote.
If the keynote is running when the user presses the shortcut key, the Apple script inside the menu bar app is executed.
If the keynote is not running, can the shortcut be bypassed? At this point, does this shortcut just disappear? Or will it influence the other apps that depend on this hotkey?
I would like to know how.
Thank you~
As I understand, you should write keyboard controller, which checks for keys pressed of shortcut. One by one in the method pressBegan:With:. Handling Key Presses on Phisical Keyboard. After checking all keys of shortcut is pressed, this controller should check running property of Keynote.app, then do nothing when it is false, or do some actions if it is true.
The question is for AppleScriptObjC and xCode forum or, better, for some Swift forum.
Here is one other tutorial very close to your question:
How to detect keyboard input using pressesBegan() and pressesEnded()
Oh, there is a way. I’ll try it. Thanks KniazidisR.