We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

keyboard_Event

tmartl
tmartl asked
on
Medium Priority
900 Views
Last Modified: 2013-12-16
I need a function that will produce a keyboard_event.

just like an user has pressed a key, but it is an other application that will do it (with that function).
(This function should be the same as keybd_event(...) in Win NT
Comment
Watch Question

Commented:
Is this under X? What is the specific program?
Under X, you can try using XSendEvent, but it doesn't seem to
work with some X clients (like xterm) because the events appear
to be synthetic to the xterm program. If this is what you need,
let me know, and I'll send you a code snippet.

Author

Commented:
it's not what i want...
thanks anyway.

what I want is the same as Keybd_event in Windows NT.
->
send a string of character to the window who has the keyboard focus.

(just like a keyboard input from a user).

N.B. : The window (that has the focus)  is not mine...
       It is from an other application...
       and my application has to simmulate a user and input a
       string in the window who has the keyboard focus.

thanks for your help.

Author

Commented:
Yes it is under X.

Commented:
You can use XSendEvent to send to *other* applications' windows.

Author

Commented:
ok.

but how can i do that?

N.B. a window can have more than one edit box and i want to put the text in the box that have the focus...

how can i have the handle of that box?
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Commented:
(Actually, ignore the second include. It shouldn't be
necessary.)

Author

Commented:
I'll will try this !

How can I have the keycode of a character?

I only have the ascii code.

thank you very much!!!

Commented:
The only way I know to find keycodes is to run xev, wait
for it to stop outputting stuff, then hit the key and
read the stuff it spits out.

For my curiosity, why did you give me a "B" for my grade?

Author

Commented:
oupss!!!  very sorry !  ;-(

I think I choose to fast.

you deserve a A++++++++++   ;-)

thanks for your help !

Commented:
no problem. just wanted to know if I did something wrong. :)
thanks.

Author

Commented:
oupss!!!  very sorry !  ;-(

I think I choose to fast.

you deserve a A++++++++++   ;-)

thanks for your help !
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.