Hello.
I was playing with the Send command.
It seems it can only send text character by character, like typing.
I was wondering if it is possible to send a text as a whole string?
Thanks.
How to Send text as one string?
Re: How to Send text as one string?
Code: Select all
#SingleInstance
#Requires AutoHotkey v2+
^+p:: ; Ctrl+Shift+P, save to clipboard, then simulate paste.
{
A_Clipboard := "I was playing with the Send command.`nIt seems it can only send text character by character, like typing.`nI was wondering if it is possible to send a text as a whole string?`n`nI was playing with the Send command.`nIt seems it can only send text character by character, like typing.`nI was wondering if it is possible to send a text as a whole string?`n`nI was playing with the Send command.`nIt seems it can only send text character by character, like typing.`nI was wondering if it is possible to send a text as a whole string?`n`nI was playing with the Send command.`nIt seems it can only send text character by character, like typing.`nI was wondering if it is possible to send a text as a whole string?`n`nI was playing with the Send command.`nIt seems it can only send text character by character, like typing.`nI was wondering if it is possible to send a text as a whole string?"
Send "^{v}" ; Ctrl+V tells Windows to paste content of clipboard.
}
ste(phen|ve) kunkel
Re: How to Send text as one string?
I would use ClipWait.
Code: Select all
#Requires AutoHotkey v2.0
str := 'I was playing with the Send command.`nIt seems it can only send text character by character,'
. ' like typing.`nI was wondering if it is possible to send a text as a whole string?`n`n'
str .= str str str
^+p::paste(str)
paste(str) {
A_Clipboard := ''
A_Clipboard := str
If ClipWait(1)
Send '^v'
Else MsgBox 'An error occurred while waiting for the clipboard.', 'Error', 'Icon!'
}
Re: How to Send text as one string?
Yeah, good call.
I guess it's also worth mentioning that if you are pasting multiple paragraphs, you can have the variable assignment with a multiline continuation section.
This takes more lines of code, but it is easier to understand.
Code: Select all
A_Clipboard := "
(
I was playing with the Send command.
It seems it can only send text character by character, like typing.
I was wondering if it is possible to send a text as a whole string?
I was playing with the Send command.
It seems it can only send text character by character, like typing.
I was wondering if it is possible to send a text as a whole string?
I was playing with the Send command.
It seems it can only send text character by character, like typing.
I was wondering if it is possible to send a text as a whole string?
I was playing with the Send command.
It seems it can only send text charater by character, like typing.
I was wondering if it is possible to send a text as a whole string?
I was playing with the Send command.
It seems it can only send text character by character, like typing.
I was wondering if it is possible to send a text as a whole string?
)"
ste(phen|ve) kunkel
Re: How to Send text as one string?
You don't need ClipWait when assigning to clipboard directly.
Re: How to Send text as one string?
That is what I thought for a while, but I had an instance where I thought that the ClipWait made a difference. I might have been mistaken and defer to lexikos's expertise. If I encounter the problem again, I will post.