get keystroke when max is in background

Meiveld's icon

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.

Peter Castine's icon

ice.key from iCE Tools.

Meiveld's icon

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's icon

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

Meiveld's icon

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's icon

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

Max Patch
Copy patch and select New From Clipboard in Max.

dobyhal's icon

are you on XP or macos ?

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

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 ////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Tj Shredder's icon
Meiveld's icon

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 ..

Luke Hall's icon

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

Meiveld's icon

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!

Meiveld's icon

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

thanks again!

tailortrik0's icon

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?

tailortrik0's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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.

Arvid Tomayko's icon

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