Jump to content

Very Simple Mouse Gesture Program


fmen
 Share

Recommended Posts

I was fooling around trying to make a simple mouse gesture program but I can't even get my basic variables straight.

The script is suppossed to react to the right mouse click dragged to the left over a 1 second period. Can someone set me straight in assigning the mouse position variables? Thanks.

#include <_IsPressed.au3

While 1

$i = MouseGetPos()

If _IsPressed('01') = 1 Then

$i[0]=$a

Sleep (1000)

$i[0]=$b

Endif

If $b < $a then MsgBox(4096,"control", "Mouse moved from right to left")

Sleep(10)

WEnd

Edited by fmen
Link to comment
Share on other sites

look up "MouseGetPos"... this is how

on your computer press the following

Start > All Programs > Autoit v3 > Autoit Help File

when that loads then press the "search" tab

then type in "?your search?" and press "List Topics"

**** you can do this with any word you want

thats what i do all the time

8)

NEWHeader1.png

Link to comment
Share on other sites

I just hate it when you tell people to RTFM, and they actually STARTED DOING SOMETHING..Maybe we should start telling you the same thing when you want help..fmen..here's a working version of your program..You wanted a RIGHT mouse click..this program reacts to a LEFT mouse click (hence "01")..

#include <Misc.au3>
Func Die()
Exit
EndFunc
HotKeySet("^+{F1}","Die")
While 1
If _IsPressed('01') = 1 Then 
$i=MouseGetPos()
Sleep(1000)
$j=MouseGetPos()
If $i[0] > $j[0] then MsgBox(4096,"control", "Mouse moved from right to left "&$i[0]-$j[0]&" pixels") 
Endif
WEnd

A pixel to the RIGHT of another pixel has a bigger X value..thus we check if the first value was bigger than the second..that would mean the first pixel is at the right of the second pixel..thus it moved from right to left ;)..Keep at it, and you'll eventually, and by yourself, flame the bastards that tell you to RTFM..Peace..

Quote

Together we might liveDivided we must fall

 

Link to comment
Share on other sites

Also try $dll=DllOpen("user32.dll") at the beginning of the program, and call _IsPressed like this: _IsPressed('01',$dll)..This'll make it much faster since it doesn't have to open/close the dll every call ;)

Quote

Together we might liveDivided we must fall

 

Link to comment
Share on other sites

Thank you VicTT. I neant to say left click but I wrote right.

The $dll stuff is totally new. Thanks.

Valuater has helped me in the past and I appreciate his frustration at having so many posts asking for scripts.

I thought my question might open up a discussion on mouse gestures as well as help me with variables, I din't mean to be one of those ....you know wahatss.

Thanks again.

Link to comment
Share on other sites

No problem, fmen..A discussion on mouse gestures would have been nice, although I believe none of us have experience in this field..I can help you develop your script..try, for example, to make the script recognise when the mouse moves from left to right, up to down, down to up, and give the appropriate messages..Try to turn into a function..If you can manage that, then I'd advise people to stop posting just for the sake of posting, and actually help you..I'm glad Valuater has helped you in the past..He may not be such a bastard after all ;)..Glad I could help, and you can be sure that if I can help you in the future, I will..Peace..

Edited by VicTT
Quote

Together we might liveDivided we must fall

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...