AutoHotkey Community

It is currently May 27th, 2012, 10:32 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 108 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8
Author Message
 Post subject:
PostPosted: May 4th, 2011, 6:03 pm 
Offline

Joined: November 11th, 2008, 8:49 pm
Posts: 10
it's fine, thanks for the feedback as ever :)
sure I'm prolly just missing a trick when it comes to deskangel, I'll run some tests in the next few days and post back to see if it works.
for the mo I have another script running for hotkeys n' such with the ~lbutton & ~rbutton::alttab combo. if I reload this script after your gesture script it seems to do the trick, get's the job done as a work around.
can't say I'm really into these mouse gesture programs that seem to centre around drawing letters and so forth, simple lines alongside rocker motions work better for me.
I'd love to see this script eventually go into an exe with gui interface. I wonder if this'd affect the customization ultimately.
good show though.
Ste


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 8th, 2011, 11:26 am 
Offline

Joined: October 5th, 2007, 2:21 am
Posts: 138
Location: Bundaberg (Bundy), Qld, Australia
i looked at deskangel. the following code is enough to disrupt deskangel in the same way that the gesture program does.
Code:
wheelup::sendinput {wheelup}
wheeldown::sendinput {wheeldown}
the problem would seem to lie with deskangel itself???


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 9th, 2011, 12:07 pm 
Offline

Joined: October 5th, 2007, 2:21 am
Posts: 138
Location: Bundaberg (Bundy), Qld, Australia
changed front page. haven't incorporated all of above as some not suitable.
Code:
demomode:=true    ;demonstration mode on/off. change to false when ready to use
mintrack=20       ;minimum length of registered track sector in pixels 
wheelguard:=true  ;if true, wheel and middle button click can't both be used in the same gesture (recommended)

#MaxHotkeysPerInterval 500  ;prevents problems with rapid wheel movements
winget,windesktop,id,ahk_class Progman   ;desktop id, useful for some macros
gosub cleanup

*mbutton::   ;list any mouse buttons that can be uniquely named by first letter here eg. *mbutton is "m"
*lbutton::   ;the asterisk allows for the use of modifier keys   
*rbutton::     
*xbutton1::
*xbutton2::
stringreplace,lastdown,a_thishotkey,*,,all   ;hotkey name stripped of "*" and "button"
stringreplace,lastdown,lastdown,button,,all
if macrorunning or wheel
   return
if not buttonsdown
   {
   mousegetpos xpos1,ypos1,win1  ;win1 is the window underneath the current gesture
   gosub modifier
   settimer,tracking,1
   }
mouseclick:=buttonsdown.=(not buttonsdown and getkeystate("lbutton","p") ? "l" : "") . lastdown
winget,winactive,id,A          ;active window id, useful for some macros
sendinput {lbutton up}         ;prevents drag box appearing when left/right rocking and gesturing eg. m-lr(d):
hotkey,*lbutton,on             ;*lbutton only tracked when other mouse buttons start tracking
hotkey,*lbutton up,on
return

*mbutton up::
if wheel and wheelguard        ;middle button clicks ignored when using wheel (if wheelguard=true)
   return
*rbutton up::
*lbutton up::
*xbutton1 up::
*xbutton2 up::
stringreplace,lastup,a_thishotkey,*,,all
stringreplace,lastup,lastup,%a_space%up,,all
stringreplace,lastup,lastup,button,,all
stringreplace,buttonsdown,buttonsdown,%lastup%,,all
buttonsup:=true
settimer,tracking,off            ;no more gesture tracking once a mouse button has been released
if not wheel and (lastdown=lastup)
   gosub callmacro   
if not buttonsdown         
   gosub cleanup
return

*wheelup::
*wheeldown::
if (instr(buttonsdown,"m") and wheelguard) or macrorunning    ;prevents accidental use of mousewheel with middle button gestures   
   return
if not buttonsdown and getkeystate("lbutton","p")
   {
   mouseclick:=buttonsdown:="l"
   hotkey,*lbutton up,on
   }
if (buttonsdown and not buttonsup) or alt or shift or ctrl
   {
   stringtrimleft,wheel,a_thishotkey,1     
   settimer,tracking,off   ;no more tracking once wheel used
   goto callmacro
   }
stringtrimleft,thishotkey,a_thishotkey,1
if not buttonsdown
   sendinput {%thishotkey%}
return
     
callmacro:
macrorunning:=true
macro:="m-" . alt . shift . ctrl . mouseclick . (tracking ? "(" . tracking . ")" : "") . (wheel ? "-" . wheel : "")
if (demomode and macro<>"m-r" and macro<>"m-m")
   msgbox,,DEMO MODE,%macro% ,1   
else
   if islabel(macro)         
         gosub %macro%
macrorunning:=false
return

cleanup:
if (win1<>windesktop)     
   win2:=win1     ; used in some gestures, win2 is the window the previous macro acted on
hotkey,*lbutton,off             ; restore normal left mouse button function
hotkey,*lbutton up,off
wheel:="",tracking="",buttonsup="",buttonsdown="",mouseclick="",track2=""
return

tracking:
mousegetpos xpos2,ypos2
angle:=abs((xpos1-xpos2)/(ypos1-ypos2+0.001))      ;+0.001 avoids divide by zero error
if (angle>0.7 and angle<1.428) or (abs(ypos1-ypos2)<5 and abs(xpos1-xpos2)<5)   ;ignores angles within 10 degrees of 45 degree diagonal
   return                                                                       ;ignores movement that is too slow
track1:=(abs(ypos1-ypos2)>abs(xpos1-xpos2)) ? (ypos1>ypos2 ? "u" : "d") : (xpos1>xpos2 ? "l" : "r")  ;determines up down left right
if (track1<>track2)            ;remembers mouse position when track direction changes
   xpos0:=xpos2,ypos0:=ypos2
if (track1<>SubStr(tracking, 0, 1)) and (track1=track2) and (abs(xpos0-xpos2)>=mintrack or abs(ypos0-ypos2)>=mintrack)
   tracking.=track1        ;track if x or y changing sufficient to register. track needs confirmation (2 tracks same direction)
xpos1:=xpos2,ypos1:=ypos2,track2:=track1
return

modifier:
alt:=getkeystate("alt","p") ? "!" : ""        ;list modifiers here and in cleanup
shift:=getkeystate("shift","p") ? "+" : ""
ctrl:=getkeystate("ctrl","p") ? "^" : ""
return

esc::exitapp

m-r:                     ;normal right click
sendinput {rbutton}
return

m-m:                 ;normal middle click (optional)         
sendinput {mbutton}
return

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

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

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

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

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

m-r-wheeldown:
Send {Volume_Down}
return

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

m-rl:
msgbox,,,if you keep right held down, clicking left will repeat action,5
return

m-lr:                                           
msgbox,,,rocker left then right.,5  ;left click will also fire so some macros not suitable
return                ;can be used for browser forward if you don't click over hypertext

m-rl(l):
m-lr(l):
msgbox,,,you combined rocking and gesturing,5
return

;;;;;;;;;;;; gesture examples ;;;;;;;;;;

m-r(u):             ;; gesture up ;; maximize window under cursor. maximize last window if cursor over desktop
if (win1=windesktop)
   {
   if (win2<>"")
   winmaximize, ahk_id %win2%
   }
else
   winmaximize ahk_id %win1%
return

m-r(d):            ;minimize window under cursor
if (win1<>windesktop)    ;don't minimize the desktop
   winminimize, ahk_id %win1%
return

m-r(l):            ;browser back
winactivate ahk_id %win1%   
sendinput {Browser_Back}
return

m-r(r):            ;browser forward
winactivate ahk_id %win1%   
sendinput {Browser_Forward}
return

m-r(dr):            ;restore last window.
winrestore ahk_id %win2%
return

m-r(ldr):            ;close window under cursor (draw a C)
if (win1<>windesktop)
   winclose ahk_id %win1%
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 ... 4, 5, 6, 7, 8

All times are UTC [ DST ]


Who is online

Users browsing this forum: specter333 and 11 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