Cybergon Posted October 26, 2009 Posted October 26, 2009 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.
Fubarable Posted October 26, 2009 Posted October 26, 2009 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?
Cybergon Posted October 26, 2009 Author Posted October 26, 2009 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"??
Fubarable Posted October 26, 2009 Posted October 26, 2009 (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 October 26, 2009 by Fubarable
ResNullius Posted October 26, 2009 Posted October 26, 2009 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( )
Cybergon Posted October 26, 2009 Author Posted October 26, 2009 (edited) Again, I'm no pro, again, far from iti 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 October 26, 2009 by Cybergon
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now