[PD] generatiing a keypress

Hans-Christoph Steiner hans at eds.org
Tue May 20 17:21:42 CEST 2008

On May 20, 2008, at 4:00 PM, Patrice Colet wrote:

>  Hello,
> Hans-Christoph Steiner a écrit :
>> On Dec 16, 2007, at 11:19 PM, Patrice Colet wrote:
>>> Hans-Christoph Steiner a écrit :
>>>>> PureData can do this on linux and now on windows with the help of
>>>>> different externals.
>>>>>   I bet many users would love to have a single external for both
>>>>> platforms, that uses the same parameters, same help file, the  
>>>>> object
>>>>> would have then the same name, it wouldn't be x11key anymore but
>>>>> [keystroke] or something like this and would work on most  
>>>>> platforms.
>>>>>   Aalex, what do you think?
>>>> Sounds like a great idea.  How about something like [send_key]  
>>>> or [type_key]?
>>>> .hc
>>> [send_key] sounds good, also I might have found how to do this on  
>>> MAC OS    X, by the use of sysctl.h, with looking at the source  
>>> of some programs that emulates keystrokes, but I haven't got the  
>>> machine for testing...
>> Post the example code and someone will probably look at it.  If it  
>> is easy, I'll do it, especially if there is already a cross- 
>> platform object written.
>> Also, [hid] and [hidio] both have a cross-platform event/message  
>> scheme that is translated into the native platform messages.  I  
>> think for [send_key] it use an existing scheme, like from [key]/ 
>> [keyup]/[keyname] or [hidio].
>  I'd like to make a proposition with this attached object in  
> construction, it uses different fonctions that ease handling to a  
> window with EnumWindow() and FindWindow() function.
>  The user will only have to know the first characters of the window  
> to handle, also a list of all visible windows can be printed into  
> the console.
>  We can send a character or a character chain, but puredata will  
> drop some keycodes if it's sent through a message box.
>  Now I need to find out how to do the same thing with X11, then it  
> will be possible to have a single external with the same functions.
> Best.
> PC.<sendkey.zip>

Cool, that would be a handy objectclass to have cross-platform.  The  
X11 version of this was posted on the list a while back, I think it  
was called x11key from Alexandre Quessy.  I haven't seen the Mac OS X  
version of this though...



Terrorism is not an enemy.  It cannot be defeated.  It's a tactic.   
It's about as sensible to say we declare war on night attacks and  
expect we're going to win that war.  We're not going to win the war  
on terrorism.        - retired U.S. Army general, William Odom

More information about the Pd-list mailing list