'Is there a way in AutoHotkey to know between a mouse click and touchscreen click
I have two monitors one of them is a touchscreen. do somebody now a simple code in autohotkey. that you received a value, between a mouse click and a touchscreen click
I use for example Photoshop application on my main monitor 1
And I have a virtual keyboard with my (favorite keystroke combos) on my touchscreen monitor 2
I want if I do with my left hand a touchscreen click on my virtual keyboard monitor 2.
That the mouse pointer stays on my main monitor 1
So that I can proceed with PhotoShop without interrupting to move my mouse pointer back to my main monitor 1.
This is the script so far a alternative idea.
::^d ;push ctrl + d to disable the mouse pointer movement
BlockInput MouseMove
return
::^e ;push ctrl + e to enable the mouse pointer movement
BlockInput MouseMoveOff
return
Solution 1:[1]
Distinguishing between input devices is not a trivial task with AHK. It can be done, but it's quite complicated.
If you'd be okay with interpreting every click on the touchscreen as a touch click then you could do something like this:
When the mouse moves on the normal screen
store it's position in a variable.
When a left click is executed on the touch screen do the click
move the mouse back to the last know position on the normal monitor.
You'll need:
Solution 2:[2]
I do not have a second monitor to fully test this code but I have tested on my main monitor which is a touchscreen. This code should do the trick :)
; Screen pixel split between monitors
; You should change this values according to the desired region of interest
screen_split_min := 0
screen_split_max := 200
; To get absolute monitor coordinates
CoordMode, Mouse, Screen
MouseGetPos, pre_mx, pre_my
While 1
{
MouseGetPos, tmp_mx, tmp_my
If tmp_mx > %screen_split_max%
{
pre_mx := tmp_mx
pre_my := tmp_my
}
}
~LButton::
MouseGetPos, mx, my
If mx <= %screen_split_max% and mx >= %screen_split_min%
{
MouseMove, pre_mx, pre_my, 0
}
return
HTH ;)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Forivin |
Solution 2 | RCaetano |