AutoHotkey Community

It is currently May 27th, 2012, 3:35 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 107 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8  Next
Author Message
 Post subject: Re: Lex' Mouse Gestures
PostPosted: April 19th, 2010, 7:26 pm 
Offline

Joined: February 7th, 2009, 11:28 pm
Posts: 384
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Lex' Mouse Gestures
PostPosted: April 20th, 2010, 8:46 am 
Offline

Joined: April 13th, 2010, 8:05 am
Posts: 29
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. :cry:

It is better to fix this, Lex.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 30th, 2010, 12:07 am 
Offline

Joined: February 7th, 2009, 11:28 pm
Posts: 384
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:

Image

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:

Image

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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 30th, 2010, 5:04 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 30th, 2010, 7:05 pm 
Offline

Joined: February 7th, 2009, 11:28 pm
Posts: 384
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2010, 3:00 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Why isn't it working?
PostPosted: May 18th, 2010, 8:14 am 
Offline

Joined: May 17th, 2010, 6:16 pm
Posts: 29
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thank you!
PostPosted: July 8th, 2010, 11:45 pm 
Offline

Joined: July 8th, 2010, 11:41 pm
Posts: 1
Thank you for posting the gestures code. Total brain cycle saver. Super useful.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: The best script ever
PostPosted: November 9th, 2010, 8:57 pm 
Offline

Joined: September 17th, 2010, 5:13 pm
Posts: 19
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 10th, 2010, 8:35 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Use something like this in your wheel hotkeys:
Code:
if m_WaitForRelease
    gosub GestureWheelUp ; or GestureWheelDown, as appropriate


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 10th, 2010, 12:06 pm 
Offline

Joined: September 17th, 2010, 5:13 pm
Posts: 19
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 :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 28th, 2010, 11:54 am 
I keep getting this error:

Gestures_User.ahk (131) : ==> Call to nonexistent function.
Specifically: G_MinimizeActiveWindow()


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 28th, 2010, 3:19 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Why are you running Gestures_User.ahk? Run Gestures.ahk from the main Download link.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2011, 9:22 pm 
Offline

Joined: October 28th, 2010, 2:23 pm
Posts: 27
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 January 23rd, 2011, 6:27 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2011, 6:35 pm 
Offline

Joined: October 28th, 2010, 2:23 pm
Posts: 27
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...
   


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: xXDarknessXx and 14 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