Simulating Pressing a Keyboard button.

May 10, 2007 at 3:17pm

Simulating Pressing a Keyboard button.

Hi,

I’m currently using max/msp with a course at uni. The patch I’m working on at the moment, I’m trying to interface with a game through gestures. I’ve finished with the gesture recognition, but interfacing with the game is another matter.

The method I was hoping I could use was that you could somehow simulate pressing a key on the keyboard inside max. For example, if they made a gesture that was mapped to accelerate, it would ‘press’ the up key which would then be interpreted by the game as accelerate.

I was wondering if simulating keystrokes is possible at all, and if anyone can direct me in the right direction. If this isn’t, I’ll start looking down other paths.

Thanks!

#31848
May 11, 2007 at 9:03am

Mac or Windows?

#103965
May 11, 2007 at 9:11am

Sorry, I should have said.

It’s for windows.

#103966
May 11, 2007 at 11:32am

I can’t work out how to edit… so I’ll double post.

I think I may have found the answer to my problem, I just need help implementing it.

http://www.developer.com/java/other/article.php/10936_2212401_3

Something about a java class called Robot, that simulates keypresses and mouse events.

I am guessing that I use the mxj object, any help on how to do this would be appreciated.

#103967

You must be logged in to reply to this topic.