-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请问怎么提取其中的鼠标模拟功能 #88
Comments
Title: How to extract the mouse simulation function? I want to set it to press the d key and then press hjkl to simulate the up, down, left and right movements of the mouse. How can I change it myself by looking at the source code? |
如果是要把鼠標模擬拆出来的話,
if (!CapsLockX) {
MsgBox, % "本模块只为 CapsLockX 工作"
ExitApp
}
; 按d键进入鼠标模式
#if
*d::
global HJKLMouseMode := 1
return
*d Up::
global HJKLMouseMode := 0
return
; 在 hjkl鼠標模式下,按下hjkl鍵,模擬鼠標移動
#if HJKLMouseMode
; 鼠标运动处理
*h:: 鼠标模拟.左按("h")
*l:: 鼠标模拟.右按("l")
*k:: 鼠标模拟.上按("k")
*j:: 鼠标模拟.下按("j")
@1205129045x 有思路了嗎 |
If you want to remove the mouse simulation,
if (!CapsLockX) {
MsgBox, % "This module only works with CapsLockX"
ExitApp
}
; Press the d key to enter mouse mode
#if
*d::
global HJKLMouseMode := 1
return
*d Up::
global HJKLMouseMode := 0
return
; In hjkl mouse mode, press the hjkl key to simulate mouse movement
#if HJKLMouseMode
;Mouse motion processing
*h:: Mouse simulation. Left click ("h")
*l:: Mouse simulation. Right click ("l")
*k:: Mouse simulation. Press up ("k")
*j:: Mouse simulation. Press down ("j")
@1205129045x Do you have any ideas? |
太强了 你是作者吧 有思路了 周末开搞 |
That's great. You are the author. You have an idea. I'll start working on it on the weekend. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
有進展吗 @1205129045x |
Is there any progress @1205129045x |
Some one done this, maybe its'you, how ever I archived into here |
上周末花了两天才搞出来,可以实现按d进入鼠标模式,组合hjkl负责移动,但是并不影响快速输入一个d和长按d。 #SingleInstance, Force
SetWorkingDir, %A_ScriptDir%
global MouseControlMode := false
global CapsLockXMode := true ; 假设 CapsLockXMode 始终为真,您可以根据需要修改这个逻辑
global dKeyPressTime := 0
global dKeyHoldThreshold := 200 ; 长按阈值(毫秒)
global ReadyForMouseMode := false
$d::
dKeyPressTime := A_TickCount
MouseControlMode := true
ReadyForMouseMode := true
SetTimer, CheckHJKL, 10
while (GetKeyState("d", "P"))
{
if (!ReadyForMouseMode && A_TickCount - dKeyPressTime > dKeyHoldThreshold)
{
if (!GetKeyState("h", "P") && !GetKeyState("j", "P") && !GetKeyState("k", "P") && !GetKeyState("l", "P"))
{
SendInput, {Blind}{d DownTemp}
Sleep, 10
SendInput, {Blind}{d Up}
}
}
Sleep, 10
}
SetTimer, CheckHJKL, Off
MouseControlMode := false
ReadyForMouseMode := false
if (A_TickCount - dKeyPressTime < dKeyHoldThreshold)
{
Send, d ; 快速点击,输入 'd'
}
return
CheckHJKL:
if (ReadyForMouseMode && GetKeyState("d", "P") && (GetKeyState("h", "P") || GetKeyState("j", "P") || GetKeyState("k", "P") || GetKeyState("l", "P")))
{
MouseControlMode := false
SetTimer, CheckHJKL, Off ; 停止计时器,因为我们已经进入鼠标模式
}
if(A_TickCount - dKeyPressTime > 500 && MouseControlMode)
{
ReadyForMouseMode := false
SetTimer, CheckHJKL, Off ; 如果超过500ms没有进入鼠标模式,也停止计时器
}
return
#if CapsLockXMode && ReadyForMouseMode
*h:: 鼠标模拟.左按("h")
*j:: 鼠标模拟.下按("j")
*k:: 鼠标模拟.上按("k")
*l:: 鼠标模拟.右按("l")
; 当释放 HJKL 键时停止移动
*h up:: 鼠标模拟.左弹("h")
*j up:: 鼠标模拟.下弹("j")
*k up:: 鼠标模拟.上弹("k")
*l up:: 鼠标模拟.右弹("l") 大佬你是怎么判断单按一下大写键是正常的大写。 |
It took two days to come up with it last weekend. You can press d to enter mouse mode. The combination hjkl is responsible for movement, but it does not affect the quick input of a d and the long press of d. #SingleInstance, Force
SetWorkingDir, %A_ScriptDir%
global MouseControlMode := false
global CapsLockXMode := true ; Assuming CapsLockXMode is always true, you can modify this logic as needed
global dKeyPressTime := 0
global dKeyHoldThreshold := 200 ; Long press threshold (milliseconds)
global ReadyForMouseMode := false
$d::
dKeyPressTime := A_TickCount
MouseControlMode := true
ReadyForMouseMode := true
SetTimer, CheckHJKL, 10
while (GetKeyState("d", "P"))
{
if (!ReadyForMouseMode && A_TickCount - dKeyPressTime > dKeyHoldThreshold)
{
if (!GetKeyState("h", "P") && !GetKeyState("j", "P") && !GetKeyState("k", "P") && !GetKeyState("l", "P"))
{
SendInput, {Blind}{d DownTemp}
Sleep, 10
SendInput, {Blind}{d Up}
}
}
Sleep, 10
}
SetTimer, CheckHJKL, Off
MouseControlMode := false
ReadyForMouseMode := false
if (A_TickCount - dKeyPressTime < dKeyHoldThreshold)
{
Send, d ; Quick click, enter 'd'
}
return
CheckHJKL:
if (ReadyForMouseMode && GetKeyState("d", "P") && (GetKeyState("h", "P") || GetKeyState("j", "P") || GetKeyState("k", "P") || GetKeyState("l", "P")))
{
MouseControlMode := false
SetTimer, CheckHJKL, Off ; Stop the timer because we have entered mouse mode
}
if(A_TickCount - dKeyPressTime > 500 && MouseControlMode)
{
ReadyForMouseMode := false
SetTimer, CheckHJKL, Off; If the mouse mode is not entered for more than 500ms, the timer will also be stopped.
}
return
#if CapsLockXMode && ReadyForMouseMode
*h:: Mouse simulation. Left click ("h")
*j:: Mouse simulation. Press down ("j")
*k:: Mouse simulation. Press up ("k")
*l:: Mouse simulation. Right click ("l")
; Stop moving when HJKL key is released
*h up:: Mouse simulation. Left flick ("h")
*j up:: mouse simulation.down("j")
*k up:: Mouse simulation.Up("k")
*l up:: Mouse simulation. Right click ("l") Sir, how do you determine that single-clicking the caps key is normal caps. |
|
|
我现在发现按d会有延迟,比如打 |
I now find that there is a delay when pressing d. For example, when typing the word |
用来做触发键的肯定会有延迟的,用d的话打d会延迟,用空格的话打空格会延迟 我个人觉得空格延迟比较可以接受 |
There will definitely be a delay when used as a trigger key. If you use d to hit d, there will be a delay. If you use a space to hit a space, there will be a delay. Personally, I think space delay is more acceptable. |
指的是用空格做触发键吗,有办法改代码让延迟不影响我快速打字吗 |
Does it mean using space as the trigger key? Is there a way to change the code so that the delay does not affect my fast typing? |
具体来说,你在什么环节有延迟? case1 使用clx, 按空格+热键 case2 使用clx,按空格,输出空格 case3 不使用clx,输出空格 如果你想打空格的话,case2相比case3多了100ms延迟 |
Specifically, where do you experience delays? case1 uses clx, press space+hotkey case2 uses clx, press space, and output spaces case3 does not use clx and outputs spaces If you want to type spaces, case2 has an extra 100ms delay compared to case3. See the relevant code here |
关于打字,你可以使用不影响打字的引导键,比如右alt或capslock这些平时打字 不会用到的键做引导键,就不会导致打字延迟了 |
Regarding typing, you can use guide keys that do not affect typing, such as right alt or capslock. Keys that are not used in normal typing are used as guide keys, which will not cause typing delays. |
我现在的代码是。
因为有这个 case2 长按d case3 d和其他键连着按 |
My current code is.
Because of this case2 long press d case3 d and other keys pressed continuously |
这样的話我建議你使用不影响打字的引导键,比如右alt或capslock这些平时打字 不会用到的键做引导键,就不会导致打字延迟了 |
In this case, I recommend that you use guide keys that do not affect typing, such as right alt or capslock, which are keys that are not used in normal typing. As guide keys, it will not cause typing delays. |
可以。老老实实用右alt或ctrl了。 |
Can. Just use alt or ctrl right. |
我想设置成按d键然后再按hjkl模拟鼠标上下左右的,该怎么看源码自己改?
The text was updated successfully, but these errors were encountered: