get keystroke when max is in background

Jan 14, 2009 at 8:06am

get keystroke when max is in background

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.

#41674
Jan 14, 2009 at 2:37pm

ice.key from iCE Tools.

#148528
Jan 14, 2009 at 3:17pm

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!

#148529
Jan 14, 2009 at 5:15pm

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

#148530
Jan 14, 2009 at 5:51pm

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.

#148531
Jan 14, 2009 at 6:25pm

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. –
#148532
Jan 14, 2009 at 9:39pm

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

#148533
Jan 14, 2009 at 10:44pm

#148534
Jan 15, 2009 at 12:37am

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

#148535
Jan 15, 2009 at 1:01am

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

#148536
Jan 15, 2009 at 1:43am

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!

#148537
Jan 15, 2009 at 1:45am

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

thanks again!

#148538
Dec 27, 2009 at 10:46am

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?

#148539
Dec 28, 2009 at 10:54pm

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

#148540
Sep 11, 2010 at 3:50pm

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

#148541

You must be logged in to reply to this topic.