AutoHotkey Community

It is currently May 26th, 2012, 9:05 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 108 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 8  Next
Author Message
 Post subject:
PostPosted: February 3rd, 2008, 12:19 am 
Offline

Joined: September 1st, 2007, 8:56 pm
Posts: 120
I use a gesture macro right now for a simplistic media player I created with AHK, and I love it very much. However, I am also a Warcraft player. In the game, you use the right mouse button to move your units. Sometimes I right click to move the unit and move my mouse and the script interprets a media combination, not only causing my player to react but nullifying my unit movement in the game.
I just quickly tried to remap the combination to be the right and left mouse buttons instead, but I am having difficulty as when you emulate both keys together, it either gets rid of the use of one of the keys by itself (no tilde) or causes both of them to fire after you let them go (tilde). Does anyone know how I can have it only remove the normal functions of the mouse keys when both of them are held down?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2008, 1:13 pm 
Offline

Joined: October 5th, 2007, 2:21 am
Posts: 138
Location: Bundaberg (Bundy), Qld, Australia
i made a similar point on page 2. lexikos responded by telling me to look up WH_MOUSE_LL and SetWindowsHookEx. i'm none the wiser, but let me know if you can make sense of the lead.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2008, 2:00 pm 
Democratus wrote:
I use a gesture macro right now for a simplistic media player I created with AHK


would you mind sharing the script please?

rodfell, thanks for adding the mouse rock option. cool script.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2008, 9:03 am 
Offline

Joined: October 5th, 2007, 2:21 am
Posts: 138
Location: Bundaberg (Bundy), Qld, Australia
added fourth mouse button gesturing. i now use this instead of the standard media buttons, so i have included these as examples. also tidied up the wheel section a bit
Code:
;;Simple Mouse Gestures call subroutines based on a gesture made when the right button is held down.
;the script tracks up (u) down (d) left (l) right (r). There is a tolerance of +/- 45 degrees, so it is quite simple and accurate
;by not allowing diagonals, gestures can have curves. eg a circle drawn from the top and clockwise is registered as rdlu (right down left up)
;if a gesture is down (d) and right (r), like an "L", a subroutine called gdr ( for gesture down right) will be called
;if anything is labelled as gdr:, the action will be run

;in addition, gestures can be terminated by a left click (c), which modifies the subroutine called. eg gudc (gesture up down click)
;the 4th mouse button (xbutton1) can be used instead of the right button. This will call subroutines beginning with "gx" eg gxl:
;also, the action of wheelup and wheeldown (w) can be modified depending on gesture. eg if you gesture left, and keep the right button depressed, you can use the wheel (up or down) for any use you define. see glw: example which adjusts volume

;some example gesture subroutines can be found below

CoordMode, Mouse, Screen
winget, window0, id, ahk_class Progman   ;window0 is the desktop
hotkey, lbutton, off    ;allows normal left click function

xbutton1::
rbutton::
if getkeystate("rbutton","p")
xbutton=
else
xbutton=x    ;add an "x" if using 4th mouse button
hotkey, lbutton, on      ;disables normal left click
if (window1<>window0)     
   window2:=window1                ;window1 is the window underneath the current gesture, window2 is from the previous gesture   
mousegetpos,xpos1, ypos1,window1   
gesture=      ;clear previous tracking results
settimer, gesture, 10
GestureMode = 1
return

xbutton1 up::
rbutton up::
if not gesturemode
   return
settimer, gesture, off
hotkey, lbutton, off      ;re-enables normal left click
GestureMode = 0
gesture := "g" . xbutton . gesture   ;eg. gdr = gesture down right
if islabel(gesture)              ;checks if gesture is labelled
   gosub, %gesture%         ; eg. gosub, gdr
return

gesture:
if SubStr(gesture, 0)="w"  ;if using wheel, this stops mouse drift stopping gesture
   return           
mousegetpos,xpos2, ypos2
dx:=xpos2-xpos1     
dy:=ypos1-ypos2     
if (abs(dy)>=abs(dx))   
   {
   if (dy>0)
      track=u  ;track is up
   else
      track=d     ;down   
   }
else
   {
   if (dx>0)
      track=r      ;right
   else
      track=l      ;left
   }
if (abs(dy)<4 and abs(dx)<4)
   track=         ;not tracking at all if no significant change in x or y
xpos1:=xpos2
ypos1:=ypos2
if (track<>SubStr(gesture, 0, 1))     ;ignore track if not changing since previous track
   gesture := gesture . track
return

lbutton::         ;registers a left click. terminates the gesture
gesture := gesture . "c"
gosub, rbutton up    ;delete this line if you don't want left clicks to terminate the gesture
gesturemode=0        ;delete this line if you don't want left clicks to terminate the gesture
return

WheelUp::
wheeldir=wheelup
gosub, wheel
return

WheelDown::
wheeldir=wheeldown
gosub, wheel
return

wheel:
If GestureMode ;we're currently recording a gesture
{
   If (SubStr(gesture, 0) <> "w")
       gesture := "g" . xbutton . gesture . "w"   
   if islabel(gesture)
      gosub, %gesture%
}
Else ;we're not recording a gesture so just do a wheelup or wheeldown
   Sendinput {%wheeldir%}
Return


g:          ;normal right click
click, right, xpos1, ypos1
exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;; Examples ;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;; wheel examples ;;;;;;;;;;

glw:      ;change volume with wheel - gesture left then use wheel keeping the right button down   
if wheeldir=wheelup
Send {Volume_Up}
else
Send {Volume_Down}
return    ;end wheel gestures with a "return" NOT "exit"    !!!!!!!!


;;;;;;;; click examples ;;;;;;;;;;

gc:
msgbox,,,rocker,5
exit      ;end all labels (other than wheel gestures) with "exit" NOT "return"   

glc:
msgbox,,,you gestured left and clicked,5
exit

;;;;;;;;;;;; 4th mouse button examples ;;;;;;;;;;

gxl:
gxr:
sendinput, ^!{media_play_pause}
exit


gxul:
gxdl:
sendinput, ^!{media_prev}
exit

gxur:
gxdr:
sendinput, ^!{media_next}
exit


;;;;;;;; other examples ;;;;;;;;;;;;;;

gu:             ;; gesture up ;; maximize window under cursor. maximize last window if cursor over desktop
if (window1=window0)
   {
   if (window2<>"")
   winmaximize, ahk_id %window2%
   }
else
   winmaximize, ahk_id %window1%
exit

gd:            ;minimize window under cursor
if (window1<>window0)    ;don't minimize the desktop
   winminimize, ahk_id %window1%
exit

gl:            ;browser back
winactivate, ahk_id %window1%   
sendinput, {Browser_Back}
exit   

gr:            ;browser forward
winactivate, ahk_id %window1%   
sendinput, {Browser_Forward}
exit

gdr:            ;restore last window.
winrestore, ahk_id %window2%
exit

gldr:            ;close window under cursor (draw a C)
if (window1<>window0)
   winclose, ahk_id %window1%
exit

gldrdl:
msgbox, you drew an S
exit

gurdurd:
msgbox, you drew an M
exit



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2008, 8:29 pm 
One question, i've been trying to implement only parts of script, namely the mauswheel to adjust my volume. is it correct that the use of the right mouse button as indicator for the gesture mode (or volume mode in my case) kills the right button drag and drop function? or can you get that back by chance?

mfg

rien


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2008, 12:11 am 
Offline

Joined: October 5th, 2007, 2:21 am
Posts: 138
Location: Bundaberg (Bundy), Qld, Australia
unfortunately loss of right drag is a problem. i don't use it that often. i work around it by including the line
Code:
$#rbutton::rbutton
. This allows me to right drag when i hold the windows button


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2008, 8:23 pm 
Offline

Joined: May 16th, 2008, 8:09 pm
Posts: 12
I modified this script to accept diagonals. However, as observed by others the extra directions can cause some problems with accuracy of tracking. My solution is to allow all 8 directions for the first stroke of a gesture then to only look at 4 for subsequent
the variable mode indicates the types of moves allowed. 0 means all 8. 1 means horizonal and vertical, 2 means diagonals. I reset mode to 0 in the rbutton down portion of the code, not shown here.
I define diagonals as 1,2,3,4 using standard quadrant numsering scheme. 1=ur,2=ul,3=dl,4=dr
so to set something for diagonal up and left, you'd add
Code:
g1:
;do something
exit


Code:
...
gesture:
settimer, gesture, off
if SubStr(gesture, 0)="w"  ;if using wheel, this stops mouse drift stopping gesture
   return           
mousegetpos,xpos2, ypos2
dx:=xpos2-xpos1     
dy:=ypos1-ypos2
dist:= sqrt(dx*dx+dy*dy)
if(dist<20)
{
   settimer, gesture, -10
   return
}
if (dx==0)
{
   slope:=dy*10
}
else
{
   slope:=dy/dx
}
tanpi8:=0.414213562373095 ;tangent of pi/8
tanpi3o8:=2.41421356237309 ;tanget of pi3/8 ;limits of diagonals
slope:= abs(slope)
if (mode==0)
{
   if (slope>tanpi3o8)
   {
      mode=1
      ;vertical move
      if dy>0
         track=u
      else
         track=d
   }
   else
   {
      if (slope>tanpi8)
      {
         mode=2
         if dx > 0
         {
            if dy>0
            track=1
            else
               track=4
         }
         else
         {
            if dy>0
               track=2
            else
               track=3
         }   
      }
      else
      {
         mode=1
         ;horizontal move
         if dx>0
            track=r
         else
            track=l
      }
   }
}
else if (mode==1)
{
   if(slope>1)
   {
      if(dy>0)
         track=u
      else
         track=d
   }
   else
   {
      if(dx>0)
         track=r
      else
         track=l
   }
}
else if (mode==2)   
{
   if(dx>0)
   {
      if(dy>0)
         track=1
      else
         track=4
   }
   else
   {
      if(dy>0)
         track=2
      else
         track=3
   }
}

      xpos1:=xpos2
      ypos1:=ypos2
      if (track<>SubStr(gesture, 0, 1))     
            gesture := gesture . track

settimer, gesture, -10
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject: rocker
PostPosted: July 11th, 2008, 2:55 am 
Offline

Joined: October 5th, 2007, 2:21 am
Posts: 138
Location: Bundaberg (Bundy), Qld, Australia
i added a left click then right click rocker. minor tidy of documentation and code
Code:
;;Simple Mouse Gestures call subroutines based on a gesture made when the right button is held down.
;the script tracks up (u) down (d) left (l) right (r). There is a tolerance of +/- 45 degrees, so it is quite simple and accurate
;by not allowing diagonals, gestures can be drawn without abrupt angles. eg a circle drawn from the top and clockwise is registered as rdlu (right down left up)
;if a gesture is down (d) and right (r), like an "L", a subroutine called gdr ( for gesture down right) will be called

;in addition, gestures can be terminated by a left click (c), which modifies the subroutine called. eg gudc (gesture up down click)
;gc becomes a right click then left click rocker
;a left then right rocker is also incorporated
;the 4th mouse button (xbutton1) can be used instead of the right button. This will call subroutines beginning with "gx" eg gxl:. This can also be used as a rocker
;also, the action of wheelup and wheeldown (w) can be modified depending on gesture. eg if you gesture left, and keep the right button depressed, you can use the wheel (up or down) for any use you define. see glw: example which adjusts volume
;the script also pays attention to the window under the gesture
;some example gesture subroutines can be found below

coordmode, mouse, screen
winget, window0, id, ahk_class Progman   ;window0 is the desktop
hotkey, lbutton, off    ;allows normal left click function

xbutton1::
rbutton::
gesture=     
gesturemode=1
xbutton:=getkeystate("xbutton1","p") ? "x" : ""   ;add an "x" if using 4th mouse button
lbutton:=getkeystate("lbutton","p") ? "m" : ""      ;used in rocker
hotkey, lbutton, on      ;disables normal left click
if (window1<>window0)     
   window2:=window1                ;window1 is the window underneath the current gesture, window2 is from the previous gesture   
mousegetpos,xpos1, ypos1,window1 
if lbutton=m
   gosub rbutton up   ;rocker
settimer, gesture, 10

return

xbutton1 up::
rbutton up::
if not gesturemode
   return
settimer, gesture, off
hotkey, lbutton, off      ;re-enables normal left click
gesturemode=0
gesture := "g" . xbutton . lbutton . gesture   ;eg. gdr = gesture down right
if islabel(gesture)              ;checks if gesture is labelled
   gosub, %gesture%         ; eg. gosub, gdr
return

gesture:
if SubStr(gesture, 0)="w"  ;if using wheel, this stops mouse drift stopping gesture
   return           
mousegetpos,xpos2, ypos2
dx:=xpos2-xpos1     
dy:=ypos1-ypos2     
if (abs(dy)>=abs(dx))   
   {
   if (dy>0)
      track=u  ;track is up
   else
      track=d     ;down   
   }
else
   {
   if (dx>0)
      track=r      ;right
   else
      track=l      ;left
   }
if (abs(dy)<4 and abs(dx)<4)
   track=         ;not tracking at all if no significant change in x or y
xpos1:=xpos2
ypos1:=ypos2
if (track<>SubStr(gesture, 0, 1))     ;ignore track if not changing since previous track
   gesture := gesture . track
return

lbutton::         ;registers a left click. terminates the gesture
gesture := gesture . "c"
gosub, rbutton up    ;delete this line if you don't want left clicks to terminate the gesture
gesturemode=0        ;delete this line if you don't want left clicks to terminate the gesture
return

WheelUp::
wheeldir=wheelup
gosub, wheel
return

WheelDown::
wheeldir=wheeldown
gosub, wheel
return

wheel:
If gesturemode
{
   If (SubStr(gesture, 0) <> "w")
       gesture := "g" . xbutton . gesture . "w"   
   if islabel(gesture)
      gosub, %gesture%
}
Else
   Sendinput {%wheeldir%}
Return


g:          ;normal right click
click, right, xpos1, ypos1
exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;; Examples ;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;; wheel examples ;;;;;;;;;;

glw:      ;change volume with wheel - gesture left then use wheel keeping the right button down   
if wheeldir=wheelup
Send {Volume_Up}
else
Send {Volume_Down}
return    ;end wheel gestures with a "return" NOT "exit"    !!!!!!!!


;;;;;;;; click examples ;;;;;;;;;;

gc:
msgbox,,,rocker right then left,5
exit      ;end all labels (other than wheel gestures) with "exit" NOT "return" 

gm:
msgbox,,,rocker left then right. careful where you click,5
exit

glc:
msgbox,,,you gestured left and clicked,5
exit

;;;;;;;;;;;; 4th mouse button examples ;;;;;;;;;;

gxl:
gxr:
sendinput, ^!{media_play_pause}
exit


gxul:
gxdl:
sendinput, ^!{media_prev}
exit

gxur:
gxdr:
sendinput, ^!{media_next}
exit


;;;;;;;; other examples ;;;;;;;;;;;;;;

gu:             ;; gesture up ;; maximize window under cursor. maximize last window if cursor over desktop
if (window1=window0)
   {
   if (window2<>"")
   winmaximize, ahk_id %window2%
   }
else
   winmaximize, ahk_id %window1%
exit

gd:            ;minimize window under cursor
if (window1<>window0)    ;don't minimize the desktop
   winminimize, ahk_id %window1%
exit

gl:            ;browser back
winactivate, ahk_id %window1%   
sendinput, {Browser_Back}
exit   

gr:            ;browser forward
winactivate, ahk_id %window1%   
sendinput, {Browser_Forward}
exit

gdr:            ;restore last window.
winrestore, ahk_id %window2%
exit

gldr:            ;close window under cursor (draw a C)
if (window1<>window0)
   winclose, ahk_id %window1%
exit

gldrdl:
msgbox, you drew an S
exit






Report this post
Top
 Profile  
Reply with quote  
 Post subject: reply
PostPosted: July 13th, 2008, 4:10 pm 
ManaUser wrote:
lilljimpa wrote:
how do i add a weelup and weeldown to this gesture?

Heh, this is getting not-so-simple but here goes: (magenta parts are new)
Code:
;simple mouse gestures call subroutines based on a gesture (right button)
;the script tracks up (u) down (d) left (l) and right (r). There is a tolerance of +/- 45 degrees, so it is quite simple and accurate
;gestures can have curves. eg a circle drawn from the top and clockwise is registered as rdlu (right down left up)
;if a gesture is down (d) and right (r), like an "L", a subroutine called gdr ( for gesture down right) will be called
;if anything is labelled as gdr:, the action will be run
;as a further example, if an "S" is drawn (from top to bottom), gldrdl: (gesture left down right down left) will be called
;these 2 examples are included. See below for further examples

CoordMode, Mouse, Screen
winget, window0, id, ahk_class Progman   ;not needed to make a gesture, window0 is used in subroutines called by gestures used on the desktop. see gu: subroutine example

rbutton::
if (window1<>window0)      ;these 2 lines do not help the creation of gestures. The variable window2 can be used by subroutines called
   window2:=window1    ;by the gestures eg. maximize previous window
mousegetpos,xpos1, ypos1,window1   ;window1 can be used by subroutines eg maximize window under cursor
gesture=      ;clear previous tracking results, variable array gesture1 to gesture5
settimer, gesture, 10
GestureMode = 1
return

rbutton up::
settimer, gesture, off
GestureMode = 0
gesture := "g" . gesture   ;eg. gdr = gesture down right
if islabel(gesture)<>0              ;checks if gesture is labelled
   gosub, %gesture%         ; eg. gosub, gdr
msgbox,,, %gesture% not yet defined,4
return

gesture:
mousegetpos,xpos2, ypos2
dx:=xpos2-xpos1     
dy:=ypos1-ypos2     
if (abs(dy)>=abs(dx))   
   {
   if (dy>0)
      track=u  ;track is up
   else
      track=d     ;down   
   }
else
   {
   if (dx>0)
      track=r      ;right
   else
      track=l      ;left
   }
if (abs(dy)<4 and abs(dx)<4)
   track=         ;not tracking at all if no significant change in x or y
xpos1:=xpos2
ypos1:=ypos2
if (track<>SubStr(gesture, 0, 1))     ;ignore track if not changing since previous track
   gesture := gesture . track
return

WheelUp:: ;Since u and d are taken, we'll use + and - for the mouse wheel.
If GestureMode ;we're currently recording a gesture
{
   If (SubStr(gesture, 0) != "+") ;Don't record two wheelups in a row
      gesture := gesture . "+"
}
Else ;we're not recording a gesture so just do a wheelup
   Send {WheelUp}
Return

WheelDown:: ;ditto for down
If GestureMode
{
   If (SubStr(gesture, 0) != "-")
      gesture := gesture . "-"
}
Else
   Send {WheelDown}
Return


g:          ;normal right click
click, right, xpos1, ypos1
exit

;;;;;;; Examples ;;;;;;;;;;;;;;;;;;;;;;;;;;

gu:             ;; gesture up ;; maximize window under cursor. maximize last window if cursor over desktop
if (window1=window0)
   {
   if (window2<>"")
   winmaximize, ahk_id %window2%
   }
else
   winmaximize, ahk_id %window1%
exit

gd:            ;minimize window under cursor
if (window1<>window0)
   winminimize, ahk_id %window1%
exit

gl:            ;browser back
winactivate, ahk_id %window1%   
sendinput, {Browser_Back}
exit   

gr:            ;browser forward
winactivate, ahk_id %window1%   
sendinput, {Browser_Forward}
exit

gdr:            ;restore last window.
winrestore, ahk_id %window2%
exit

gldr:            ;close window under cursor (draw a C)
if (window1<>window0)
   winclose, ahk_id %window1%
exit

gldrdl:
msgbox, you drew an S
exit

gurdurd:
msgbox, you drew an M
exit

g+:
MsgBox WheelUp
exit

g-:
MsgBox WheelDown
exit

gl+:
MsgBox Left-WheelUp
exit



what do i save this as


Report this post
Top
  
Reply with quote  
 Post subject: wheel gestures
PostPosted: July 14th, 2008, 9:45 am 
Offline

Joined: October 5th, 2007, 2:21 am
Posts: 138
Location: Bundaberg (Bundy), Qld, Australia
what do you mean?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2008, 7:37 am 
Offline

Joined: October 5th, 2007, 2:21 am
Posts: 138
Location: Bundaberg (Bundy), Qld, Australia
fairly significant code tweaking but still same function
Code:
coordmode mouse,screen
winget window0,id,ahk_class Progman   ;window0 is the desktop
hotkey lbutton,off    ;normal left click function only affected during gesture

xbutton1::
rbutton::
mousetrack=
wheel=     
gesturemode:=true
xbutton:=getkeystate("xbutton1","p") ? "x" : ""   ;add an "x" if using 4th mouse button
lbutton:=getkeystate("lbutton","p") ? "rocker" : ""     
hotkey lbutton,on      ;disables normal left click during gesture
if (window1<>window0)     
   window2:=window1               
mousegetpos xpos1,ypos1,window1       ;window1 is the window underneath the current gesture, window2 is from the previous gesture   
if lbutton
   gosub rbutton up   ;left to right rocker, no tracking needed
else
   settimer,mousetrack,10   
return

mousetrack:     
mousegetpos xpos2,ypos2 
track:=(abs(ypos1-ypos2)>=abs(xpos1-xpos2)) ? (ypos1>ypos2 ? "u" : "d") : (xpos1>xpos2 ? "l" : "r")  ;determines up down left or right
if (abs(ypos1-ypos2)>3 or abs(xpos1-xpos2)>3) and (track<>SubStr(mousetrack, 0, 1))    ;track if x or y changing and direction changing
   mousetrack.=track
xpos1:=xpos2
ypos1:=ypos2
return

lbutton::         ;registers a left click. terminates the gesture
mousetrack.="c"
xbutton1 up::
rbutton up::
if not gesturemode
   return
gesturemode:=false
if  wheel
      return
callgesture:      ;entry label for wheel gestures
settimer,mousetrack,off
hotkey lbutton,off      ;re-enables normal left click
gesture := "g" . xbutton . lbutton . mousetrack . wheel  ;eg. gdr = gesture down right
if islabel(gesture)              ;checks if gesture is labelled
   gosub %gesture%       
return

wheelup::
wheeldown::
wheel:=a_thishotkey="wheelup" ? "wheelup" : "wheeldown"
if gesturemode
   gosub callgesture
else
   sendinput {%wheel%}
return

g:          ;normal right click
click right,xpos1,ypos1
exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;; Examples ;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;; wheel examples ;;;;;;;;;;

gwheelup:      ;change volume with wheel -  hold right button down and use wheel
Send {Volume_Up}
return

gwheeldown:
Send {Volume_Down}
return    ;end wheel gestures with a "return" NOT "exit"    !!!!!!!!


;;;;;;;; click examples ;;;;;;;;;;

gc:
msgbox,,,rocker right then left,5
exit      ;end all labels (other than wheel gestures) with "exit" NOT "return" 

grocker:                                           ;can also have gxrocker and gxc
msgbox,,,rocker left then right. careful where you click,5
exit

glc:
msgbox,,,you gestured left and clicked,5
exit

;;;;;;;;;;;; 4th mouse button example ;;;;;;;;;;

gxl:
msgbox,,,you've gestures left with the 4th mouse button,5
exit

;;;;;;;; other examples ;;;;;;;;;;;;;;

gu:             ;; gesture up ;; maximize window under cursor. maximize last window if cursor over desktop
if (window1=window0)
   {
   if (window2<>"")
   winmaximize, ahk_id %window2%
   }
else
   winmaximize ahk_id %window1%
exit

gd:            ;minimize window under cursor
if (window1<>window0)    ;don't minimize the desktop
   winminimize, ahk_id %window1%
exit

gl:            ;browser back
winactivate ahk_id %window1%   
sendinput {Browser_Back}
exit   

gr:            ;browser forward
winactivate ahk_id %window1%   
sendinput {Browser_Forward}
exit

gdr:            ;restore last window.
winrestore ahk_id %window2%
exit

gldr:            ;close window under cursor (draw a C)
if (window1<>window0)
   winclose ahk_id %window1%
exit




Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2008, 12:27 pm 
Offline

Joined: October 5th, 2007, 2:21 am
Posts: 138
Location: Bundaberg (Bundy), Qld, Australia
i have grown fond of the rocking function i have bolted on to this script. I have extensively rewritten the script so rocking is now an integral part. All rocking actions (that i can think of) are supported. gestures and rocking can be combined. rocking actions can be repeated without releasing the first button rocked.All 5 mouse buttons are supported in rocking. All but the left mouse button can be used for gestures
Code:
coordmode,mouse,screen
winget,window0,id,ahk_class Progman   ;window0 is the desktop
hotkey,lbutton,off    ;normal left click function only affected during gesture

lbutton::   
rbutton::
mbutton::
xbutton1::
xbutton2::
thishotkey:=a_thishotkey="xbutton2" ? "f" : substr(a_thishotkey,1,1)
rocker:=(getkeystate("lbutton","p") ? "l" : "") . (getkeystate("rbutton","p") ? "r" : "") . (getkeystate("mbutton","p") ? "m" : "") . (getkeystate("xbutton1","p") ? "x" : "")  . (getkeystate("xbutton2","p") ? "f" : "")
rocker:=regexreplace(rocker,thishotkey,"")
rocker.=(if rocker ? "-" : "") . thishotkey
wheel=   
gestmode:=true
hotkey,lbutton,on      ;disables normal left click during gesture
if (window1<>window0)     
   window2:=window1               
mousegetpos xpos1,ypos1,window1       ;window1 is the window underneath the current gesture, window2 is from the previous gesture   
if rocker in r,m,x,f
   {
   mousetrack=   
   settimer,mousetrack,10
   }
else
   gosub rbutton up   ;rocker, no (further) tracking needed 
return

mousetrack:     
mousegetpos xpos2,ypos2 
track:=(abs(ypos1-ypos2)>=abs(xpos1-xpos2)) ? (ypos1>ypos2 ? "u" : "d") : (xpos1>xpos2 ? "l" : "r")  ;determines up down left right
if (abs(ypos1-ypos2)>4 or abs(xpos1-xpos2)>4) and (track<>SubStr(mousetrack, 0, 1))    ;track if x or y changing and direction changing
   mousetrack.=track
xpos1:=xpos2
ypos1:=ypos2
return

rbutton up::
mbutton up::
xbutton1 up::
xbutton2 up::
if not ((getkeystate("rbutton","p") ? "r" : "") . (getkeystate("mbutton","p") ? "m" : ""). (getkeystate("xbutton1","p") ? "x" : "") . (getkeystate("xbutton2","p") ? "f" : ""))
   hotkey,lbutton,off          ;if no button held down, restore normal left mouse button function
if not gestmode
   return
gestmode:=false
if  wheel
   return
callgesture:      ;entry label for wheel gestures
settimer,mousetrack,off
     
gesture:="g" . substr(rocker,1,1) . mousetrack . substr(rocker,2) . wheel               
if islabel(gesture)              ;checks if gesture is labelled
   gosub %gesture%
else
msgbox,,,%gesture%,2       ;delete after familiar with use
return

wheelup::
wheeldown::
wheel:=a_thishotkey="wheelup" ? "wheelup" : "wheeldown"
if gestmode
   gosub callgesture
else
   sendinput {%wheel%}
return

gr:          ;normal right click
click right,xpos1,ypos1
exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;; Examples ;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;; wheel examples ;;;;;;;;;;

gr-wheelup:      ;change volume with wheel -  hold right button down and use wheel
Send {Volume_Up}
return

gr-wheeldown:
Send {Volume_Down}
return    ;end wheel gestures with a "return" NOT "exit"    !!!!!!!!

;;;;;;;; rocker examples ;;;;;;;;;;

gr-l:
msgbox,,,keep right held down and click left will repeat action,5
exit      ;end all labels (other than wheel gestures) with "exit" NOT "return" 

gl-r:                                           
msgbox,,,rocker left then right. careful where you click,5
exit

grl-l:
msgbox,,,you gestured left and clicked,5
exit

;;;;;;;;;;;; 4th mouse button example ;;;;;;;;;;

gx-l:
msgbox,,,you've gestures left with the 4th mouse button,5
exit

gx-r:
msgbox,,,rocker 4th button then right,5
exit

gr-x:
msgbox,,,rocker right then 4th button,5
exit

;;;;;;;; other examples ;;;;;;;;;;;;;;

gru:             ;; gesture up ;; maximize window under cursor. maximize last window if cursor over desktop
if (window1=window0)
   {
   if (window2<>"")
   winmaximize, ahk_id %window2%
   }
else
   winmaximize ahk_id %window1%
exit

grd:            ;minimize window under cursor
if (window1<>window0)    ;don't minimize the desktop

   winminimize, ahk_id %window1%
exit

grl:            ;browser back
winactivate ahk_id %window1%   
sendinput {Browser_Back}
exit   

grr:            ;browser forward
winactivate ahk_id %window1%   
sendinput {Browser_Forward}
exit

grdr:            ;restore last window.
winrestore ahk_id %window2%
exit

grldr:            ;close window under cursor (draw a C)
if (window1<>window0)
   winclose ahk_id %window1%
exit


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 26th, 2008, 11:40 am 
Offline

Joined: October 5th, 2007, 2:21 am
Posts: 138
Location: Bundaberg (Bundy), Qld, Australia
changed the code a little to allow wheel gestures after rocking if mouse button remains down. what for? say grl: is play and grwheelup: is volume up. To play and turn up volume- hold down right button, click left button, use wheel and release right button. It's not an essential feature, but i think it's neat.
Code:
coordmode,mouse,screen
winget,window0,id,ahk_class Progman   ;window0 is the desktop
hotkey,lbutton,off    ;normal left click function only affected during gesture
lbutton::   
rbutton::
mbutton::
xbutton1::
xbutton2::
thishotkey:=a_thishotkey="xbutton2" ? "f" : substr(a_thishotkey,1,1)
rocker:=(getkeystate("lbutton","p") ? "l" : "") . mousebutton()
rocker:=regexreplace(rocker,thishotkey,"")
rocker.=(if rocker ? "-" : "") . thishotkey
wheel=   
gestmode:=true
hotkey,lbutton,on      ;disables normal left click during gesture
if (window1<>window0)     
   window2:=window1               
mousegetpos xpos1,ypos1,window1       ;window1 is the window underneath the current gesture, window2 is from the previous gesture   
if rocker in r,m,x,f
   {
   mousetrack=   
   settimer,mousetrack,10
   }
else
   gosub rbutton up   ;rocker, no (further) tracking needed 
return

mousetrack:     
mousegetpos xpos2,ypos2 
track:=(abs(ypos1-ypos2)>=abs(xpos1-xpos2)) ? (ypos1>ypos2 ? "u" : "d") : (xpos1>xpos2 ? "l" : "r")  ;determines up down left right
if (abs(ypos1-ypos2)>4 or abs(xpos1-xpos2)>4) and (track<>SubStr(mousetrack, 0, 1))    ;track if x or y changing and direction changing
   mousetrack.=track
xpos1:=xpos2
ypos1:=ypos2
return

rbutton up::
mbutton up::
xbutton1 up::
xbutton2 up::
if not mousebutton()
   hotkey,lbutton,off          ;if no button held down, restore normal left mouse button function
if not gestmode
   return
gestmode:=false
if  wheel
   return
callgesture:      ;entry label for wheel gestures
settimer,mousetrack,off   
gesture:="g" . substr(rocker,1,1) . mousetrack . substr(rocker,2) . wheel               
if islabel(gesture)              ;checks if gesture is labelled
   gosub %gesture%
else         ;delete after familiar with use
msgbox,,,%gesture%,1          ;delete after familiar with use
return

wheelup::
wheeldown::
wheel:=a_thishotkey="wheelup" ? "wheelup" : "wheeldown"
mousebutton:=mousebutton()
if mousebutton()
  {
   rocker:=mousebutton()
   gosub callgesture
   }
else
   sendinput {%wheel%}
return

mousebutton()
{
return (getkeystate("rbutton","p") ? "r" : "") . (getkeystate("mbutton","p") ? "m" : ""). (getkeystate("xbutton1","p") ? "x" : "") . (getkeystate("xbutton2","p") ? "f" : "")
}

gr:          ;normal right click
click right,xpos1,ypos1
exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;; Examples ;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;; wheel examples ;;;;;;;;;;

gr-wheelup:      ;change volume with wheel -  hold right button down and use wheel
Send {Volume_Up}
return

gr-wheeldown:
Send {Volume_Down}
return    ;end wheel gestures with a "return" NOT "exit"    !!!!!!!!

;;;;;;;; rocker examples ;;;;;;;;;;

gr-l:
msgbox,,,keep right held down and click left will repeat action,5
exit      ;end all labels (other than wheel gestures) with "exit" NOT "return" 

gl-r:                                           
msgbox,,,rocker left then right. careful where you click,5
exit

grl-l:
msgbox,,,you gestured left and clicked,5
exit

;;;;;;;;;;;; 4th mouse button example ;;;;;;;;;;

gx-l:
msgbox,,,you've gestures left with the 4th mouse button,5
exit

gx-r:
msgbox,,,rocker 4th button then right,5
exit

gr-x:
msgbox,,,rocker right then 4th button,5
exit

;;;;;;;; other examples ;;;;;;;;;;;;;;

gru:             ;; gesture up ;; maximize window under cursor. maximize last window if cursor over desktop
if (window1=window0)
   {
   if (window2<>"")
   winmaximize, ahk_id %window2%
   }
else
   winmaximize ahk_id %window1%
exit

grd:            ;minimize window under cursor
if (window1<>window0)    ;don't minimize the desktop
   winminimize, ahk_id %window1%
exit

grl:            ;browser back
winactivate ahk_id %window1%   
sendinput {Browser_Back}
exit   

grr:            ;browser forward
winactivate ahk_id %window1%   
sendinput {Browser_Forward}
exit

grdr:            ;restore last window.
winrestore ahk_id %window2%
exit

grldr:            ;close window under cursor (draw a C)
if (window1<>window0)
   winclose ahk_id %window1%
exit


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 1st, 2008, 5:21 am 
Offline

Joined: October 5th, 2007, 2:21 am
Posts: 138
Location: Bundaberg (Bundy), Qld, Australia
I bought a new mouse recently - logitech mx620. It has a search button on it which triggers browser_search. I am unable to getkeystate() for this button and it doesn't look easy http://www.autohotkey.com/forum/viewtopic.php?t=33739. I changed the script so it doesn't need this function
Code:
coordmode,mouse,screen
winget,window0,id,ahk_class Progman   ;window0 is the desktop
hotkey,lbutton,off    ;normal left click function only affected during gesture

xbutton2::          ;delete if not needed
thishotkey=f   ;because xbutton1 and xbutton2 share the same first letter   
goto buttondown   ;needs to be treated differently   
xbutton2 up::
thishotkey=f
goto buttonup

browser_search::       ;"find" key on logitech mx620 mouse, used here as an example
lbutton::
rbutton::
mbutton::         ;any buttons to be included listed here
xbutton1::   
thishotkey:=substr(a_thishotkey,1,1)
buttondown:
if not buttonsdown
   mousetrack=   ;clear previous tracking, but not if rocking
buttonsdown.=thishotkey   ;tracks which mouse buttons down
rocker:=(getkeystate("lbutton","p") ? "l" : "") . buttonsdown
rocker:=regexreplace(rocker,thishotkey,"")
rocker.=(if rocker ? "-" : "") . thishotkey
wheel=   
gestmode:=true
hotkey,lbutton,on      ;disables normal left click during gesture
if (window1<>window0)     
   window2:=window1   ;used in some gestures           
mousegetpos xpos1,ypos1,window1 ;window1 is the window underneath the current gesture
if strlen(rocker)=1
   settimer,mousetrack,10
else
   gosub rbutton up   ;rocker, no (further) tracking needed 
return

mousetrack:     
mousegetpos xpos2,ypos2 
track:=(abs(ypos1-ypos2)>=abs(xpos1-xpos2)) ? (ypos1>ypos2 ? "u" : "d") : (xpos1>xpos2 ? "l" : "r")  ;determines up down left right
if (abs(ypos1-ypos2)>4 or abs(xpos1-xpos2)>4) and (track<>SubStr(mousetrack, 0, 1)) ;track if x or y changing and direction changing
   mousetrack.=track
xpos1:=xpos2
ypos1:=ypos2
return

browser_search up::
rbutton up::
mbutton up::
xbutton1 up::
thishotkey:=substr(a_thishotkey,1,1)
buttonup:
buttonsdown:=regexreplace(buttonsdown,thishotkey,"")
if not buttonsdown
   hotkey,lbutton,off          ;if no button held down, restore normal left mouse button function
if not gestmode
   return
gestmode:=false
if  wheel
   return

callgesture:      ;entry label for wheel gestures
settimer,mousetrack,off   
thishotkey=
gesture:="g" . substr(rocker,1,1) . mousetrack . substr(rocker,2) . wheel
               
if islabel(gesture)              ;checks if gesture is labelled
   gosub %gesture%
else         ;delete after familiar with use
   msgbox,,,%gesture%,1          ;delete after familiar with use
return

wheelup::
wheeldown::
wheel:=a_thishotkey="wheelup" ? "wheelup" : "wheeldown"
if buttonsdown
  {
   rocker:=buttonsdown
   gosub callgesture
   }
else
   sendinput {%wheel%}
return

gr:          ;normal right click
click right,xpos1,ypos1
exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;; Examples ;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;; wheel examples ;;;;;;;;;;

gr-wheelup:      ;change volume with wheel -  hold right button down and use wheel
Send {Volume_Up}
return

gr-wheeldown:
Send {Volume_Down}
return    ;end wheel gestures with a "return" NOT "exit"    !!!!!!!!

;;;;;;;; rocker examples ;;;;;;;;;;

gr-l:
msgbox,,,keep right held down and click left will repeat action,5
exit      ;end all labels (other than wheel gestures) with "exit" NOT "return" 

gl-r:                                           
msgbox,,,rocker left then right. careful where you click,5
exit

grl-l:
msgbox,,,you gestured left and clicked,5
exit

;;;;;;;;;;;; 4th mouse button example ;;;;;;;;;;

gx-l:
msgbox,,,you've gestures left with the 4th mouse button,5
exit

gx-r:
msgbox,,,rocker 4th button then right,5
exit

gr-x:
msgbox,,,rocker right then 4th button,5
exit

;;;;;;;; other examples ;;;;;;;;;;;;;;

gru:             ;; gesture up ;; maximize window under cursor. maximize last window if cursor over desktop
if (window1=window0)
   {
   if (window2<>"")
   winmaximize, ahk_id %window2%
   }
else
   winmaximize ahk_id %window1%
exit

grd:            ;minimize window under cursor
if (window1<>window0)    ;don't minimize the desktop
   winminimize, ahk_id %window1%
exit

grl:            ;browser back
winactivate ahk_id %window1%   
sendinput {Browser_Back}
exit   

grr:            ;browser forward
winactivate ahk_id %window1%   
sendinput {Browser_Forward}
exit

grdr:            ;restore last window.
winrestore ahk_id %window2%
exit

grldr:            ;close window under cursor (draw a C)
if (window1<>window0)
   winclose ahk_id %window1%
exit


Report this post
Top
 Profile  
Reply with quote  
PostPosted: February 26th, 2009, 9:52 am 
Offline

Joined: October 5th, 2007, 2:21 am
Posts: 138
Location: Bundaberg (Bundy), Qld, Australia
at the prompting of stevezen, I have incorporated multiclicking; rocking with more than 2 mouse buttons; and rocking mixed with gestures. to achieve this, the gesture tracking had to be much more flexible, so large chunks have been re-written. would appreciate any feedback re use/difficulties/bugs etc.
Code:
multiclicktime=250    ; set to 0 if you don't want double/triple/multi clicking. otherwise set as fast as you can double-click  see http://www.autohotkey.com/forum/viewtopic.php?t=41411
rockinstant:=false       ; if true, rocking action fires on downclick (which is faster) but stops further tracking
sensitivity=4      ; adjust if required. if too low, a simple "down/up" (V) might be recorded as "down/right/up" (U)
demomode:=true      ; demonstration mode on/off


coordmode,mouse,screen
winget,windowD,id,ahk_class Progman   ;windowD is the desktop
gosub cleanup
return

#MaxThreadsPerHotkey 5    ; needed when multiclicking
browser_search::          ; "find" key on logitech mx620 mouse, used here as an example
lbutton::
rbutton::
mbutton::      ; list whatever mouse buttons you want tracked.
xbutton1::         ;  works best if all available listed
xbutton2::
critical
thishotkey:=a_thishotkey="xbutton2" ? "f" : substr(a_thishotkey,1,1)   ;buttons named from initial except xbutton2
buttonsdown.=thishotkey . (getkeystate("lbutton","p") ? "l" : "") 
gosub multiclick
gcalled=0      ; records if gesture has been called to avoid unintended double-click double calls
winget,windowA,id,A     ; windowA is the active window, useful for some gestures
hotkey,lbutton,on         ; disables normal left click during gesture
hotkey,lbutton up,off   ; prevents next line of code from calling on lbutton up
click up      ; prevents drag box appearing when left/right rocking and gesturing eg. gl/r(d)
hotkey,lbutton up,on
if (window1<>windowD)     
   window2:=window1         ; used in some gestures, window2 is the window the previous gesture acted on           
mousegetpos xpos1,ypos1,window1   ; window1 is the window underneath the current gesture
if mousetracking
   {
   gosub trackassign
   record.=(getkeystate("lbutton","p") and not record ? "l/" : "") . (record and thishotkey<>substr(record,0,1) ? "/" : "") . thishotkey
   settimer,mousetrack,10          ; "/" is the rocking symbol
   }                          
else
   {
   gosub parserecord   ; finds position of last "/" in record for next line of code
   record:=regexreplace(record,"/\w*","/" . thishotkey . multitrack,position,1,position)   ; allows rocking with different buttons
   }      ; why "\w*"? \w* may represent a single, double or multiclick, but not a parenthesis eg /r, /rr, /rrr, as in gl/rrr(ud)
if instr(record,thishotkey . "/") or not instr(buttonsdown,substr(record,1,1))
   {      
   gosub cleanup      ; avoids possible errors when different buttons hit nearly simultaneously
   return      
   }
if rock()="rocking" and rockinstant
   {            ; calls action before mouse button released (rockinstant is user defined)
   rockdown:=thishotkey        ; advantage - faster action
   goto rbutton up           ; disadvantage - gesture called so no more tracking      
   }            
rockdown=
return

browser_search up::      
rbutton up::
lbutton up::
mbutton up::
xbutton1 up::
xbutton2 up::
thishotkey:=a_thishotkey="xbutton2" ? "f" : substr(a_thishotkey,1,1)
if a_thishotkey contains up
   {
   buttonsdown:=regexreplace(buttonsdown,thishotkey,"")
   if (rockdown=thishotkey)
      return
   }
%thishotkey%count=0   ; in a double-click, there are 2 "button up" calls. we only want one action however      
multiclick:=false   
if not mousetrack   ; no need for delay to check for multiclick if button released after mouse tracking
   sleep % multiclicktime-a_tickcount+gtime1  ;delay to check for multiclick
thishotkey:=a_thishotkey="xbutton2" ? "f" : substr(a_thishotkey,1,1)
%thishotkey%count+=1         ; if multiple threads are waking from (above) sleep, only 1 is let through 
if (%thishotkey%count>1 or multiclick)   ; muticlick can only be true if mouse clicked during    
   return            ;  multiclicktime sleep
mousetracking:=false  ; no more tracking of the mouse once a mouse button has been released (unless multiclicking)
gosub trackassign
cleanup:=(rock()<>"rocking") ? true : false   ; this allows for repeat rocking   
callgesture:=not wheel and record and not (rock()="rockover" and gcalled) ? true : false
if cleanup         ; these lines allow for cleanup before the gesture action is called.
   gosub cleanup      ; (note that the gesture itself is not erased by the cleanup). this prevents a called
if callgesture         ;  action that takes a significant time stopping further tracking.
   gosub callgesture   
return            
#maxthreadsperhotkey 1      ; autohotkey default setting. set to your usual setting       

callgesture:
gcalled:=1
gesture.=(wheel ? "-" : "") . wheel
if demomode
   msgbox,,Demo,%gesture%, % (wheel ? .5 : strlen(gesture)/5+1)
else
   if islabel(gesture)   ; checks if gesture is labelled
         gosub %gesture%
return

cleanup:
hotkey,lbutton,off             ; restore normal left mouse button function
hotkey,lbutton up,off
settimer,mousetrack,off
record=
wheel=
mousetracking:=true
mousetrack=
return

mousetrack: 
critical off      ; don't want this getting in way of double-click checking
mousegetpos xpos2,ypos2
track:=(abs(ypos1-ypos2)>=abs(xpos1-xpos2)) ? (ypos1>ypos2 ? "u" : "d") : (xpos1>xpos2 ? "l" : "r")  ;determines up down left right
if (abs(ypos1-ypos2)>sensitivity or abs(xpos1-xpos2)>sensitivity) and (track<>SubStr(mousetrack, 0, 1)) ;track if x or y changing and direction changing
   mousetrack.=track
xpos1:=xpos2
ypos1:=ypos2
return

parserecord:      ; script allows for rocking more than once eg gr/l/x:
loop,parse,record        ; finds position of last "/"
   if a_loopfield=/
      position:=a_index
return

multiclick:
gtime2:=gtime1      ; why use time difference and not keywait? in the time between the 2 clicks, you don't want to miss any
gtime1:=a_tickcount   ;  mousetracking. the gesture gr(u) can be all over in less time than a double click takes
if (thishotkey=substr(record,0,1) and gtime1-gtime2<multiclicktime)
   {
   multiclick:=true
   multitrack.=thishotkey
   }
else
   {         ; avoids rocking errors when time between clicks is too short
   multiclick:=false
   multitrack=
   }
return

trackassign:
settimer,mousetrack,off
if mousetrack               ; letters enclosed in parentheses
   record.="(" . mousetrack . ")"      ;  are gesture directions 
mousetrack=               
gesture:="g" . record
return

esc::
exitapp
return

wheelup::
wheeldown::
wheel:=a_thishotkey
if record and mousetracking   
      {
   gosub trackassign   
      gosub callgesture
   }
if not record
   sendinput {%wheel%}
return

rock()
{
global
if record contains /      ; "/" is the rocking symbol
   {
   gosub parserecord   ; "position+1" is the first letter after the forward slash
   if (thishotkey=substr(record,position+1,1))
         return "rocking"
   else
      return "rockover"   ; in the button up section, if the button down and
               ;  the button up don't match, rocking is finished
   }
}

gr:          ;normal right click
click right,xpos1,ypos1
return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;; Examples ;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;; wheel examples ;;;;;;;;;;

gr-wheelup:      ;change volume with wheel -  hold right button down and use wheel
Send {Volume_Up}
return

gr-wheeldown:
Send {Volume_Down}
return 

;;;;;;;; multi click examples ;;;;;;;;;;

grr:
msgbox,,,double right click,5
return

grr(l):
msgbox,,,double right click then gesture left ,5
return

grr/ll:
msgbox,,,double right click then rock with double right ,5
return

gr/l/m:
msgbox,,,right click then rock with left and then middle ,5
return

;;;;;;;; rocker examples ;;;;;;;;;;

gr/l:
msgbox,,,keep right held down and click left will repeat action,5
return

gl/r:                                           
msgbox,,,rocker left then right. careful where you click,5
return

gr(l)/l:
msgbox,,,you gestured left and clicked,5
return

;;;;;;;;;;;; 4th mouse button example ;;;;;;;;;;

gx(l):
msgbox,,,you've gestures left with the 4th mouse button,5
return

gx/r:
msgbox,,,rocker 4th button then right,5
return

gr/x:
msgbox,,,rocker right then 4th button,5
return

;;;;;;;; other examples ;;;;;;;;;;;;;;

gr(u):             ;; gesture up ;; maximize window under cursor. maximize last window if cursor over desktop
if (window1=windowD)
   {
   if (window2<>"")
   winmaximize, ahk_id %window2%
   }
else
   winmaximize ahk_id %window1%
return

grd:            ;minimize window under cursor
if (window1<>windowD)    ;don't minimize the desktop
   winminimize, ahk_id %window1%
return

gr(l):            ;browser back
winactivate ahk_id %window1%   
sendinput {Browser_Back}
return

gr(r):            ;browser forward
winactivate ahk_id %window1%   
sendinput {Browser_Forward}
return

gr(dr):            ;restore last window.
winrestore ahk_id %window2%
return

gr(ldr):            ;close window under cursor (draw a C)
if (window1<>windowD)
   winclose ahk_id %window1%
return


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 108 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 8  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Klark92, Stigg and 18 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group