I have also come up with another gesture which works similar to my previous post about volume however this gesture is for dynamically changing through windows via the alt tab menu during the gesture (right - up and then left or right depending on the direction through the menu you want to go. This is slightly less simple as the volume changing gesture as it requires alt up to be sent upon release of the gesture key. I have experienced occasional leaks where alt is not released upon exit - I would appreciate it if anyone could point out where/why this is sometimes happening. At the moment it appears to be working fine...
Ok I've worked out why it is sometimes not working.. it is because I have an alt hotkey in another script and sending alt triggers this and messes up the variables
First find the bit of script which reads:
Code:
if (lastZone != zone)
{
if (hdc_canvas && m_NodePenWidth && lastZone != zone && lastZone != -1)
DllCall( "Ellipse", "uint", hdc_canvas
, "int", lastZoneEndX-m_NodePenWidth
, "int", lastZoneEndY-m_NodePenWidth
, "int", lastZoneEndX+m_NodePenWidth
, "int", lastZoneEndY+m_NodePenWidth )
; Record length of this stroke.
totalDistance := distance
; Remember zone index for subsequent iterations.
lastZone := zone
; Record this stroke.
m_Gesture .= m_Delimiter . zone
m_GestureLength += 1
and change the end of it and the else that follows to read as below (red=changes):
Code:
; Record this stroke.
m_Gesture .= m_Delimiter . zone
m_GestureLength += 1
GestureNumber%m_GestureLength% := zone
AltCount++ ;so sensitivity can be adjusted
;increase the number in the mod function below to decrease sensitivity
If ((mod(AltCount, 3) = 0) and (m_GestureLength > 2) and (GestureNumber1 = "R") and (GestureNumber2 = "U"))
;every 3rd count after 2 gestures have been made (R and U)
{
If !ClearAlt ; if this is the first time the gesture has been made
{
Send {alt Down}
ClearAlt := 1 ;remember that alt is down
m_DisableDing := 1 ;temporarily disable the tone
}
If !Getkeystate(alt) ;if alt is down
Send % (zone = "R" ? "{Tab}" : zone = "L" ? "+{Tab}" : "")
}
}
else
{
; Extend length of this stroke.
totalDistance += distance
AltCount +=1 ;it is necessary to have the operation on both sides of the else to make the change smooth and consistant
If ((mod(AltCount, 3) = 0) and (m_GestureLength > 2) and (GestureNumber1 = "R") and (GestureNumber2 = "U"))
{
If !ClearAlt
{
Send {alt Down}
ClearAlt := 1, m_DisableDing := 1
}
If !Getkeystate(alt)
Send % (zone = "R" ? "{Tab}" : zone = "L" ? "+{Tab}" : "")
}
next the alt key needs to be sent up on release of the gesture key or cancellation this requires putting the following code:
Code:
If ClearAlt ;if alt is down
{
Send {alt Up}
ClearAlt = 0 ;reset for next time
}
Else
m_DisableDing = 0 ;ding is re-enabled for other gestures
In the part of the script below
Code:
CancelGesture:
Hotkey, *Escape, CancelGesture, Off
<Insert here>
m_ExitLoop := true
return
GestureKey_Up:
Hotkey, %A_ThisHotkey%, Off
MouseGetPos, m_EndX, m_EndY
<Insert here>
G_ExitGesture()
if m_PassKeyUp...