 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
pajenn
Joined: 07 Feb 2009 Posts: 384
|
Posted: Mon Apr 19, 2010 6:26 pm Post subject: Re: Lex' Mouse Gestures |
|
|
| Lexikos wrote: | That's the intended behaviour. I don't need to see when the script is enabled, only when it is not. Since I use AHKControl, the tray menu is always accessible.
Please note that Gestures_User.ahk is intended to contain your customizations, and should not be considered part of the main script. This is why it is not included in the ZIP. |
I know, but people will still add it into the Gestures folder as a starting point for their own customizations, and then the icon disappears and they don't know what's going on or how to exit the script... At least that's what happened to me.
| Quote: | This doesn't happen on my Windows 7 system. I noticed and fixed it on XP, but since I wasn't at home the script wasn't updated. I believe the fix was to find the following (which already exists in the script):
| Code: | ; Clear the canvas before hiding it. Otherwise, the next time the window is shown,
; the previous gesture can be shown for a brief moment before the window updates.
VarSetCapacity(rect, 16, 0)
, NumPut(CYVirtualScreen + YVirtualScreen, NumPut(CXVirtualScreen + XVirtualScreen
, NumPut(YVirtualScreen, NumPut(XVirtualScreen, rect, 0))))
, DllCall("FillRect", "uint", hdc_canvas, "int", &rect, "uint", brush)
| ...and move it to G_ExitGesture:
| Code: | if hdc_canvas ; Hide the mouse-trail canvas.
{
<insert code here>
Gui, Hide
}
| I think I had originally written it this way, then moved it while attempting to resolve a similar, but intermittent issue. |
Thanks. Now it works perfectly on my XP. The additional markers between gesture sections are great. _________________ Hardware: 1.8 GHz laptop with 4 GB ram, Windows XP/SP3
Software: Prevx, Privatefirewall, KeyScrambler. |
|
| Back to top |
|
 |
jabobian
Joined: 13 Apr 2010 Posts: 29
|
Posted: Tue Apr 20, 2010 7:46 am Post subject: Re: Lex' Mouse Gestures |
|
|
| Quote: | | Thanks. Now it works perfectly on my XP. The additional markers between gesture sections are great. |
Yes, I have also meet the same problem as you on Win XP. And I also moved the "Clear the canvas before hiding it" part to the place as you did.
I had briefly tried Lex's gestures a few days ago, and thought this issue is a bug. So I developed myself another gesture script. Indeed, Lex's one is already near perfect. My work is not necessary at all.
It is better to fix this, Lex. |
|
| Back to top |
|
 |
pajenn
Joined: 07 Feb 2009 Posts: 384
|
Posted: Thu Apr 29, 2010 11:07 pm Post subject: |
|
|
Disclaimer: I love the script and the observations below are not meant as complaints.
Below is a picture of a very minor bug I sometimes observe in gesture trails. It doesn't impact the script's functionality, but I thought I should mention it in case this doesn't happen on Windows 7 or more powerful computers in general. That is, the markers between gesture strokes are sometimes slightly off:
Also, I think the default "m_Interval" and "m_LowThreshold" values were too low for my computer. Before I doubled them the script would sometimes record slow but more or less straight lines as multiple mini strokes. Example:
Here's the values I now use:
| Code: | m_Interval = 40 ; How long to sleep between each iteration of the gesture-recognition loop. (default = 20)
m_LowThreshold = 25 ; Minimum distance to register as a gesture "stroke." (default = 10) |
I mention this as a suggestion for anyone else who tried the script and experienced the same thing (but maybe it's just me). _________________ Hardware: 1.8 GHz laptop with 4 GB ram, Windows XP/SP3
Software: Prevx, Privatefirewall, KeyScrambler. |
|
| Back to top |
|
 |
lexios Guest
|
Posted: Fri Apr 30, 2010 4:04 am Post subject: |
|
|
| pajenn wrote: | | Below is a picture of a very minor bug I sometimes observe in gesture trails. | When did you last download the script? I have seen that happen, but thought I fixed it a while ago.
| Quote: | | Also, I think the default "m_Interval" and "m_LowThreshold" values were too low for my computer. Before I doubled them the script would sometimes record slow but more or less straight lines as multiple mini strokes. | Of course when you drag the mouse along the fine line between "down" and "right", recognition won't be ideal. With the default settings, diagonals aren't meaningful/supported - only up, down, left and right.
I suppose reducing m_Tolerance below 100 (percent) would prevent this sort of thing - i.e. dragging the mouse at a 45 degree angle would cancel gesture recognition. |
|
| Back to top |
|
 |
pajenn
Joined: 07 Feb 2009 Posts: 384
|
Posted: Fri Apr 30, 2010 6:05 pm Post subject: |
|
|
| lexios wrote: | | When did you last download the script? I have seen that happen, but thought I fixed it a while ago. |
Ok, I didn't have the latest version, but I just updated and the markers are still off sometimes.
| Quote: | | Of course when you drag the mouse along the fine line between "down" and "right", recognition won't be ideal. With the default settings, diagonals aren't meaningful/supported - only up, down, left and right |
With the newer version (new default m_LowThreshold), this second thing isn't happening anymore. _________________ Hardware: 1.8 GHz laptop with 4 GB ram, Windows XP/SP3
Software: Prevx, Privatefirewall, KeyScrambler. |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Sat May 01, 2010 2:00 am Post subject: |
|
|
| pajenn wrote: | | With the newer version (new default m_LowThreshold), this second thing isn't happening anymore. | Sure it does, you just have to drag the mouse further. It must've been set to 25 for quite some time, as I don't recall changing it. (Mind you, I haven't been keeping track of changes to this script.)
| Quote: | | Ok, I didn't have the latest version, but I just updated and the markers are still off sometimes. | Since it puts a marker at the end of the last "stroke" before the mouse changed directions, it should be perfectly accurate as an indicator of how the script recognized the gesture. If it's off, that may be a sign that gesture recognition needs to be improved. I think in an earlier version it used the current position, which was probably at least m_LowThreshold pixels further along the trail. |
|
| Back to top |
|
 |
quinxy
Joined: 17 May 2010 Posts: 29
|
Posted: Tue May 18, 2010 7:14 am Post subject: Why isn't it working? |
|
|
Anyone know why this isn't working for me? All I'm trying to do is run Lex's script. And it doesn't seem to recognize any gesture, or draw the trails. I downloaded the script, got the Gestures_user.ahk, put it in the same folder. I run the script and it makes the noise like it works, it does the enable/disable with the tray icon. But every gesture I try does nothing, nor are there any trails when I have the Gestures_user.ahk there so there should be trails. Something weird about Windows 7 or something obvious I'm not understanding.
Quincy |
|
| Back to top |
|
 |
slackticus
Joined: 08 Jul 2010 Posts: 1
|
Posted: Thu Jul 08, 2010 10:45 pm Post subject: Thank you! |
|
|
| Thank you for posting the gestures code. Total brain cycle saver. Super useful. |
|
| Back to top |
|
 |
em02044
Joined: 17 Sep 2010 Posts: 19
|
Posted: Tue Nov 09, 2010 7:57 pm Post subject: The best script ever |
|
|
First of all I have to thank you for this wonderful script
It has been very useful either at home or at work but now I have a question
I want to define a variable to 1 when I scroll the mouse wheel up or change it to 2 when I scroll the mouse wheel down
I've writen this small code in gestures.ahk
| Code: | ~wheelup::
vartest = 1
return
~wheeldown::
vartest = 2
return
|
The mouse wheel works normal and the vartest is defined as I want, the problem is that Gesture_WheelDown and Gesture_WheelUp do not work anymore.
I would like to know how can I define %vartest% without disabling Gesture_WheelDown and Gesture_WheelUp |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Wed Nov 10, 2010 7:35 am Post subject: |
|
|
Use something like this in your wheel hotkeys:
| Code: | if m_WaitForRelease
gosub GestureWheelUp ; or GestureWheelDown, as appropriate
|
|
|
| Back to top |
|
 |
em02044
Joined: 17 Sep 2010 Posts: 19
|
Posted: Wed Nov 10, 2010 11:06 am Post subject: |
|
|
| Lexikos wrote: | Use something like this in your wheel hotkeys:
| Code: | if m_WaitForRelease
gosub GestureWheelUp ; or GestureWheelDown, as appropriate
|
|
Thanks My problem was solved  |
|
| Back to top |
|
 |
TH1 Guest
|
Posted: Tue Dec 28, 2010 10:54 am Post subject: |
|
|
I keep getting this error:
Gestures_User.ahk (131) : ==> Call to nonexistent function.
Specifically: G_MinimizeActiveWindow() |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Tue Dec 28, 2010 2:19 pm Post subject: |
|
|
| Why are you running Gestures_User.ahk? Run Gestures.ahk from the main Download link. |
|
| Back to top |
|
 |
tjcork
Joined: 28 Oct 2010 Posts: 26
|
Posted: Sat Jan 08, 2011 8:22 pm Post subject: |
|
|
| Lexikos wrote: | | Bebert wrote: | | how to re-assign Gesture_R and Gesture_L to MasterVolume up/down until gesture button is released? | I suppose you want to hold the button and drag left or right to adjust volume. It could work as follows:
- Once the mouse is dragged left or right more than %m_LowThreshold% pixels, exit gesture recognition and enter "volume-adjust" mode.
- For consistency, immediately adjust the volume based on how far the mouse has moved from the origin (m_StartX, m_StartY).
- While in "volume-adjust" mode, ignore vertical movement (possibly lock the cursor on the Y-axis) and adjust the volume based on how far and in which direction the mouse moves. Volume-per-pixel would be a user-defined variable.
- When the button is released, exit "volume-adjust" mode.
I'm not likely to implement features like this anytime soon as the current design doesn't really allow it, but I'll keep it in mind for a future version. I planned to implement something like this to allow, for instance, a "window-move" gesture as a substitute for grabbing the window's title bar. (Currently one can use L-R-L-R or R-L-R-L, but it moves the mouse and requires a left click or Enter keypress to stop moving.) |
I've come up with a fairly simple way to achieve this and it works perfectly for me:
find the part of gestures.ahk:
| 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 edit the last part of it and its corresponding else to read as so (Red indicates changes to make):
| Code: | ; Record this stroke.
m_Gesture .= m_Delimiter . zone
m_GestureLength += 1
GestureNumber%m_GestureLength% := zone
}
else
{
; Extend length of this stroke.
totalDistance += distance
If ((m_GestureLength > 2) and (GestureNumber1 = "U") and ((GestureNumber2 = "L") or (GestureNumber2 = "R"))) ;change for gesture preference
{
VolumeGain := distance*0.1 ;Increase for larger change
Send % "{Volume_" . (zone = "R" ? "Up " : zone = "L" ? "Down " : " ") . VolumeGain . "}"
}
} |
The advantages of this way of doing it are that any vertical gesture is ignored and volume up and volume down can be toggled through as many times as you want within the same gesture.
despite there being an error sound upon release I find it to be useful as an indicator to tell you what level the final volume is set at. If you didn't want this you could simply make a blank gesture in gesture_user.ahk
the smallest volume change is limited by whatever the smallest gesture threshold is set at.. so a 2.5 increment by default.
Last edited by tjcork on Sun Jan 23, 2011 5:27 pm; edited 1 time in total |
|
| Back to top |
|
 |
tjcork
Joined: 28 Oct 2010 Posts: 26
|
Posted: Mon Jan 10, 2011 5:35 pm Post subject: |
|
|
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...
|
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|