ControlSend 将不正确的文本发送到后台应用程序

ControlSend sends incorrect text to background app

我正在尝试将 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

输出一直出错,像 : 这样的符号被错误输入为 ;

我宁愿不修改字符串本身,否则我也必须自动执行该过程,因为我是动态获取的。

有没有办法输出具有精确字符的字符串?

你展示了你的尝试,但结果如何?
我只能假设某些字符丢失了,在这种情况下

SetKeyDelay 10, 10

可能会有帮助。

ControlSend has a known reliability issue where the Shift key isn't always held down. This means that capital letters or special symbols aren't always typed correctly. (see ControlSend gets upper/lower case wrong?)

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

选项 1:设置 KeyDelay

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

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

选项 2:使用 Send or SendInput

WinActivate, Mozilla Firefox
SendInput, %url%

如果您想将输入发送到不在后台的应用程序,我建议将您的 window 设为 WinActivate and using Send or SendInput 的焦点。这些命令通常更可靠地发送输入。