AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to spy on mouse and stylus clicks without interfering?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Robert Carnegie



Joined: 01 Jun 2005
Posts: 53
Location: Scotland

PostPosted: Fri Jan 20, 2006 12:44 pm    Post subject: How to spy on mouse and stylus clicks without interfering? Reply with quote

In the context of of discussion http://www.tabletpcbuzz.com/forum/topic.asp?TOPIC_ID=32151
I want to detect mouse or stylus pen-down in more-or-less any application, without interfering with the normal effect of the action - including double-click, drag-and-drop, etc.

There are hints that I can use OnMessage() to detect activity, possibly using AHk's GUI, but I don't understand GUI.

The actual goal is to implement a new behaviour with existing on-screen keyboard software for Tablet PC - the new behaviour being that the keyboard window is to pop up next to the text cursor when you left-click in a text field, i.e. when you click with an I-beam cursor.

This is in the context of scripting for general useful context-sensitive behaviour of an on-screen keyboard program - I'm using Fitaly but others are popular - appearing when it's wanted, not when it isn't; and if possible making constructive suggestions for a script such as WinWarden, which I found on a link from here. That is to say, I want to find out how to do this and then I want to suggest to Skrommel to put it into WinWarden. Then whenever someone says "I want to make my on-screen keyboard behave this way" - fade away, fold up, bounce away from the stylus - other users can say "Do it with WinWarden".

Executing an arbitrary script definition from a WinWarden "mode" (more or less an event) could be useful, I think. It currently can execute a command line, but that is not a completely satisfactory solution because an AHk script run that way takes noticeable time to get started and run. An alternative that might be good is to send a message from WinWarden to another AHk script already loaded - waiting to be woken up. The message should identify the window and/or the WW "mode" that generated the message; in principle, the other script can read the settings WinWarden.ini if need be.

I have a simple and apparently effective prototype script at http://fitaly.com/board/fsbetaforum/posts/372.html that does not catch clicks (and another which does) but merely loops with short sleeps for the system to be momentarily idle and then tests for I-beam cursor, which usually implies that focus is on a text field.

I also welcome suggestions of other approaches.

Incidentally, is a sleep-loop that repeatedly tests the idle time efficient? An AHk timer that runs whenever idle would be arguably more elegant, but that doesn't seem to be an option - and if it's okay to do it this way, it may not be necessary. However, would it be better to use a timer instead of a loop?
Back to top
View user's profile Send private message Send e-mail
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10471

PostPosted: Sat Jan 21, 2006 1:31 pm    Post subject: Reply with quote

Your approaches seem reasonable. You probably already know that you can catch mouse clicks (perhaps even those generated with a tablet pen) by creating pass-through hotkeys for the mouse buttons. For example:

~LButton::
~RButton::

As for timers vs. sleep-loops, a timer is usually more convenient but a sleep loop might perform slightly better (I'm not sure).
Back to top
View user's profile Send private message Send e-mail
Robert Carnegie



Joined: 01 Jun 2005
Posts: 53
Location: Scotland

PostPosted: Mon Jan 23, 2006 11:58 am    Post subject: I score F for reading comprehension Reply with quote

Chris wrote:
You probably already know that you can catch mouse clicks (perhaps even those generated with a tablet pen) by creating pass-through hotkeys for the mouse buttons. For example:

~LButton::
~RButton::

I didn't - and I managed to misread this as telling me about the basic LButton, RButton functionality, which is probably enough to go on with!

I have several ideas now for this field - which is why I'm interested in seeing them written into a general adaptable script. Being interested in having someone else do the actual work may just be some kind of "moral compass" problem Wink
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group