AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Lex' Mouse Gestures
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
gechu
Guest





PostPosted: Tue Feb 26, 2008 9:55 am    Post subject: Reply with quote

Dammit! Now I have to understand these scripts to be able to change them! Very Happy

/ Script kiddie Erik
Back to top
Jag02



Joined: 16 Apr 2008
Posts: 43

PostPosted: Sun May 04, 2008 6:07 am    Post subject: Windows explorer refresh gesture and diagonal gestures? Reply with quote

Is there a way that a gesture can be added that refreshs the page?

Also like in Avant Browser, can diagonal gestures be added?
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Sun May 04, 2008 6:38 am    Post subject: Re: Windows explorer refresh gesture and diagonal gestures? Reply with quote

Jag02 wrote:
Is there a way that a gesture can be added that refreshs the page?
Use something like this in Gestures.ini:
Code:
Gesture_R_D_L = {F5}
(Replace R_D_L with whatever.)
Quote:
Also like in Avant Browser, can diagonal gestures be added?
Add the following to Gestures.ini (there may already be ;m_ZoneCount = 4):
Code:
m_ZoneCount = 8
m_InitialZoneCount = 8
I find it is more effective with only 4 zones, since the script does not try to match to an existing gesture.
Back to top
View user's profile Send private message Visit poster's website
Jag02



Joined: 16 Apr 2008
Posts: 43

PostPosted: Mon May 05, 2008 9:39 am    Post subject: Reply with quote

This command in the Gestures.ini file does not work;

Gesture_L_U = !{Up}

Please help.
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Mon May 05, 2008 11:43 am    Post subject: Reply with quote

For what purpose does it not work? Are you using the default settings? If you have diagonals enabled, you have to be careful to draw "left, up" rather than "left, up-left, up."
Back to top
View user's profile Send private message Visit poster's website
automaticman



Joined: 27 Oct 2006
Posts: 648

PostPosted: Sat Aug 16, 2008 9:29 am    Post subject: Reply with quote

If we would call the current mouse gestures as "global gestures" would it be possible to define also "local gestures" which would layer on top of the global gestures (and disabling their functionality temporarily) dependent on active windows?

e.g. if I would have application A active, it would enable its own set of 8 mouse gestures, then when changing to application B, it would activate its other set of 8 mouse gestures? It should be possible with reloading of Gestures_Default.ahk maybe? Anyone using mouse gestures this way?
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Sat Aug 16, 2008 11:47 am    Post subject: Reply with quote

Look for the following line:
Code:
gesture := c_GesturePrefix ? c_GesturePrefix : "Gesture"
You may change the prefix based on whatever criteria, i.e. the active window, by adding to this section of code.
Back to top
View user's profile Send private message Visit poster's website
automaticman



Joined: 27 Oct 2006
Posts: 648

PostPosted: Sat Aug 16, 2008 1:53 pm    Post subject: Reply with quote

I have defined my gestures in "Gestures Default.ahk" which starts like

Code:
; **** DEFINITIONS ****

; prefix for gesture variables/labels
c_GesturePrefix = Gesture
... (global set of gestures)

So can I add those various "local gestures" into the same "Gestures Default.ahk" below by adding another such section with new definitions, like
Code:
; **** DEFINITIONS ****

; prefix for gesture variables/labels
c_GesturePrefix = ApplicationA
... (set of gestures for ApplicationA)

after that again
Code:
; **** DEFINITIONS ****

; prefix for gesture variables/labels
c_GesturePrefix = ApplicationB
... (set of gestures for ApplicationB)
?
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Sat Aug 16, 2008 10:43 pm    Post subject: Reply with quote

No. Only the last definition will be used. Find the line as in my previous post, and assign gesture a different value based on which window is active.
Back to top
View user's profile Send private message Visit poster's website
automaticman



Joined: 27 Oct 2006
Posts: 648

PostPosted: Sun Aug 17, 2008 10:54 am    Post subject: Reply with quote

Lexikos wrote:
No. Only the last definition will be used. Find the line as in my previous post, and assign gesture a different value based on which window is active.
Thanks Lexikos for your hints, I think I got it now... Before I was thinking it would be supported by your Gestures system to define multiple gesture definitions based on prefixes within one single gesture system (Gestures.ahk + Gestures Default.ahk + Gestures.ini) but now I switched my thinking that for multiple gestures definitions based on prefixed I should simply use multiple gesture systems. At least that seems to be the most simplest way? Did I understand everything correctly? If yes, I would want to know how many "gesture systems" others are using simultaniously, just one or also more?
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Sun Aug 17, 2008 12:06 pm    Post subject: Reply with quote

automaticman wrote:
Before I was thinking it would be supported by your Gestures system to define multiple gesture definitions based on prefixes within one single gesture system (Gestures.ahk + Gestures Default.ahk + Gestures.ini)
It is. Mad
  1. Define Prefix1_L, Prefix2_L, Prefix3_L, etc.
  2. Find the line mentioned in my previous posts, where the variable named 'gesture' is assigned.
  3. Assign 'gesture' whatever prefix value you wish to be active. If you wanted different gestures for the days of the week, you could use:
    Code:
    1_L = Left on Sunday.
    2_L = Left on Monday.
    3_L = Left on Tuesday.
    Code:
    gesture := A_WDay
The mentioned line may exist in multiple places.

By default, c_GesturePrefix is used. Simply changing its value would change what all of the gestures do. This method is not ideal for window-sensitive gestures, however, since you would need to detect when the active window changes or the mouse changes windows and set c_GesturePrefix accordingly.
Quote:
If yes, I would want to know how many "gesture systems" others are using simultaniously, just one or also more?
I am using one script, with only the generic "Gesture" prefix. You may notice that several gestures implemented as subroutines in Gestures Default.ahk are already sensitive to which window is active.
Back to top
View user's profile Send private message Visit poster's website
pajenn



Joined: 07 Feb 2009
Posts: 384

PostPosted: Mon May 25, 2009 8:41 am    Post subject: Reply with quote

I've decided to add mouse gestures to my arsenal of shortcuts, but I'm having a few issues with this script:

1. I need to press right-click longer on tray icons (maybe other things too) to get the menu (not a big deal, but if there's an easy fix...)

2. While I agree that trails may get old quickly, I'd like to see them for now. I tried running both Gestures and StrokeIt simultaneously. The latter with all commands disabled just to get the trails from it, but it didn't work. Anyway to enable StrokeIt to run simultaneously? (StrokeIt is another mouse gesture program that draws the symbol on screen when right mouse button is down.)

3. With what can I replace {Launch_App2} in the ini-file to have it launch Firefox instead of the Calculator?

Thanks in advance.
_________________
Hardware: 1.8 GHz laptop with 4 GB ram, Windows XP/SP3
Software: Prevx, Privatefirewall, KeyScrambler.
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Mon May 25, 2009 11:51 am    Post subject: Reply with quote

pajenn wrote:
1. I need to press right-click longer on tray icons to get the menu
I'm not sure what to suggest. Does it happen only with specific applications?
Quote:
Anyway to enable StrokeIt to run simultaneously?
If StrokeIt shows trails only while you hold the button, it probably won't work because this script blocks the physical button-press from other applications. If a timeout is reached or the button is physically released without moving the mouse, the script may then simulate a button-press. Without this behaviour, you could not use gestures over any window on which the gesture button usually has an effect.
Quote:
3. With what can I replace {Launch_App2} in the ini-file to have it launch Firefox instead of the Calculator?
Gestures.ini can only be used for mapping gestures to keystrokes/text. Try removing this line from Gestures.ini:
Code:
Gesture_D = {Launch_App2}
...and adding this subroutine to Gestures Default.ahk:
Code:
Gesture_D:
    ifWinExist, Mozilla Firefox ahk_class MozillaUIWindowClass
        WinActivate
    else  ; Replace with a URL of your choice, or the path to Firefox:
        Run http://www.google.com
return
Any gesture which is not defined by Gestures.ini can be scripted in Gestures Default.ahk.
Back to top
View user's profile Send private message Visit poster's website
pajenn



Joined: 07 Feb 2009
Posts: 384

PostPosted: Mon May 25, 2009 1:38 pm    Post subject: Reply with quote

Lexikos wrote:
pajenn wrote:
1. I need to press right-click longer on tray icons to get the menu
I'm not sure what to suggest. Does it happen only with specific applications?


Actually, it's that sometimes the system misses a right-click when gestures is running. Probably not app specific, may involve my previous rbutton hotkeys that are still running...

Firefox works well now.

Quote:
Without this behaviour, you could not use gestures over any window on which the gesture button usually has an effect.


I modified a draw-on-screen script by Metaxal, and stripped it down to where it just draws temporary trails when right mouse button is down (and erases them on up), F1 to exit:

edit: I updated the code after first posting (now it's closer to Shimanov version of screen draw) because the previous only worked when gestures was running too.

Code:
/*
- F1 quits program, Rbutton to draw
*/
#SingleInstance force
CoordMode, Mouse, Screen
Process, Exist
pid_this := ErrorLevel

hdc_screen := DllCall( "GetDC", "uint", 0 )

hdc_buffer := DllCall( "CreateCompatibleDC", "uint", hdc_screen )
hbm_buffer := DllCall( "CreateCompatibleBitmap", "uint", hdc_screen, "int", A_ScreenWidth, "int", A_ScreenHeight )
DllCall( "SelectObject", "uint", hdc_buffer, "uint", hbm_buffer )

DllCall( "BitBlt", "uint", hdc_buffer, "int", 0, "int", 0, "int", A_ScreenWidth, "int", A_ScreenHeight, "uint", hdc_screen, "int", 0, "int", 0, "uint", 0x00CC0020 )

Gui, +AlwaysOnTop -Caption
Gui, Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight%

WinGet, hw_canvas, ID, ahk_class AutoHotkeyGUI ahk_pid %pid_this%

hdc_canvas := DllCall( "GetDC", "uint", hw_canvas )

DllCall( "BitBlt", "uint", hdc_canvas, "int", 0, "int", 0, "int", A_ScreenWidth, "int", A_ScreenHeight, "uint", hdc_buffer, "int", 0, "int", 0, "uint", 0x00CC0020 )

color := 0xFF0000 ;blue

width := 6
MouseGetPos, x_last, y_last
mode_draw:= False

WM_MOUSEMOVE = 0x0200
OnMessage( WM_MOUSEMOVE, "HandleMessage" )
return

HandleMessage( p_w, p_l )
{
   global mode_draw, hdc_canvas, hdc_buffer, x_last, y_last, width, color

   x := p_l & 0xFFFF
   y := p_l >> 16

   if ( mode_draw )
      color = 0xFF0000
     
   else
      color := DllCall( "GetPixel", "uint", hdc_buffer, "int", x, "int", y )
   
   drawLine(x_last, y_last, x, y, color, width)
         
   x_last := x
   y_last := y
}
 
/*
Bresenham algorithm
From:
http://www.cs.unc.edu/~mcmillan/comp136/Lecture6/Lines.html
*/
drawLine(x0, y0, x1, y1, color_ini=0, width=1)
{
   global hdc_canvas, hdc_buffer
   
   color := color_ini
   
   dx := x1 - x0
   dy := y1 - y0
   stepx := 0
   stepy := 0
   if (dx < 0) {
      dx := -dx
      stepx := -1
   } else
      stepx := 1
   if (dy < 0) {
      dy := -dy
      stepy := -1
   } else
      stepy := 1
   
   Loop %width%
   {
      x := x0+A_Index-1
      y := y0
      DllCall( "SetPixel", "uint", hdc_canvas, "int", x, "int", y, "uint", color )
   }
   if (dx > dy) {
      fraction := dy - (dx >> 1)
      Loop
      {
         if (x0 = x1)
            break
         if (fraction >= 0) {
            y0 += stepy
            fraction -= dx
         }
         x0 += stepx
         fraction += dy
         Loop %width%
         {
            x := x0+A_Index-1
            y := y0
            DllCall( "SetPixel", "uint", hdc_canvas, "int", x, "int", y, "uint", color )
         }
      }
   } else {
      fraction = dx - (dy >> 1)
      Loop
      {
         if (y0 = y1)
            break
         if (fraction >= 0) {
            x0 += stepx
            fraction -= dy
         }
         y0 += stepy
         fraction += dx
         Loop %width%
         {
            x := x0+A_Index-1
            y := y0
            DllCall( "SetPixel", "uint", hdc_canvas, "int", x, "int", y, "uint", color )
         }
      }
   }

}


F1::ExitApp

RButton::
   Gui, Restore
   DllCall( "BitBlt", "uint", hdc_canvas, "int", 0, "int", 0, "int", A_ScreenWidth, "int", A_ScreenHeight, "uint", hdc_buffer, "int", 0, "int", 0, "uint", 0x00CC0020 )
   MouseGetPos, x_last, y_last
   mode_draw:= True
Return

RButton Up::
   mode_draw:= False
   Gui, Cancel
Return


Would it be feasible to integrate that script with Gestures? Each right-click click restores a transparent GUI on which the mouse path is drawn. The GUI is canceled upon release of the button.
_________________
Hardware: 1.8 GHz laptop with 4 GB ram, Windows XP/SP3
Software: Prevx, Privatefirewall, KeyScrambler.


Last edited by pajenn on Mon May 25, 2009 5:00 pm; edited 2 times in total
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Mon May 25, 2009 1:49 pm    Post subject: Reply with quote

GestureKey_Down in Gestures.ahk is called when the button is pressed, and GestureKey_Up when it is released. ~RButton and ~RButton Up may be merged with - or turned into regular labels and called from - those two subroutines.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Page 3 of 8

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group