[PD] generatiing a keypress

jim ruxton cinetron at passport.ca
Wed Dec 19 09:50:48 CET 2007

> jim ruxton a écrit :
> > Tried the external you sent Patrice. Thanks it works great. Thinking if
> > I have a chance some time I'll add the code so you can just send an
> > ascii character into it. I think I saw a window function that converts a
> > character to the code your external takes. Anyway as it stands now its
> > great so thanks a lot : )
> > Jim
>   I am happy that this satisfies your need, it's my first external, this 
> topic was a good enough for making a try.
>   In the other external I've called [keystroke], it fixes a major bug 
> found in the other one I've called [winkey] that could crash the 
> machine, and there is some documentation inside keystroke-help.pd about 
> the relationship between the number to enter and the correponding key. 
>      You can also get this in msdn site.
>   The numbers doesn't always correspond with the good keys, could you 
> help me about this, and give me which numbers are working with your 
> windows version?
I'll have a look at this. Right now I am not using very many keys and
they all seemed to work. spell from cyclone is useful in doing keyboard
type patches. It takes text and converts a string to the ascii values. I
had to use upper case characters since your external only accepts upper
case ascii values  since that is how the key codes are defined. I didn't
want to get fancy yet and use shift etc. I think it would be great to
create an external that takes ascii characters directly. I think you can
then use vkkeyscan to convert to the key codes which your external
>   Maybe it would have been better to use SendInput() rather than 
> kbd_event(), but I haven't been able to figure out how to use the first.
Have you looked at sendkeys . This could simpliy things as well.
>   We hope to make soon a cross-platform external, but keeping the number 
> option for the windows version should be handy. I'm just wondering if 
> the arguments for the objects should be the same on all platforms (lot 
> of work), or different arguments following the API (it seem simple to do).
I could work with either. I wonder is there is a way to direct the
keypress to the desired window (program) . Currently the cursur has to
be in the window where you want to recieve keypresses. Maybe using the
SetFocus http://msdn2.microsoft.com/en-us/library/ms646312(VS.85).aspx
or SetActiveWindow function you could direct the keyboard input to the
desired application? I can see that the feature request is growing : ) .
Congrats on writng your first external. I have yet to tackle one. 


More information about the Pd-list mailing list