现在,在鼠标点击和触摸屏点击之间有一种自动键的方式

时间:2016-08-06 20:48:02

标签: windows keyboard keyboard-shortcuts autohotkey touchscreen

我有两台显示器,其中一台是触摸屏。现在有人在autohotkey中使用一个简单的代码。您在鼠标单击触摸屏点击

之间获得

我在主监视器1上使用 Photoshop应用程序

我的触摸屏显示器2

我的(最喜欢的按键组合) 虚拟键盘

如果我的左手在我的虚拟键盘监视器2上点击触摸屏,我想要。

鼠标指针保留在我的主监视器1上

这样我可以在不中断的情况下继续使用PhotoShop将鼠标指针移回主监视器1.

到目前为止,这是另一个想法。

::^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 个答案:

答案 0 :(得分:1)

区分输入设备对于AHK来说并不是一项微不足道的任务。它可以做到,但它很复杂 如果您可以将触摸屏上的每次点击都解释为触摸点击,那么您可以执行以下操作:

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.

你需要:

SysGet
RegisterCallbackSetTimer + MouseGetPos
Hotkeys

答案 1 :(得分:1)

我没有第二台显示器来完全测试这段代码,但我已经在我的主显示器上进行了测试,这是一个触摸屏。这段代码可以解决问题:)

; 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;)