MouseGestureL
-
- Posts: 25
- Joined: 05 Jan 2022, 08:25
Re: MouseGestureL
@Pyonkichi
I see.
I use MGL in a much more involved way, for example I dont use MG_Edit unless I am debugging a issue. I work with MG_Config directly.
I include allot of libraries from there and use allot of Expression syntax.
I can suffer the awfull AHK V1 expression syntax but my biggest concern is, overtime that libararies I use with MGL will be left behind by their V2 counter parts. As well as upcoming AVK 2 features/commands not being available in V1. Which will limit what the user can do in a MGL Action scripts
I can appreciate, writting the entire MGL in V2 is no small task though. I will wait for when you think the timing would be right.
I just appreciate that you actively maintain this amazing tool. Thanks!
I see.
I use MGL in a much more involved way, for example I dont use MG_Edit unless I am debugging a issue. I work with MG_Config directly.
I include allot of libraries from there and use allot of Expression syntax.
I can suffer the awfull AHK V1 expression syntax but my biggest concern is, overtime that libararies I use with MGL will be left behind by their V2 counter parts. As well as upcoming AVK 2 features/commands not being available in V1. Which will limit what the user can do in a MGL Action scripts
I can appreciate, writting the entire MGL in V2 is no small task though. I will wait for when you think the timing would be right.
I just appreciate that you actively maintain this amazing tool. Thanks!
-
- Posts: 121
- Joined: 11 Mar 2023, 14:16
Re: MouseGestureL
@Pyonkichi
Pyonkichi If I may ask you, how to click with left mouse button while this gesure is active?
After I have activated the gesture MG_Gesture_F2_8LB_ and I am now holding Tab I would like to be able to click with the left button (Lbutton). As if no AHK/MouseGestureL was running.
The problem I think is that I have Lbutton declared as a sub trigger in MGL, LB.
The above works Tab is held down so long as F2 is also held down but because MGL is still active I cannot use mouse left click.
I have tried using MG_Abort() like the following, but even then I cannot click with left button while Tab/F2 is down:
I also tried this:
And also this:
I am essentially looking for a way to temporarily (for example after a MGL gesture has been fired) disable a MGL trigger/sub trigger or just a means to make MGL go back to being inactive while something like Keywait, F2 is engaged.
Thanks for any help.
Pyonkichi If I may ask you, how to click with left mouse button while this gesure is active?
After I have activated the gesture MG_Gesture_F2_8LB_ and I am now holding Tab I would like to be able to click with the left button (Lbutton). As if no AHK/MouseGestureL was running.
The problem I think is that I have Lbutton declared as a sub trigger in MGL, LB.
Code: Select all
MG_Gesture_F2_8LB_:
MG_StopTrail()
If (MG_IsMaya__()) {
SendInput, {tab down}
KeyWait, f2
SendInput, {tab up}
}
I have tried using MG_Abort() like the following, but even then I cannot click with left button while Tab/F2 is down:
Code: Select all
MG_Gesture_F2_8LB_:
MG_StopTrail()
If (MG_IsMaya__()) {
MG_Abort()
SendInput, {tab down}
KeyWait, f2
SendInput, {tab up}
}
Code: Select all
MG_Gesture_F2_8LB_:
MG_StopTrail()
If (MG_IsMaya__()) {
if (MG_Active) {
MG_Executed:=1
MG_Aborted:=1
}
SendInput, {tab down}
KeyWait, f2
SendInput, {tab up}
}
Code: Select all
MG_Gesture_F2_8LB_:
If (MG_IsMaya__()) {
MG_Abort()
GoSub, test
}
...
...
...
test:
SendInput, {tab down}
KeyWait, f2
SendInput, {tab up}
Thanks for any help.
Re: MouseGestureL
@Ralf_Reddings200244, Try this.
Code: Select all
SendInput, {tab down}
MG_Click("LB")
SendInput, {tab up}
-
- Posts: 121
- Joined: 11 Mar 2023, 14:16
Re: MouseGestureL
@PyonKichi
It works. So simple and eloquent!
Its amazing how many functions there exists in MGL that are unpublished, perhaps they are for internal use by MGL.
Thank you for this.
It works. So simple and eloquent!
Its amazing how many functions there exists in MGL that are unpublished, perhaps they are for internal use by MGL.
Thank you for this.
Question related to MGL
@Pyonkichi
Hello. I wonder if you could help me.
Is it possible to:
1. Use a SetTimer to launch a subroutine when a particular gesture is executed
2. Set off the same timer if the same gesture is triggered before the timer got to launch a subroutine
The global goal from which the question derives is to implement double press recognition.
E.g. When I use a combination MB+C (Middle button + "C" key pressed) a particular action A is executed, but when the "C" pressed twice (MB+C+C) within the interval of, say, 300 milliseconds I want another action B to be performed.
In order to calculate intervals between presses I write to the registry current time when the combination is first pressed. When it is pressed the second time I read from the registry the previous time, subtract it from the current time, which will give me the interval.
But the problem is that when the first time the combination is pressed I need either to
a) Execute action A if 300 milliseconds have passed and the "C" was not pressed second time
b) Execute action B if "C" was pressed the second time
For the a) I may use SetTimer to launch the subroutine for the single press when 300 milliseconds have passed. And if "C" is pressed twice I will disable the timer and process the combination as the double click
Basically, here is the code that I want to integrate into MGL:
Hello. I wonder if you could help me.
Is it possible to:
1. Use a SetTimer to launch a subroutine when a particular gesture is executed
2. Set off the same timer if the same gesture is triggered before the timer got to launch a subroutine
The global goal from which the question derives is to implement double press recognition.
E.g. When I use a combination MB+C (Middle button + "C" key pressed) a particular action A is executed, but when the "C" pressed twice (MB+C+C) within the interval of, say, 300 milliseconds I want another action B to be performed.
In order to calculate intervals between presses I write to the registry current time when the combination is first pressed. When it is pressed the second time I read from the registry the previous time, subtract it from the current time, which will give me the interval.
But the problem is that when the first time the combination is pressed I need either to
a) Execute action A if 300 milliseconds have passed and the "C" was not pressed second time
b) Execute action B if "C" was pressed the second time
For the a) I may use SetTimer to launch the subroutine for the single press when 300 milliseconds have passed. And if "C" is pressed twice I will disable the timer and process the combination as the double click
Basically, here is the code that I want to integrate into MGL:
Code: Select all
$h::
RegRead, hPressedBefore, HKEY_CURRENT_USER\Software\AutoHotkey, hPressedBefore
if (hPressedBefore = "true") { ;Double press
SetTimer, CheckDoublePress, Off ; Turn off the timer
RegWrite, REG_SZ, HKEY_CURRENT_USER, Software\AutoHotkey, hPressedBefore, false
RegRead, prevHTime, HKEY_CURRENT_USER\Software\AutoHotkey, h_interval
interval := A_TickCount - prevHTime
MsgBox, h pressed twice with interval %interval% milliseconds
} else {
;Single press or the first press in the combination
RegWrite, REG_SZ, HKEY_CURRENT_USER, Software\AutoHotkey, hPressedBefore, true
RegWrite, REG_SZ, HKEY_CURRENT_USER, Software\AutoHotkey, h_interval, %A_TickCount%
SetTimer, CheckDoublePress, -300 ; Set a timer which when 300 milliseconds pass will execute single press action
}
Return
CheckDoublePress:
RegWrite, REG_SZ, HKEY_CURRENT_USER, Software\AutoHotkey, hPressedBefore, false
MsgBox, Single press detected
Return
Re: MouseGestureL
@GGGarikkk,
Use the following. They are described in "Execute After Waiting" of the action template "Script Control" category.
Action script for MB_C__:
Action script for MB_C__C__:
Use the following. They are described in "Execute After Waiting" of the action template "Script Control" category.
Action script for MB_C__:
Code: Select all
;Execute After Waiting
if (MG_Timer(-200)) {
;Action to be performed immediately after the gesture has been entered.
}
else {
;Action to be performed when the waiting time has elapsed.
MsgBox, Single
}
Code: Select all
MsgBox, Double
-
- Posts: 121
- Joined: 11 Mar 2023, 14:16
Re: MouseGestureL
@Pyonkichi
If I may ask, how can I stop Mouse Gesture L from blocking Standard AHK Hotkeys that use the same trigger?
I am currently in the process of integrating MouseGestureL into my main script, so that function outputs, objects, variables, state/conditions etc etc are always shared. I especially want to be able to know the state of MGL.
I am not achieving this "integration" through fancy means, just through the #Include directive:
The above is a reproducible example. My script is more complicated but it actually works, MGL works just fine and all data is merged and shared.
The problem I am having is that MGL MG_Gesture_RB_8_: seems to consume Rbutton all for itself, ~Rbutton:: never fires, despite the prefix ~ being in place in the MG_Config file for RB, the only partial fix I have found is the following:
Of course that disables RB in MGL altogether.
I am essentially looking to achieve the following but in a single script file. This is how I have been using MGL in parallel with my main script,
C:\Users\User1\Documents\AutoHotkey\Master.ahk :
C:\Users\User1\Documents\AutoHotkey\MouseGestureL\MouseGestureL.ahk :
Both scripts work in parallel, One script does not "consume" the right click button all for itself thus both scripts are able to use the same button. I have been able to achieve this by adding ~ to the following lines in MG_Config.ahk:
`
I know MGL can do a single tap of right click with no mouse movement, even double taps. But I really need this functionality
Any help would be most welcome.
If I may ask, how can I stop Mouse Gesture L from blocking Standard AHK Hotkeys that use the same trigger?
I am currently in the process of integrating MouseGestureL into my main script, so that function outputs, objects, variables, state/conditions etc etc are always shared. I especially want to be able to know the state of MGL.
I am not achieving this "integration" through fancy means, just through the #Include directive:
Code: Select all
#singleinstance, force
#NoEnv
#MaxHotkeysPerInterval 500
#Persistent
#Include, C:\Users\User1\Documents\AutoHotkey\MouseGestureL\MouseGestureL.ahk
return
~Rbutton::
ToolTip, Rbutton is Pressed!
The problem I am having is that MGL MG_Gesture_RB_8_: seems to consume Rbutton all for itself, ~Rbutton:: never fires, despite the prefix ~ being in place in the MG_Config file for RB, the only partial fix I have found is the following:
Code: Select all
MG_Triggers=MD
;MG_Triggers=MR_MD
I am essentially looking to achieve the following but in a single script file. This is how I have been using MGL in parallel with my main script,
C:\Users\User1\Documents\AutoHotkey\Master.ahk :
Code: Select all
#SingleInstance, Force
#NoEnv
Return
~Rbutton::
ToolTip, Master: Rbutton is Pressed!
Return
Code: Select all
MG_Gesture_RB_8_:
If(!MG_IsExDefault())
Tooltip, MGL: Rbutton and Up!
return
Code: Select all
...
Hotkey, ~RButton, MG_RB_DownHotkey, On
Hotkey, ~RButton up, MG_RB_UpHotkey, On
...
Hotkey, ~RButton, MG_RB_DownHotkey, Off
Hotkey, ~RButton up, MG_RB_UpHotkey, Off
...
I know MGL can do a single tap of right click with no mouse movement, even double taps. But I really need this functionality
Any help would be most welcome.
-
- Posts: 7
- Joined: 07 Sep 2023, 13:03
Re: MouseGestureL
Thankyou for creating this script, it's really amazing!
A couple of questions and a suggestion.
Let's say I'm using two different versions of a program and they both share the same .exe filename, is there a way to create different mouse gestures for both versions of the apps separately? If so, how? I tried to do that and it didn't work out. If this functionality is not there, I hope maybe in a future version, we get this functionality included.
Secondly, I hope you will consider increasing the horizontal size of the GUI (MouseGestureL Configuration GUI/Window) that appears, sometimes I want to read the full name of a Gesture and that proves to be really troublesome because the Config Window is too small horizontally.
Thank you!
A couple of questions and a suggestion.
Let's say I'm using two different versions of a program and they both share the same .exe filename, is there a way to create different mouse gestures for both versions of the apps separately? If so, how? I tried to do that and it didn't work out. If this functionality is not there, I hope maybe in a future version, we get this functionality included.
Secondly, I hope you will consider increasing the horizontal size of the GUI (MouseGestureL Configuration GUI/Window) that appears, sometimes I want to read the full name of a Gesture and that proves to be really troublesome because the Config Window is too small horizontally.
Thank you!
Re: MouseGestureL
@JackRaider, You can define separate targets using different path names.
Target 1 (Custom Condition):
Target 2 (Custom Condition):
The size of the list can be customized by overriding the following variables in MG_User.ahk.
This method does not change the entire window size.
Target 1 (Custom Condition):
Code: Select all
MG_GetExeName(MG_HWND, true)="c:\aaa\foo.exe"
Code: Select all
MG_GetExeName(MG_HWND, true)="c:\bbb\foo.exe"
Code: Select all
ME_ListH := 486 ; Height of Lists
ME_TListW1 := 200 ; [P.1] Width of Target List
ME_GListW1 := 500 ; [P.1] Width of Gesture List
ME_GListH := 185 ; [P.1] Height of Gesture List
ME_GListR := 35 ; [P.1] Ratio of Gesture Column Width of Gesture List (%)
ME_TListW2 := 200 ; [P.2] Width of Target List
ME_RListR := 35 ; [P.2] Ratio of Type Column Width of Rule List (%)
ME_GListW2 := 150 ; [P.3] Width of Gesture List
ME_GListW3 := 250 ; [P.3] Width of Gesture Pattern List
ME_AListR := 50 ; [P.3] Ratio of Target Column Width of Action List (%)
ME_ListPad := 8 ; Padding
-
- Posts: 7
- Joined: 07 Sep 2023, 13:03
Re: MouseGestureL
Where am I supposed to put the MG_GetExeName code that you've given?Pyonkichi wrote: ↑28 Nov 2023, 01:24@JackRaider, You can define separate targets using different path names.
Target 1 (Custom Condition):Target 2 (Custom Condition):Code: Select all
MG_GetExeName(MG_HWND, true)="c:\aaa\foo.exe"
The size of the list can be customized by overriding the following variables in MG_User.ahk.Code: Select all
MG_GetExeName(MG_HWND, true)="c:\bbb\foo.exe"
This method does not change the entire window size.Code: Select all
ME_ListH := 486 ; Height of Lists ME_TListW1 := 200 ; [P.1] Width of Target List ME_GListW1 := 500 ; [P.1] Width of Gesture List ME_GListH := 185 ; [P.1] Height of Gesture List ME_GListR := 35 ; [P.1] Ratio of Gesture Column Width of Gesture List (%) ME_TListW2 := 200 ; [P.2] Width of Target List ME_RListR := 35 ; [P.2] Ratio of Type Column Width of Rule List (%) ME_GListW2 := 150 ; [P.3] Width of Gesture List ME_GListW3 := 250 ; [P.3] Width of Gesture Pattern List ME_AListR := 50 ; [P.3] Ratio of Target Column Width of Action List (%) ME_ListPad := 8 ; Padding
When I go into the target window section, I create a new target and in the judgement conditions section, I choose custom condition and in the value, I put the exact path of the program and I get hit up this error when I hit the ok button.
https://i.imgur.com/lNv2Fcg.png
Re: MouseGestureL
@Pyonkichi
I am trying to implement a single tap and a double tap of Rbutton.
I followed the solution presented on HERE:
My code:
It works but it has a glaring issue. The -2000 value will be demonstrate it. If I fire the RB__ gesture, "single" does get printed. But then right after that, if I also fire RB__ instead of starting a new MG_Timer(-2000) timer and then firing RB__ again, it will fire RB__RB__ and print "double".
I am expecting that when RB__ is fired, MG_Timer(-2000) to be reset, the next time I trigger RB__ then MG_Timer(-2000) should start counting from scratch.
Right now with the way it is, after performing and triggering the RB__ action, performing RB__ again triggers RB__RB__, which is not ideal.
How can I get MG_Timer(-2000) to be reset when RB__ is fired?
Thank you.
I am trying to implement a single tap and a double tap of Rbutton.
- RB__ print Single
- RB__RB__ print Double
I followed the solution presented on HERE:
My code:
Code: Select all
MG_Gesture_RB__:
if (!MG_IsExDefault()) {
;Execute After Waiting
if (!MG_Timer(-2000)) {
;Action to be run when the waiting time has elapsed.
tooltip Single
}
;This processing can be added from "Execute After Waiting" in the action template list.
}
return
MG_Gesture_RB__RB__:
if (!MG_IsExDefault()) {
tooltip double
}
return
I am expecting that when RB__ is fired, MG_Timer(-2000) to be reset, the next time I trigger RB__ then MG_Timer(-2000) should start counting from scratch.
Right now with the way it is, after performing and triggering the RB__ action, performing RB__ again triggers RB__RB__, which is not ideal.
How can I get MG_Timer(-2000) to be reset when RB__ is fired?
Thank you.
Re: MouseGestureL
@randy_798, The following code changes may be the solution.
Code: Select all
MG_Gesture_RB__:
if (!MG_IsExDefault()) {
;Execute After Waiting
if (!MG_Timer(-2000)) {
;Action to be run when the waiting time has elapsed.
MG_WaitNext:=0 ; <- Added
tooltip Single
}
;This processing can be added from "Execute After Waiting" in the action template list.
}
return
Re: MouseGestureL
@Pyonkichi
I can confirm that worked. It was very helpfull to know this fix. I thank you.
I can confirm that worked. It was very helpfull to know this fix. I thank you.
-
- Posts: 74
- Joined: 07 Mar 2023, 05:20
Re: MouseGestureL
Hello, I am trying to implement a single and a double tap of left click while holding right click, following your guide here, I created the following gestures
The issue is, If I press Left click once while holding down right click, once the timer expires and the action script for RB_LB__ fires, without releasing right click, left clicking again fires the action script for RB_LB__LB__, this happens if I wait 200 milliseconds or 10 seconds.
I recorded a small demonstration.
I am expecting that once the timer expires, left clicking (while holding right click) again to fire the action script for RB_LB__.
I tried placing MG_abort(), MG_Cancell() in various places and your solution here but none of them worked for me.
I am using MGL 1.40 and AHK 1.1.37.01. The following is a screenshot of how I have the three gestures set up.
I would appreciate any insight or solution.
- RB__
- RB_LB__
- RB_LB__LB__
The issue is, If I press Left click once while holding down right click, once the timer expires and the action script for RB_LB__ fires, without releasing right click, left clicking again fires the action script for RB_LB__LB__, this happens if I wait 200 milliseconds or 10 seconds.
I recorded a small demonstration.
I am expecting that once the timer expires, left clicking (while holding right click) again to fire the action script for RB_LB__.
I tried placing MG_abort(), MG_Cancell() in various places and your solution here but none of them worked for me.
I am using MGL 1.40 and AHK 1.1.37.01. The following is a screenshot of how I have the three gestures set up.
I would appreciate any insight or solution.
Re: MouseGestureL
@Gary-Atlan82, Try this.
RB__:
RB_LB__:
RB_LB__LB__:
RB__:
Code: Select all
if (MG_IsFirstAction()) {
ToolTip, RB__
}
RB_LB__:
Code: Select all
if (MG_Timer(-200)==0) {
MG_Gesture := MG_CurTriggers
MG_WaitNext := 0
ToolTip, Single
}
RB_LB__LB__:
Code: Select all
MG_Abort()
ToolTip, Double
-
- Posts: 74
- Joined: 07 Mar 2023, 05:20
Re: MouseGestureL
That did it, you make it look so easy. Cheers for this!
Re: MouseGestureL
Does this support detecting gestures from Windows Precision Touchpad protocol? I'm using an Apple magic trackpad on win10 via a driver that uses Windows Precision Touchpad protocol.
Looking for:
Looking for:
- Detect touchpad scroll to activate window under mouse.
- Use modifier key (eg: Shift) with three/four finger swipes.
Re: MouseGestureL
Hi. I'm trying to scroll to the top or bottom with the RB_U and RB_D gestures. But I can't seem to get the gesture to apply to the control under the mouse, only the window.
Here's what is working only halfway.
MouseGetPos and ControlSend are commented out. I thought they would be the way, but it is very inconsistent.
I would like RB_U and RB_D to behave just like the setting in Windows "Scroll the inactive windows when hovering over them". That setting allows the scrolling of controls just by putting the mouse in the right place and spinning the scroll wheel.
Thanks for any help!
Here's what is working only halfway.
Code: Select all
;Jump to Top
; MouseGetPos, xpos, ypos, WinID
; ControlSend, , {Ctrl Down}{Home}{Ctrl Up}, ahk_id %WinID%
WinActivate, ahk_id %WinID%
Sleep, 50
Send,{Ctrl Down}{Home}{Ctrl Up}
I would like RB_U and RB_D to behave just like the setting in Windows "Scroll the inactive windows when hovering over them". That setting allows the scrolling of controls just by putting the mouse in the right place and spinning the scroll wheel.
Thanks for any help!
Re: MouseGestureL
Hi, I've been using MouseGestureL for quite a while, but there are still two minor pain points:
- After launching on startup, the MouseGestureL icon sometimes fails to show up in the task bar. I'm not sure if it is due to ahk itself?
- How do I merge custom scripts into MouseGestureL? I have some v1 scripts like this:
-
- I tried creating an ahk file with content above into the plugin folder, but that just make MouseGestureL not working. Am I missing something?
- I want to merge them so that I can suspend all ahk process at the same time.
- After launching on startup, the MouseGestureL icon sometimes fails to show up in the task bar. I'm not sure if it is due to ahk itself?
- How do I merge custom scripts into MouseGestureL? I have some v1 scripts like this:
-
Code: Select all
<!d::send, #d
- I want to merge them so that I can suspend all ahk process at the same time.
Re: MouseGestureL
@GollyJer, Specify ahk_parent as the 1st param.
You can use MG_HWND as the target window handle.
You can use MG_HWND as the target window handle.
Code: Select all
ControlSend, ahk_parent, {Ctrl Down}{Home}{Ctrl Up}, ahk_id %MG_HWND%
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: submeg and 101 guests