Max/msp Interface with other running Programs?
I am fairly new to max/msp, and I am currently in the process of creating a multi-program installation piece. Max is key to my work, but I have run into a few snares and am unsure how to proceed.
Is there a way to get max to communicate with other programs that are running on a system?
I'm not sure I want to write anything complicated like a plugin, but is there another way?
I was thinking maybee if I could get max to "simulate" button presses or keyboard input that affect the other programs. For instance, max would simulate a "h" keystroke repeatedly (via metro) that would affect another program that uses h as a hotkey? Is this possible? Can someone help?
I am trying to get Max/msp to talk to either Newtek's Lightwave 3d program, or Alias' Motionbuilder program.
Yes. There are lots of ways.
MIDI - CoreMidi, Midi Stroke or MIDI Pipe
http://developer.apple.com/audio/overview.html
http://www.macupdate.com/info.php/id/10541
http://www.charlie-roberts.com/midiStroke/
Shell Object - https://cycling74.com/twiki/bin/view/Share/JeremyBernstein
Applescript - http://www.apple.com/applescript/
AKA Keyboard - http://www.iamas.ac.jp/~aka/max/#aka_keyboard
Soundflower - https://cycling74.com/products/soundflower
Netsend/NetReceive/Udpsend/Udprecieve
Do any of those help?
There's also the Java Robot class, which I assume could be implemented through mxj in Max. I got this working in Processing quite readily. You can really have a lot of fun with this (mouse move, click, key press, etc.) as well as cause all kinds of trouble in your other programs.
It was designed for automated testing and for tutorials, but you can use it however you want---might be cool to create music in Logic by "auto-clicking" the notes into the piano roll, or painting something in Photoshop (complete with tool-switching using hotkeys). With the metro control and other means, you really could create some interesting stuff in these and other apps.
This example is kind of long-winded, but the basics are there. Note that once you get something working, you can put the ease of working in Max to work for you (managing changing numbers, recording streams of values, dealing with switches and gates, etc.) is IMO much better in Max than in code.
Within Max itself you can look at mousestate for ideas. Perhaps you want to move the pointer in specific patterns/areas on the screen? And determine places to click? Use mousestate and mtr, very straightforward. If you're looking for where to click in another running app, maybe put a screen shot of the app's interface in the background of your patch, then record your gestures and clicks. Mousestate will track motion with other apps active, but not clicks, so you may need to tweak a bit. Keystrokes will go to the active app; all the mxj would need would be a way to choose which one to send, and when.
Intriguing idea, using the mouse and keyboard to control other apps via Max. It's so easy to record gestures and morph them, in so many ways, I'm sure you could come up with some neat stuff... even just relieve some strain from all that clicking.
--CJ
Thank you both for your responses! They have been most helpful!