Forums > MaxMSP

Keyboard commands

October 28, 2011 | 8:42 pm

Hi all!

Im looking for a way for MAX to send keyboard commands
i.e. when a message is banged it will "press" the Ctrl key.

(Like the opposite of the Key object…)

Is this possible?

Any help would be well received!


October 28, 2011 | 10:00 pm

What are you trying to send the key down/up command to do?


October 29, 2011 | 12:14 am

Ctrl + E to auto lock patch


October 29, 2011 | 2:19 am

You could do this with menu commands using applescript and the [shell] external (you can find it in the toolbox pages) or alternatively you could use the autobot java class (search the forum, it’s been linked to quite a bit) and probably the most simple method: you could use the locked property of the patcher object in javascript using the [js] object.


October 29, 2011 | 3:24 am

Thanks Luke,

I have never used Javascript! but I suppose now is as good a time to learn…


October 29, 2011 | 9:40 am

I’ll save you the work, here’s a little abstraction I use for the same thing, with a helpfile too:

// lh.editmode.js

function bang() {
outlet(0,this.patcher.locked);
}

function lock(x) {
this.patcher.locked = x;
bang();
}

function anything() {
post("lh.editmode.js: doesn’t understand ""+messagename+""n");
}

autowatch = 1;

// EOF

– Pasted Max Patch, click to expand. –

October 29, 2011 | 9:11 pm

Thank you that is so helpfull!
Do you have any other basic/intros to Java script?


Viewing 7 posts - 1 through 7 (of 7 total)