LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 06-17-2005, 11:15 AM   #1
breadcrust
LQ Newbie
 
Registered: Jun 2003
Location: Australia
Distribution: Mostly Debian (and Ubuntu)
Posts: 12

Rep: Reputation: 0
Counting mouse clicks/movement and keyboard presses?


I am working on a Tcl UNIX client for SigX called TclSigX at the moment.

Basiclly what the client does is retrieve user and system stats from the computer it is installed in, format it so it looks neat and readable and send it to the SigX server, every couple of minutes. SigX then generates and updates an image with these statistics writen onto it, and you can use that image on a forum or email signature.

Anyway, I wanted to impliment a feature similar to one that the Windows clients have, which is to count the number of times the mouse has been clicked, scrolled and how far it has been moved, and how many times keys on the keyboard has been pressed.

As there are no (or at least stable) APIs to X for Tcl, the only solutions I can see to this problem is figuring this stuff out via some command, or making up a [C] helper program to come with TclSigX. I'd like to avoid making up a helper.

So, would anyone be able to help me out a bit here?
 
Old 06-20-2005, 08:23 AM   #2
zulfilee
Member
 
Registered: Apr 2004
Location: India
Distribution: Redhat,Fedora
Posts: 430

Rep: Reputation: 39
Hey I `ve seen one such utility
Its a command by name
xev

And it does the job pretty well.It gives me the statistics of mouse click , release
Keyboard press,etc
But I am not sure whether its there in Tcl Unix or not.

Cheers
Z
 
Old 01-21-2011, 01:12 AM   #3
hamedhsn
Member
 
Registered: Feb 2010
Distribution: opensuse 11.2
Posts: 57

Rep: Reputation: 0
Quote:
Originally Posted by zulfilee View Post
xev

And it does the job pretty well.It gives me the statistics of mouse click , release
Keyboard press,etc
Z
could you show example of how to use it to achieve that result i really need it.
thanks
 
Old 01-21-2011, 01:19 AM   #4
zulfilee
Member
 
Registered: Apr 2004
Location: India
Distribution: Redhat,Fedora
Posts: 430

Rep: Reputation: 39
Running just xev on the command prompt will create a window
If u click on the window the X,Y coordinates and the type of click will be displayed.

You can also use xev to get mouse related info from an existing window.

Ex:
You have a Xterm and you want to get mouse related info from that window

Go to the xterm

Type

xwininfo

THis will give you the windows id.

Then use

xev -id <windows_id>

to track the evens from window with window id <windowid>
 
Old 01-21-2011, 01:28 AM   #5
zulfilee
Member
 
Registered: Apr 2004
Location: India
Distribution: Redhat,Fedora
Posts: 430

Rep: Reputation: 39
Also there is another command line tool call xmacro.

Its used for recording keyboard and mouse events and replay them.

I guess it should be useful for your query


Install xmacro [its a very small utility]

Run
xmacrorec2

Click the mouse anywhere and see the Button Number and coordinated getting logged.
 
Old 01-21-2011, 02:05 AM   #6
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,599
Blog Entries: 29

Rep: Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880
Quote:
Originally Posted by breadcrust View Post
I am working on a Tcl UNIX client
....
Anyway, I wanted to impliment a feature similar to one that the Windows clients have, which is to count the number of times the mouse has been clicked, scrolled and how far it has been moved, and how many times keys on the keyboard has been pressed.
....
So, would anyone be able to help me out a bit here?
Google told me TCL is a language, but I don't know what is "Tcl UNIX"

You can write an interrupt handler for keyboard strokes:
http://www.linuxquestions.org/questi...2/#post3771000

This one runs from the user space, but it has termios struct, see for yourself if that works in your case.
http://www.linuxquestions.org/questi...1/#post3956458

and look at this too:
http://www.win.tue.nl/~aeb/linux/kbd/scancodes.html
 
Old 01-21-2011, 02:42 AM   #7
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,599
Blog Entries: 29

Rep: Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880
Now I realize the thread is from 2005!
 
Old 01-22-2011, 09:11 AM   #8
hamedhsn
Member
 
Registered: Feb 2010
Distribution: opensuse 11.2
Posts: 57

Rep: Reputation: 0
Quote:
Originally Posted by zulfilee View Post
Install xmacro [its a very small utility]

Run
xmacrorec2
i am using opensuse 11.2 and i have to install xmacro with tar.gz file and when first i use make command i 'v got some errors and i dont know why?and how can i resolve it?
this part of the errors:
Code:
xmacroplay.cpp: In function ‘void eventLoop(Display*, int)’:                                                                     
xmacroplay.cpp:336: error: ‘cin’ was not declared in this scope                                                                  
xmacroplay.cpp:340: error: ‘cout’ was not declared in this scope                                                                 
xmacroplay.cpp:340: error: ‘endl’ was not declared in this scope                                                                 
xmacroplay.cpp:346: error: ‘cout’ was not declared in this scope                                                                 
xmacroplay.cpp:346: error: ‘endl’ was not declared in this scope                                                                 
xmacroplay.cpp:352: error: ‘cout’ was not declared in this scope                                                                 
xmacroplay.cpp:352: error: ‘endl’ was not declared in this scope                                                                 
xmacroplay.cpp:358: error: ‘cout’ was not declared in this scope                                                                 
xmacroplay.cpp:358: error: ‘endl’ was not declared in this scope                                                                 
xmacroplay.cpp:364: error: ‘cout’ was not declared in this scope                                                                 
xmacroplay.cpp:364: error: ‘endl’ was not declared in this scope                                                                 
xmacroplay.cpp:370: error: ‘cout’ was not declared in this scope
xmacroplay.cpp:370: error: ‘endl’ was not declared in this scope
xmacroplay.cpp:376: error: ‘cout’ was not declared in this scope
xmacroplay.cpp:376: error: ‘endl’ was not declared in this scope
xmacroplay.cpp:382: error: ‘cout’ was not declared in this scope
xmacroplay.cpp:382: error: ‘endl’ was not declared in this scope
xmacroplay.cpp:385: error: ‘cerr’ was not declared in this scope
xmacroplay.cpp:395: error: ‘cout’ was not declared in this scope
xmacroplay.cpp:395: error: ‘endl’ was not declared in this scope
xmacroplay.cpp:398: error: ‘cerr’ was not declared in this scope
i really need to install it.thanks for your help

Last edited by hamedhsn; 01-22-2011 at 09:12 AM.
 
Old 01-23-2011, 02:29 PM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,345

Rep: Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945
Quote:
Originally Posted by Anisha Kaul View Post
Now I realize the thread is from 2005!
And then people slag moderators off for pointing this out to people dragging it up from the dead. But instead you've ended up being tricked into wasting your time trying to help someone from 5 years ago...
 
Old 01-23-2011, 03:03 PM   #10
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: Debian lenny, Slackware 12
Posts: 806

Rep: Reputation: 161Reputation: 161
Quote:
Originally Posted by acid_kewpie View Post
And then people slag moderators off for pointing this out to people dragging it up from the dead. But instead you've ended up being tricked into wasting your time trying to help someone from 5 years ago...
Well, no. They're also helping hamedhsn, who expressed an interest in the solution within the last day or so. He has taken over the mantle of the original poster.
 
Old 01-23-2011, 07:31 PM   #11
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,599
Blog Entries: 29

Rep: Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880
Quote:
Originally Posted by hamedhsn View Post
Code:
xmacroplay.cpp: In function ‘void eventLoop(Display*, int)’:                                                                     
xmacroplay.cpp:336: error: ‘cin’ was not declared in this scope                                                                  
...
Try adding using namespace std; at the top of the file named 'xmacroplay.cpp', see if you get any different errors this time?

---------- Post added Jan 24th, 2011 at 07:02 ----------

Quote:
Originally Posted by acid_kewpie View Post
And then people slag moderators off for pointing this out to people dragging it up from the dead.
But in this case the first helper is still active, so yet there is no reason for the thread closure
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
random mouse clicks SuSE 9.3 MichaelLange Linux - Hardware 3 03-09-2006 05:10 PM
How to capture clicks from mouse to a file floydigus Linux - Hardware 2 07-02-2005 01:40 AM
Javasript to count number of mouse clicks LinuxLala Programming 3 06-17-2005 12:23 AM
Mouse clicks link to alt-func? Doolspin Linux - Software 2 02-20-2005 11:22 AM
Simulated mouse clicks in linux? devilkin Programming 2 02-14-2005 07:59 AM


All times are GMT -5. The time now is 03:59 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration