how can we send keys to keyboard

Jason Scheirer jason.scheirer at gmail.com
Tue Oct 7 18:50:40 CEST 2008


On Oct 7, 9:28 am, mhangman <ceyhunalye... at gmail.com> wrote:
> On 7 Ekim, 18:57, Mike Driscoll <kyoso... at gmail.com> wrote:
>
>
>
> > On Oct 7, 10:42 am, mhangman <ceyhunalye... at gmail.com> wrote:
>
> > > On 7 Ekim, 18:34, Mike Driscoll <kyoso... at gmail.com> wrote:
>
> > > > On Oct 7, 10:13 am, mhangman <ceyhunalye... at gmail.com> wrote:
>
> > > > > how can we send keys to keyboard? i want to write a script that will
> > > > > push keyboard buttons and do what i want. its for a macro prog. there
> > > > > are some kinds at c++ and at java. for example actools prog. but i
> > > > > want to this in python...
>
> > > > > note:im not talking about print a key im talking about use it from its
> > > > > device
> > > > > please help
>
> > > > If I understand you correctly, you're probably wanting something like
> > > > SendKeys:
>
> > > >http://pypi.python.org/pypi/SendKeys/0.3
>
> > > > Unfortunately, this is for Windows only (as far as I can tell). But
> > > > you didn't say what OS you were using, so maybe this will work.
>
> > > > Mike
>
> > > ty mike but it use a c++ module with it. cant we find python/made
> > > module?
> > > or donno..
>
> > > bdw: OS windows, linux doesnt matter just let me learn this
>
> > What difference does it make if it includes a c file (it's not C++)?
> > Python itself relies on C code too for some of it's fastest bits. The
> > "xrange" builtin is one good example. Besides, I think learning C/C++
> > would be a good idea for any Python programmer that wants to get truly
> > proficient in his snake charming.
>
> > Mike
>
> ty mike,
> im just looking for other ways which can improve my style,information.
> i read some java stuff some c++ some c# and c about this work. but can
> python do this whiout include any of this?
> need to learn, thanks for helping

You definitely need SendKeys, and you definitely need to talk to
Windows through some C library. It doesn't matter which bridge you
use, but your code is going to touch something written in C eventually
to accomplish this.

Check out this example: http://code.activestate.com/recipes/65107/

The pywin32 libraries are pretty much a must if you're working in
Windows and Python regardless.



More information about the Python-list mailing list