Sign in to follow this  
Followers 0
Cybergon

Inserting large paragraphs of text

6 posts in this topic

Hi.

My question is simple, how do i insert large amounts of text without using the "send" function?

The problem is that doing it like this consumes way too much resources and it's not too fast.

I'm not trying to control any game or simulate keystrokes, i just need autoit to paste into a text field some info i've stated beforehand in the code as "send ("blah blah blah")" like 1000 times.

Thanks in advance.

Share this post


Link to post
Share on other sites



I'm no expert here, in fact far from it, but what happens if you copy to and paste from the clipboard? Does it work faster?

Share this post


Link to post
Share on other sites

I'm no expert here, in fact far from it, but what happens if you copy to and paste from the clipboard? Does it work faster?

the problem is that the info i have variates with date, id, names etc. but maybe transfering it temporarily into the clipboard and idmediately pasting it might work.

the question would be how to do the "transfer"??

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

the question would be how to do the "transfer"??

Again, I'm no pro, again, far from it, but ClipPut(...) will copy string to the clipboard and a Send("^v") will paste from it:

; gettysb.txt -- a text file with the Gettysburgh address
$file = FileOpen("gettysb.txt", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

$text = FileRead($file)
FileClose($file)

ClipPut($text) ; copy string to cliboard

Run("notepad.exe")
WinWaitActive("Untitled - Notepad")

;Send($text) ; compare Send with 

Send("^v") ; paste from clipboard
Edited by Fubarable

Share this post


Link to post
Share on other sites

Hi.

My question is simple, how do i insert large amounts of text without using the "send" function?

The problem is that doing it like this consumes way too much resources and it's not too fast.

I'm not trying to control any game or simulate keystrokes, i just need autoit to paste into a text field some info i've stated beforehand in the code as "send ("blah blah blah")" like 1000 times.

Thanks in advance.

Depending on the type of window the text field is in, you might also want to investigate ControlSetText( )

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Again, I'm no pro, again, far from it

i don't know about that, but actually this worked pretty well!!

i used something like this:

$infoName = inputbox ("Name","insert name here")

*some code that puts the cursor into place*

ClipPut ($infoName)

send ("^v")

it's faster than ever!! than you so much man.

also thanks to resnullius for the suggestion, i looket it up and i could see its a neat function, but i still don't know exactly how to use controlID so i'll stick with the previous solution which is a bit more practical and easy to remember.

cheers.

Edited by Cybergon

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0