gpt4 book ai didi

autohotkey - 在 Autohotkey 中发送用两个变量包裹的剪贴板内容

转载 作者:行者123 更新时间:2023-12-03 23:49:42 28 4
gpt4 key购买 nike

我想使用 Autohotkey 连接变量 1、剪贴板内容和变量 2。

例如,如果:

  1. variable1 = https://example.com/somepage.php?command=details&reservationId=
  2. 剪贴板内容 = 12345
  3. variable2 = &url=%2Fsomepage.php%3submit%3DSEARCH%26submit

预期的结果是:

https://example.com/somepage.php?command=details&reservationId=12345&url=%2Fsomepage.php%3submit%3DSEARCH%26submit


下面显示的两种方法只是输出12345

我做错了什么?

尝试 1:

::hd-eurl::
ClipSaved := ClipboardAll ; get clipboard
variable1:= "https://example.com/somepage.php?command=details&reservationId="
variable2:= "&url=%2Fsomepage.php%3submit%3DSEARCH%26submit"
ClipNew = %variable1% . ClipSaved . %variable2%
clipboard = ClipNew
ClipWait
Send, ^v
clipboard := ClipSaved ; restore original clipboard
return

尝试 2:

::hd-eurl::
Send ^c
ClipSaved := ClipboardAll ; get clipboard
variable1= https://example.com/somepage.php?command=details&reservationId=
variable2= &url=`%2Fsomepage.php`%3submit`%3DSEARCH`%26submit
ClipNew = variable1 . ClipSaved . variable2
clipboard = ClipNew
ClipWait
Send, ^v
clipboard := ClipSaved ; restore original clipboard
return

更新(同样的结果):

::hd-eurl::
ClipSaved := ClipboardAll ; get clipboard
variable1:= "https://example.com/somepage.php?command=details&reservationId="
variable2:= "&url=%2Fsomepage.php%3submit%3DSEARCH%26submit"
ClipNew := variable1 . ClipSaved . variable2
clipboard := ClipNew
ClipWait
Send, ^v
clipboard := ClipSaved ; restore original clipboard
return

工作解决方案

这就是我最终让它工作的方式。但是,所选答案中 Blauhirn 的方法使用起来要简单得多。

::hd-eurl::
ClipSaved := ClipboardAll ; store clipboard backup
variable1:= "https://example.com/somepage.php?command=details&reservationId="
variable2= %ClipBoard%
ClipBoard =
variable3:= "&url=%2Fsomepage.php%3submit%3DSEARCH%26submit"
variable4:= variable1 . variable2 . variable3
Clipboard:= variable4
ClipWait
Send, ^v
Clipboard := ClipSaved ; restore original clipboard
return

最佳答案

您的 clipSaved 变量包含 clipboardAllDocumentation说:

Variables to which ClipboardAll has been assigned are in binary format and thus will appear as gibberish when displayed with MsgBox or similar.

分配给clipNew时,您必须使用clipboard,例如

 ClipNew := variable1 . clipboard . variable2

除此之外,我建议您根本不要修改clipboard 的内容,因为这是最复杂的方法。如果你想发送东西,只需使用 send command在字符串上而不是调用 CTRL+V:

::hd-eurl::
variable1:= "https://example.com/somepage.php?command=details&reservationId="
variable2:= "&url=%2Fsomepage.php%3submit%3DSEARCH%26submit"
send % variable1 clipboard variable2
return

关于autohotkey - 在 Autohotkey 中发送用两个变量包裹的剪贴板内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31932978/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com