【发布时间】:2019-11-24 15:29:46
【问题描述】:
我想做的是构建一个函数,我可以用它来粘贴一些东西(在本例中是 URL)。通常我只会使用 send 命令或 sendinput 命令,但它们有点慢,有点烦人。这就是为什么我想避免它并改用剪贴板。
这是我的功能:
ClipPaster(CustomClip){
ClipSaved := ClipboardAll ;Saving the current clipboard
Clipboard := %CustomClip% ;Overwriting the current clipboard
Send, ^{v}{Enter} ;pasting it into the search bar
Clipboard := Clipsaved ;Recovering the old clipboard
}
我是如何使用这个函数的:
RAlt & b::
Send, ^{t} ;Open a new tab
ClipPaster("chrome://settings/content/images") ;Activating my clipboard
return
RAlt & g::
Send, ^{t} ;Open a new tab
ClipPaster("https://translate.google.com/#en/es/violin") ;Activating
my clipboard function
return
然后当我尝试使用该功能时。我收到一个错误: 错误:以下变量名称包含非法字符:“chrome://settings/content/images” 线: -->1934: 剪贴板:= %CustomClip%
我在这里做错了什么?
【问题讨论】:
标签: function variables autohotkey clipboard