与这里的问题类似,我在下面找到了一个 AutohotKey 脚本(解决方案),以便通过单击鼠标中键复制突出显示的文本并粘贴它。不过剧本还是有欠缺的。此脚本仅在我突出显示文本时有效。我想知道如何修改它,以便在我双击文本中的一个单词并突出显示时它也可以工作。
cos_mousedrag_treshold := 20 ; pixels
#IfWinNotActive ahk_class ConsoleWindowClass
~lButton::
MouseGetPos, cos_mousedrag_x, cos_mousedrag_y
keywait lbutton
mousegetpos, cos_mousedrag_x2, cos_mousedrag_y2
if (abs(cos_mousedrag_x2 - cos_mousedrag_x) > cos_mousedrag_treshold
or abs(cos_mousedrag_y2 - cos_mousedrag_y) > cos_mousedrag_treshold)
{
wingetclass cos_class, A
if (cos_class == "Emacs")
sendinput !w
else
sendinput ^c
}
return
~mbutton::
WinGetClass cos_class, A
if (cos_class == "Emacs")
SendInput ^y
else
SendInput ^v
return
#IfWinNotActive
;; clipx
^mbutton::
sendinput ^+{insert}
return
Run Code Online (Sandbox Code Playgroud)
您可以像这样修改代码:
~lButton::
if (A_PriorHotKey = "~lButton" && A_TimeSincePriorHotkey < "500") {
if (cos_class == "Emacs")
sendinput !w
else
sendinput ^c
}
// rest of code //
Run Code Online (Sandbox Code Playgroud)
如果您双击更快/更慢,则以毫秒为单位将 500 调整为更高或更低的值。
归档时间: |
|
查看次数: |
2518 次 |
最近记录: |