ControlSend将错误的文本发送到后台应用程序

时间:2015-10-28 18:25:54

标签: macros autohotkey

我正在尝试将URL发送到后台应用。我尝试过以下方法:

url = https://www.google.nl/?gws_rd=ssl#q=autohotkey+send+url
ControlSendRaw, , %url%, Mozilla Firefox

url= {Raw}https://www.google.nl/?gws_rd=ssl#q=autohotkey+send+url
ControlSend, , %url%, Mozilla Firefox

url := "https://www.google.nl/?gws_rd=ssl#q=autohotkey+send+url"
ControlSendRaw, , %url%, Mozilla Firefox

//output: https;//www.google.nl//gws-rd=ssl3q=autohotkey=send=url

输出错误,:等符号被误输为;

我宁愿不修改字符串本身,否则我必须自动化该过程,因为我动态地获取它们。

有没有办法用它的确切字符输出一个字符串?

2 个答案:

答案 0 :(得分:1)

你展示了你尝试过的东西,但结果是什么? 我只能假设某些角色丢失了,在那种情况下

SetKeyDelay 10, 10

可能会有所帮助。

答案 1 :(得分:1)

ControlSend有一个已知的可靠性问题,其中 Shift 键并不总是被按住。这意味着大写字母或特殊符号并不总是正确输入。 (参见 ControlSend gets upper/lower case wrong?

请注意,您网址中输入错误的符号需要按住shift键。 (:?_#+

选项1:设置KeyDelay

SetKeyDelay, 10, 10
ControlSend, , %url%, Mozilla Firefox

使用SetKeyDelay设置密钥延迟可以提高发送的击键的可靠性。我发现延迟5或10通常足以解决任何大写问题。

选项2:使用SendSendInput

WinActivate, Mozilla Firefox
SendInput, %url%

如果您要将输入发送到不在后台的应用,我建议您使用WinActivate并使用SendSendInput关注您的窗口。这些命令通常更可靠地发送输入。

相关问题