Autohotkey-like functionality?

adamgolding's icon

What do I need to learn to program autohotkey-like functionality in Max/Msp? I want to be able to monitor which software programs I have open, and allow the user to control, in real time, how max acts when various programs are open, alter keyboard input in all programs, and generally interact with the OS in various ways, such as opening/closing programs, etc. I have to do this in a cross-platform manner.

Tim Lloyd's icon

To me (not very experienced in such things) that sounds really tricky. On a mac (I don't know windows) you could use Applescript ([tap.applescript ] is the only thing I've used, but there are probably others) and/or using the [shell ] object (I think this executes terminal-like commands).

The only thing I can say with any certainty is that the standard max key objects won't work when max is not the active application; you have to use the [hi ] object to detect keystrokes.

On mac it wouldn't be too difficult to do what you need by executing Applecripts from max and changing the behaviour or your patch accordingly, opening and closing applications etc is very simple.

I think the main trouble you'll run into is that you would have to do the whole thing in an entirely different way for windows and mac.

adamgolding's icon

Hmm, ok−simpler question−how to I get Max to call an Autohotkey function on Windows?