cleitonsouza01 / logkeys

Automatically exported from code.google.com/p/logkeys
Other
0 stars 0 forks source link

Logged keys playback with xmacro #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi -

xmacroplay (http://xmacro.sourceforge.net/) can play back mouse and 
keyboard actions.  The macro format is rather simple.  Here's an example of 
a test.macro file:

MotionNotify 525 1033
ButtonPress 1
ButtonRelease 1
String My name
KeyStrPress h
KeyStrRelease h

I think having a script to convert logkeys format to xmacro format would be 
useful.  We could use a python script to do the enhancement.

BTW, have you consider using github?

Original issue reported on code.google.com by kiets...@gmail.com on 29 Mar 2010 at 6:54

GoogleCodeExporter commented 9 years ago
Hi -

This python script, if you are to write it, needs to skip the timestamp on each 
line
of the log file, and then produce

KeyStrPress   K
KeyStrRelease K

for each character key K it finds, and similarly for function keys as well. 
Note that
some function key strings need to be converted to xmacro format first (see 
issue 12).
Also, every newline should produce

KeyStrPress   Return
KeyStrRelease Return

and only lines starting with timestamps should be parsed. This is whole spec. :)

If you will create such python script, I will be happy to host it, or link to it
should you wish to host it yourself. :)

Have I considered using GitHub? 
No, not really. I like Google just fine. :þ

Original comment by kernc...@gmail.com on 30 Mar 2010 at 12:34

GoogleCodeExporter commented 9 years ago
Issue 12 has been merged into this issue.

Original comment by kernc...@gmail.com on 30 Mar 2010 at 12:35

GoogleCodeExporter commented 9 years ago
It appears that symbol keys (e.g. '-') need to be translated as well.

Good luck. :)

Original comment by kernc...@gmail.com on 30 Mar 2010 at 12:38

GoogleCodeExporter commented 9 years ago
Attached is python script to convert logkeys format to xmacro.

Usage:
python logkeys_to_xmacro logkeys.log logkeys.xmacro

To play back the keystrokes in your Linux environment:
xmacroplay :0.0 < logkeys.xmacro

This beats out Expect script anyday :)  No care for tty or serial whatever.  
xmacroplay is great for entering sudo password for repetitive task.  

You can use xmacroplay combine with wmctrl to automatically launch Firefox, log 
onto 
a website, make a comment, logout, and close Firefox.  This is done while you 
are 
having your dinner. :) keke

Original comment by kiets...@gmail.com on 30 Mar 2010 at 1:48

Attachments:

GoogleCodeExporter commented 9 years ago
Well done, it works. :)
The script is buggy, but so are logkeys and xmacro.

What works is *lower-case alpha-numeric ASCII characters, and some function 
keys*,
namely those translated by the script. Nothing else does (UTF-8 chars, 
upper-case
chars, punctuation, some function keys, key repetition).

If you ever wish to extend the script, please do so anytime by submitting a 
newer
version.

Meanwhile I will link to it, as if you find it useful, somebody else might too.

Thanks. :)

Original comment by kernc...@gmail.com on 30 Mar 2010 at 5:16

GoogleCodeExporter commented 9 years ago
Thanks for the feedback!  I whipped this up because I needed to do a little
regression on a webform I'm building.

I believed upper-case also work.  Xmacro treats capital letter as KeyStrPress 
Shft_L,
KeyStrPress a, KeyStrRelease a, and KeyStrRelease Shft_L.  The combinations 
create
capital letter "A".  KeyStrPress A is equivalent to "a".

I have limited support for key repetition and as for UTF-8 chars, punctuation, 
and
some function keys ... those are not implemented.  When I encounter them in my 
test,
I'll modify the script to accommodate.

BTW, the script is licensed public domain. :)

Original comment by kiets...@gmail.com on 30 Mar 2010 at 6:53