请问如何让修饰键单独生效的同时,修饰键+字母键也能生效?

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: 请问如何让修饰键单独生效的同时,修饰键+字母键也能生效?

Re: 请问如何让修饰键单独生效的同时,修饰键+字母键也能生效?

Post by amorphobia » 20 Jun 2023, 03:38

好像必须显式指定 "<^a" 才能生效,这样改就可以了

Code: Select all

HotKey("<^a", process.Bind("^a"))

Re: 请问如何让修饰键单独生效的同时,修饰键+字母键也能生效?

Post by skyonsky99 » 19 Jun 2023, 21:09

检测修饰键按下时间200ms内,若同时按下字母键,则执行1。否则就是单独生效的分支。这样只要定义LControl一个热键, ^a不用了。
或者将LCtrl换成RCtrl。

请问如何让修饰键单独生效的同时,修饰键+字母键也能生效?

Post by amorphobia » 19 Jun 2023, 20:48

大家好,我有一个需求,要让按下和释放修饰键(如 ctrl)都有热键效果,同时也需要定义修饰键+字母键(如 ctrl + a)的热键,我发现单独定义了修饰键的按下和释放后,修饰键+字母键的热键定义就不起效了,有没有什么方法可以做到吗?

示例代码:

Code: Select all

#Requires AutoHotkey v2.0

process(text, key) {
    SendText(text)
}

HotKey("^a", process.Bind("^a"))
Hotkey("LControl", process.Bind("LControl Down"))
Hotkey("LControl Up", process.Bind("LControl Up"))
这段示例代码想要实现的效果是,单独按左 ctrl 键的时候,发送“LControl Down”和“LControl Up”,按下 ctrl+a 的时候,发送“^a”,但实际上在按下 ctrl+a 的时候发送的是“LControl Down”、“a”、“LControl Up”,可以看到,ctrl+a 的热键是不起作用的。请问该如何修改?

谢谢!

Top