RX14 / autokey

Automatically exported from code.google.com/p/autokey
GNU General Public License v3.0
0 stars 0 forks source link

keyboard.press_key("<ctrl>") does not work #178

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create this Autokey script attached to any hotkey:

<code>
keyboard.press_key("<ctrl>")
keyboard.send_key("t")
keyboard.release_key("<ctrl>")
</code>

2. Trigger the hotkey in any window.

What is the expected output? What do you see instead?

Only the letter "t" is output, without <ctrl>. Here is the log:

<code>
2012-02-26 16:39:54,760 DEBUG - interface - Recorded keymap change event
2012-02-26 16:39:54,790 DEBUG - service - Raw key: u'<f12>', modifiers: [], 
Key: <f12>
2012-02-26 16:39:54,790 DEBUG - service - Window visible title: u'Firefox', 
Window class: 'Navigator.Firefox'
2012-02-26 16:39:54,790 INFO - service - Matched hotkey phrase/script with 
prompt=False
2012-02-26 16:39:54,791 DEBUG - service - Script runner executing: Script('a')
2012-02-26 16:39:54,791 DEBUG - service - Ignored locking error in 
handle_keypress
2012-02-26 16:39:54,792 DEBUG - interface - Send special key: [u't']
X protocol error:
<class 'Xlib.error.BadValue'>: code = 2, resource_id = 0, sequence_number = 
2794, major_opcode = 142, minor_opcode = 2
2012-02-26 16:39:54,961 DEBUG - interface - Ungrabbing hotkey: [] u'<code89>'
2012-02-26 16:39:54,962 DEBUG - interface - Ungrabbing hotkey: [] u'<f12>'
2012-02-26 16:39:54,962 DEBUG - interface - Ungrabbing hotkey: [] u'<code87>'
2012-02-26 16:39:54,962 DEBUG - interface - Ungrabbing hotkey: [] u'\uffb0'
X protocol error:
<class 'Xlib.error.BadValue'>: code = 2, resource_id = 0, sequence_number = 
2799, major_opcode = 142, minor_opcode = 2
</code>

What version of the product are you using? On what operating system?

AutoKey 0.81.4 on Kubuntu 11.10

Original issue reported on code.google.com by vian...@likwid.fr on 26 Feb 2012 at 3:48

GoogleCodeExporter commented 9 years ago
To send chords (combinations of keys), use the syntax <ctrl>+t with 
keyboard.send_key/s

Original comment by cdekter on 27 Feb 2012 at 8:28

GoogleCodeExporter commented 9 years ago
My point was that keyboard.press_key doesn't work.

Actually, I want to use it to do a ctrl + mouse click like this:

keyboard.press_key("<ctrl>")
mouse.click_relative(0,0,1)
keyboard.release_key("<ctrl>")

Which doesn't work either: only the mouse click is done and the same error 
appears in the log.

Original comment by vian...@likwid.fr on 27 Feb 2012 at 10:56