Autohotkey 自动热键脚本,点击时发送空格,按住时移动。它正在影响其他映射
我写这个脚本是为了让我的空格键在点击时充当空格键,在按住时充当shift键。但是,它会影响映射,例如 ::顺便说一下 脚本: 当我在键入“btw”后点击空格键将“btw”转换为“顺便说一句”时,转换没有发生Autohotkey 自动热键脚本,点击时发送空格,按住时移动。它正在影响其他映射,autohotkey,Autohotkey,我写这个脚本是为了让我的空格键在点击时充当空格键,在按住时充当shift键。但是,它会影响映射,例如 ::顺便说一下 脚本: 当我在键入“btw”后点击空格键将“btw”转换为“顺便说一句”时,转换没有发生 我是否可以更改下面的脚本以确保在上述场景中进行转换 $Space:: now := A_TickCount while GetKeyState("Space", "P") ; to find out whether space-bar is held if (A_TickCou
我是否可以更改下面的脚本以确保在上述场景中进行转换
$Space::
now := A_TickCount
while GetKeyState("Space", "P") ; to find out whether space-bar is held
if (A_TickCount-now > 180) ; this time is tested on asker's computer
{
SendInput {Shift Down}
KeyWait, Space
SendInput {Shift Up}
return
}
SendInput {Space} ; if key detected to be tapped, send space as per normal
return
谢谢:)如果自动热键生成的事件的发送级别等于或低于事件的发送级别,则热字符串将忽略这些事件 这意味着
空间的发送级别
,必须设置为比您希望使用它触发的主机环级别更高的级别:
#InputLevel, 10 ;set send level for the following code to 10
$Space::
#InputLevel ;set it back to default value of 0 for any remaining code
now := A_TickCount
while GetKeyState("Space", "P") ; to find out whether space-bar is held
if (A_TickCount-now > 180) ; this time is tested on asker's computer
{
SendInput {Shift Down}
KeyWait, Space
SendInput {Shift Up}
return
}
SendInput {Space} ; if key detected to be tapped, send space as per normal
return
如果热字符串的发送级别等于或低于事件的发送级别,则热字符串将忽略自动热键生成的事件 这意味着
空间的发送级别
,必须设置为比您希望使用它触发的主机环级别更高的级别:
#InputLevel, 10 ;set send level for the following code to 10
$Space::
#InputLevel ;set it back to default value of 0 for any remaining code
now := A_TickCount
while GetKeyState("Space", "P") ; to find out whether space-bar is held
if (A_TickCount-now > 180) ; this time is tested on asker's computer
{
SendInput {Shift Down}
KeyWait, Space
SendInput {Shift Up}
return
}
SendInput {Space} ; if key detected to be tapped, send space as per normal
return
您必须将
btw
的自动替换代码更改为
:*:btw::by the way
而不是
::btw::by the way
这将自动将
btw
替换为,顺便说一句
,即使您有空间的热键
,您也必须将btw的自动替换代码更改为
:*:btw::by the way
而不是
::btw::by the way
顺便说一句,这将自动将btw
替换为,
,即使您有所提到的空间热键@Neo-Ding-Yue它工作吗?起初我喜欢你,但它有很多缺点。最后,我找到了一个两年来一直在使用的解决方案:1。注册表重新映射空间,使其行为类似于LShift并使用以下代码:
~*LShift:: ;tilde so it gets triggered already on down, in combination with any key, hence can be used as modifier key
Keywait,LShift, L ; just to deactivate autofire
return
~LShift up::
IF(A_TimeSincePriorHotkey < 150 && A_PriorKey = "LShift") {
SendInput {Space}
}
return
~*LShift::;平铺,使其在向下时已被触发,并与任何键结合使用,因此可以用作修改器键
钥匙等待,升档,升档;只是为了解除自动开火
返回
~l升档::
如果(A_timesinceprior热键<150&&A_PriorKey=“LShift”){
SendInput{Space}
}
返回
如果你有问题,就问(我有其他版本)。@Neo-Ding-Yue它能用吗?起初我喜欢你,但它有很多缺点。最后,我找到了一个两年来一直在使用的解决方案:1。注册表重新映射空间,使其行为类似于LShift并使用以下代码:
~*LShift:: ;tilde so it gets triggered already on down, in combination with any key, hence can be used as modifier key
Keywait,LShift, L ; just to deactivate autofire
return
~LShift up::
IF(A_TimeSincePriorHotkey < 150 && A_PriorKey = "LShift") {
SendInput {Space}
}
return
~*LShift::;平铺,使其在向下时已被触发,并与任何键结合使用,因此可以用作修改器键
钥匙等待,升档,升档;只是为了解除自动开火
返回
~l升档::
如果(A_timesinceprior热键<150&&A_PriorKey=“LShift”){
SendInput{Space}
}
返回
如果您有问题,请提问(我有其他版本)。谢谢您的回复!然而,我在我的电脑上尝试了这个代码,它并没有像预期的那样工作;我仍然有上面相同的场景。“你的代码在你的计算机上成功了吗?”NeoDingYue是的,我事先测试了代码。热字符串::btw::顺便说一句
被触发了。感谢您的回复!然而,我在我的电脑上尝试了这个代码,它并没有像预期的那样工作;我仍然有上面相同的场景。“你的代码在你的计算机上成功了吗?”NeoDingYue是的,我事先测试了代码。热字符串::顺便说一下,
被触发了。谢谢你的回答!但是,我有许多其他映射,比如上面的自动替换代码,并且仍然希望对要替换的字符串拥有一些自治权;比如,如果我想在没有自动替换功能的情况下键入“btwer”,这样做会很困难。这仍然是一个有趣的解决方法:)谢谢你的回答!但是,我有许多其他映射,比如上面的自动替换代码,并且仍然希望对要替换的字符串拥有一些自治权;比如,如果我想在没有自动替换功能的情况下键入“btwer”,这样做会很困难。这仍然是一个有趣的解决方法:)它应该可以工作,我希望看到使用我的答案修复的整个代码。它应该可以工作,我希望看到使用我的答案修复的整个代码。