How to best output large amount of text + position after output

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
omar
Posts: 540
Joined: 22 Oct 2015, 17:56

How to best output large amount of text + position after output

08 Apr 2018, 09:40

What's the best way of outputting lots of text?
SendInput on it's own is not the answer - takes too long.

This is what I do:

Code: Select all

lotsOfText =
(
Lorem ipsum dolor sit amet, consectetur adipiscing elit. 

Ut faucibus convallis dui, nec laoreet est posuere ut. 

Fusce consequat mi et lacinia efficitur. 

Proin ultrices non nibh in luctus. 

Sed sagittis justo diam, a dignissim eros aliquet eget.
)

tempVariable := Clipboard ; I want to save whatever I have in the clipboard and put back after I have finished.
Sleep 200 ;I find it really annoying having to sleep - is there a better way? If I don't sleep, on some (NOT all) computers, the code doesn't execute as it should do.
Clipboard := lotsOfText
Sleep 200
SendInput ^v ; Send CTRL V to past
Sleep 200 ; sleep yet AGAIN! How annoying!
Clipboard := tempVariable ; Clipboard put back
Is this OK? How can I improve and make better?

ALSO... let's say I output many lines of text.
Now after the output I want to position my cursor somewhere in the middle - where I would start typing.
How can I best do this? Simulate arrow keys? The only thing I'm afraid of is that on different machines, the behaviour will be slightly different - so want something that is consistent.

Thanks.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: How to best output large amount of text + position after output

08 Apr 2018, 11:26

TBH, I don't understand the whole purpose of this. Would you mind to tell its background story and what you finally try to accomplish?!
User avatar
Flipeador
Posts: 1204
Joined: 15 Nov 2014, 21:31
Location: Argentina
Contact:

Re: How to best output large amount of text + position after output

08 Apr 2018, 14:49

You must change tempVariable := Clipboard --> tempVariable := ClipboardAll. Read ClipboardAll.
I do not think the first two Sleep 200 are necessary. Sleep 200 ; sleep yet AGAIN! How annoying! is necessary. Text is not sent instantly and you must wait a bit before restoring the original contents of the clipboard. Related.
Simulate arrow keys?
Yes, try SendInput {left n}.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: How to best output large amount of text + position after output

08 Apr 2018, 16:41

i mean sure you could probably get by using some other gimmicks such as Control, Edit Paste, which isnt guaranteed to seamlessly work in every environment, but this saveClip-pasteByCtrlV-restoreClip pattern is the fastest most reliable way to go about things

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: downstairs, Google [Bot] and 188 guests