如何使用AutoHotKey添加括号 [英] How to add brackets using AutoHotKey
问题描述
我想创建一个热键 Ctrl + ((在括号中添加括号).即选择x-1
以获得(x-1)
.如何对该函数进行编程?
I want to create a hotkey Ctrl + ( that adds brackets to a phrase. I.e select x-1
to get (x-1)
. How to program this function?
我写了很多短语,例如:x+1/(x-1)^2
,因此使用热键添加括号会很有帮助.
I write a lot of phrases such as: x+1/(x-1)^2
so it would be helpful to have a hotkey to add brackets.
推荐答案
^(::
SendInput, ^c
Sleep 10
Clipboard = (%Clipboard%)
SendInput, ^v
return
这意味着您实际上是在按CTRL + SHIFT + 9(因为您没有(
键).
This implies that you are actually pressing CTRL+SHIFT+9 (since you don't have a (
key).
我做了一个快速测试,它将为您突出显示的内容添加圆括号.我建议对触发键进行调整,因为CTRL + SHIFT + 9不太容易击中,但否则似乎可以正常工作.
I did a quick test and it will add round brackets to anything you highlight. I would recommend tweaking the trigger key since CTRL+SHIFT+9 isn't that easy to hit, but otherwise seems to work without issues.
如果要保存剪贴板,则必须执行以下操作:
If you want to save the clipboard, then you'll have to do this:
^(::
SavedClipboard := ClipboardAll
SendInput, ^c
Sleep 10
Clipboard = (%Clipboard%)
SendInput, ^v
Clipboard := SavedClipboard
SavedClipboard =
return
这篇关于如何使用AutoHotKey添加括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!