如何在AHK中编写粘贴文本的脚本,等待一分钟,然后再粘贴?
AHK = AutoHotkey的
不是垃圾邮件,而是我自己的一个网络项目。
我应该指定:脚本需要粘贴文本,按回车,等待一分钟然后再粘贴。如果它没有按返回它不起作用。
答案 0 :(得分:2)
SetTimer比睡眠更好。
#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
答案 1 :(得分:1)
#NoEnv
Loop
{
SendInput, ^v
Sleep, 60000
}
Capslock::ExitApp
按下大写锁定以停止粘贴。对于代码中定义的文本:
#NoEnv
Loop
{
SendInput, This is the text I want to send{Enter}
Sleep, 60000
}
Capslock::ExitApp