Jump to content

Mouse Gesture


Recommended Posts

Hellow poh,

I'm creating a web browser using pure autoit(but using IE commands) and one of the features i would like

to add is the Mouse Gestures ( while holding right mouse button, swing the mouse left to go back to the previous page or swing right to go 1 page forward)

Here is the script that i've thought so far but it doesn't work very well

Func _mouseGesture() 
    If _IsPressed(02) Then ;If rightmouse button is pressed
             $coords  = MouseGetPos() ;get initial mouse coords
        While _IsPressed(02) ;while rightmouse is still down
            sleep(500) 
            $coords2 = MouseGetPos() ;get the new coords of the mouse 
            If $coords2[0] < ($coords[0]-100)  Then ;if the new coords is less than, which means it has lesser value of x, then it's located at the left
MsgBox(0,"aw","left")
                sleep(1000)
            ElseIf $coords2[0] > ($coords[0]+100) Then ;if the new coords is greater than, which means it has greater value of x, then it's located at the right
MsgBox(0,"aw","right")
            EndIf
        WEnd
    EndIf
EndFunc
Edited by adik2dmax666
First learn computer science and all the theory. Next develop a programming style. Then forget all that and just hack. -George Carrette[sub]GD Keylogger Creator (never released)[/sub][sub]Garena Autojoin v3.0[/sub]
Link to comment
Share on other sites

I would think the sleep statements are what is making it now work well. I fiddled around with them and I have it working pretty well. I like the idea you have in mind.

#Include <Misc.au3> 

while 1
    _mouseGesture()
wend    
Func _mouseGesture() 
    If _IsPressed(02) Then ;If rightmouse button is pressed
             $coords  = MouseGetPos() ;get initial mouse coords
        While _IsPressed(02) ;while rightmouse is still down
            sleep(100) 
            $coords2 = MouseGetPos() ;get the new coords of the mouse 
            If $coords2[0] < ($coords[0]-50)  Then ;if the new coords is less than, which means it has lesser value of x, then it's located at the left
MsgBox(262144,"aw","left")
            ElseIf $coords2[0] > ($coords[0]+50) Then ;if the new coords is greater than, which means it has greater value of x, then it's located at the right
MsgBox(262144,"aw","right")
            EndIf
        WEnd
    EndIf
EndFunc
Edited by Volly
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...