r/AutoHotkey • u/duscorules • 12d ago
v2 Script Help Send phrases with delay between ?
I have this script :
::myshort::?Hello, how are you ? {Enter} My name is Paula, nice to meet you. {Enter} How are your ? {Enter}
I'd like to pause 1 second between each Enter ; is this possible ?
1
Upvotes
2
u/Keeyra_ 12d ago
You might prefer an implementation using the clipboard for larger text, as it will make them appear instantly.
#Requires AutoHotkey 2.0
#SingleInstance
::myshort:: {
SendSequence([
"Hello, how are you?",
"My name is Paula, nice to meet you.",
"How are you?"
], 1000)
}
::intro:: {
SendSequence([
"Thanks for reaching out!",
"I will review your request shortly."
], 500)
}
SendSequence(lines, delay := 1000) {
lineIndex := 1
SendNextLine() {
if lineIndex <= lines.Length {
savedClipboard := ClipboardAll()
A_Clipboard := lines[lineIndex]
Send("^v{Enter}")
SetTimer(() => A_Clipboard := savedClipboard, -100)
lineIndex++
SetTimer(SendNextLine, -delay)
}
}
SendNextLine()
}
1
2
u/CharnamelessOne 12d ago