How to register key with Max patch minimized

Joni950's icon

Hi!
Tried finding the solution for this around the forum, but wasn't quite sure how to formulate the question.
What I have is this patch that records from virtual output and let's me record anything coming from my computer. Thing is, I have to click a button (or press key 'P') with the window open in order for it to record.

Is there a way that I can have the patch running in the background and still get Max to register a certain key being pressed without the window of the patch being open?

I want to make sampling a lot more faster and easier, pretty much.

Thank you!

11OLSEN's icon

Hi, You would need a global hotkey listener or a global keyboard listener, there isn't such thing in the vanilla object collection. Best way is probably to use another input method which doesn't need the window to have focus eg. a midi contr. or something you monitor with [hi] object (on Mac you could try to monitor your keyb. with [hi]). I posted an example how to build a global keyboard listener as a java object here