Forums > MaxMSP

get keystroke when max is in background

January 14, 2009 | 8:06 am

Hi,

I’ve created a little patch that generates music through
keystroke/ascii. using the key object.
I would like to run this program when I use a texteditor.with max in background.
The only problem is max doesn’t get my keystrokes when max is not the selected application/in background.

does anyone have
any easy solution for this?

thanks.


January 14, 2009 | 2:37 pm

ice.key from iCE Tools.


January 14, 2009 | 3:17 pm

ice.key is probably what i need.
any other way of doing it?
without having to buy icetools?
Since this is just a little hobby project
I don’t think it’s going to be worth
spending 150 dollars on.

Thanks for the help!



jko
January 14, 2009 | 5:15 pm

Look at the hi object. Maybe you can easily. translate what you get there to key commands. Haven’t tried that though. Good luck!


January 14, 2009 | 5:51 pm

i’ve already looked into the hi object,
but with hi I still have to have max selected
to get input.
and that’s the problem.
I want to be able to type in one program,
for example texteditor, notepad, messenger or office
and get the keystrokes in max.
so my composition patch plays along with my typing/writing in above mentioned apps. (or others)

thanks for the reply.



jko
January 14, 2009 | 6:25 pm

Strange, here on my machine (max5, mac) it works perfectly the way you want it to, I’m getting the numbers out in my maxpatch while I type this message in the browser rigth now…

Only thing I guess you’d need technical Info what happens in your keyboard or to be more exact in the keyboard driver. Hitting to keys the same time makes the values jump sometime. On my machine this gives me the ascii codes (only x and y are swapped) and special signs like .,-_#’+* etc don’t fit. with the fromascii object by Jasch you can even translate back to what you typed

– Pasted Max Patch, click to expand. –

January 14, 2009 | 9:39 pm

are you on XP or macos ?

if you’re on XP. there’s a free application called "vvvv"

http://vvvv.org/tiki-index.php

it’s similar to PD and MAX and got a "globalkey" object that takes keystrokes whatever
window is active and you can send it’s ouput to MAX via netsend. worked good for me. takes
some extra CPU though (don’t know why)

ciao

oliver

Erwin wrote:
> i’ve already looked into the hi object,
> but with hi I still have to have max selected
> to get input.
> and that’s the problem.
> I want to be able to type in one program,
> for example texteditor, notepad, messenger or office
> and get the keystrokes in max.
> so my composition patch plays along with my typing/writing in above mentioned apps. (or others)
>
> thanks for the reply.
>


\\\\\\\\\\\\\\\\\\\\\\\\\\\\
/////////////// http://pendler.klingt.org //////////////
\\\ http://www.myspace.com/pendlerklingtorg \\\\
////////////////////////////////////////////////////////
\\\\\\ http://www.klingt.org/~oliver/cv \\\\\
////////////////////////////////////////////////////////
\\\\ LIVE-BUILDER (music improvisation tool): \\\
//////// http://klingt.org/~oliver/live-builder ////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\


January 14, 2009 | 10:44 pm


January 15, 2009 | 12:37 am

jko,

using the hi object I have maneged to get input using your patch!
but only trackpad input.
so i can surf the net or use any app. and input my patch with the trackpad, but i can’t seem to input by pressing keys / typing for example in texteditor.
and that’s what i’m after.
how did you get it to work?

i’m on a intel-macbook osx 10.4.11 , max/msp 5 ..


January 15, 2009 | 1:01 am

Try sending "menu" to the [hi] object and choosing a different device. I get three sepearate "Apple Internal Keyboard / Trackpad" options and the third one responds to keypresses.

lh


January 15, 2009 | 1:43 am

JKO,

I messed about with the settings of the hi object and have
got it working.

now i just have some finetuning to do.

thank you very much!


January 15, 2009 | 1:45 am

i also selected the 3rd one,
but had to send it the Keyboard message
for it to change focus.

thanks again!


December 27, 2009 | 10:46 am

Hey!
this is great!
the only problem is that this only works with the lowercase keys. modifiers and even the space bar show up as different ascii values.

I think, in order to get everything to sync correctly, you would need to go through every key and compare it to its ASCII value. The modifier keys would also have to trigger switches to change the values to uppercase ascii values.

a good hours grunt work if I can’t find a graph to compare the values. Anyone have any idea what these numbers from the HI input from a Mac Keyboard are called if not ASCII then what?


December 28, 2009 | 10:54 pm

– Pasted Max Patch, click to expand. –

I am not sure if this will work on any other computer.
I imagine that the HI input will be different for every keyboard and with every computer.
this works great on a new macbook pro, havent tested it on anything else yet.


September 11, 2010 | 3:50 pm

Hey this works great on my macbook pro, but it does not on my old powerbook G4. Thank for making it!


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