skip to Main Content

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

keystarter and autohotkey with two monitors

2

Answers


  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:

    SysGet
    RegisterCallback or SetTimer+MouseGetPos
    Hotkeys

    Login or Signup to reply.
  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 😉

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search