如何在 Autokey 中将 select 文本用引号 ("") 括起来?
How to wrap the select text in quotes ("") in Autokey?
我使用以下脚本在按下指定热键时在文本周围添加撇号 '
:
text = clipboard.get_selection()
keyboard.send_key("<delete>")
keyboard.send_keys("'%s'" % text)
将最后一行更改为 keyboard.send_keys(""%s"" % text)
不起作用 - 可能必须对引号进行转义。
您需要在将环绕所选文本的引号前使用反斜杠转义:
text = clipboard.get_selection()
keyboard.send_keys("\"%s\"" % text)
我使用以下脚本在按下指定热键时在文本周围添加撇号 '
:
text = clipboard.get_selection()
keyboard.send_key("<delete>")
keyboard.send_keys("'%s'" % text)
将最后一行更改为 keyboard.send_keys(""%s"" % text)
不起作用 - 可能必须对引号进行转义。
您需要在将环绕所选文本的引号前使用反斜杠转义:
text = clipboard.get_selection()
keyboard.send_keys("\"%s\"" % text)