wait - 如何在 AHK 中编写一个脚本来粘贴文本,等待一分钟,然后再次粘贴?

标签 wait autohotkey repeat

如何在 AHK 中编写一个脚本来粘贴文本,等待一分钟,然后再次粘贴?

AHK=自动热键

不是为了垃圾邮件,而是为了我自己的网络项目之一。

我应该指定:脚本需要粘贴文本,按回车键,等待一分钟,然后再次粘贴。如果不按回车键,则不起作用。

最佳答案

对于这样的事情,SetTimer 比 sleep 更好。

#Persistent

; Put this wherever you want, like inside a hotkey
; Either set the clipboard to some text, or just remove this
; to use what's already there
Clipboard = This is some text to paste
SendInput ^v{Enter}
last_text := Clipboard
SetTimer, RePaste, 60000
return

RePaste:
; The clipboard can change in a minute, right?
; so we use the text we had before
tmp := clipboard
Clipboard := last_text
SendInput ^v{Enter}

; And restore what the user had
Clipboard := tmp
return

; Put this somewhere, like in a hotkey, to turn off the timer
SetTimer, RePaste, off

关于wait - 如何在 AHK 中编写一个脚本来粘贴文本,等待一分钟,然后再次粘贴?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13660459/

相关文章:

scroll - 使用自动热键降低滚动速度

python - 将列表中的每个项目重复另一个列表中指定的次数

iphone - 在 native iPhone 应用程序中重复背景图像

java - Selenium - 在继续之前等待 Javascript 函数执行

java - 让当前线程 hibernate ,让其他线程唤醒它

wait - 让海龟等待 x 刻度数

java - 如何创建一个重复函数的方法?

java - 线程放弃等待并抛出异常的方法

user-interface - 自动热键闪烁 GUI

autohotkey - 失去焦点后如何激活窗口?