Can I Send Lots Of Text In An Easier Fashion

Get help with using AutoHotkey and its commands and hotkeys
Mulsiphix
Posts: 50
Joined: 20 Nov 2015, 17:56

Can I Send Lots Of Text In An Easier Fashion

12 Apr 2019, 06:15

I have several messages, many which are 10,000+ characters of text. The messages are updated 2-4 times each week. I'd like to make a script that can send each message via a different hotkey. And I can figure that much out. The trouble is that my text has numerous newlines in it and the Send command only appears to send one line of text at a time. So writing a script for a 40 line message is very time consuming.

Code: Select all

Send {Text}message_part_01_of_40
Send {Text}message_part_02_of_40
Send {Text}message_part_03_of_40
Question #1
Is there an easier way to send large volumes of text that contains many newlines in it?

Question #2
Is it possible to have the script paste an entire messages from a text file, where it observed newlines? Can AHK do that with basic AHK scripting? Or is that fancy/advanced level stuff?
swagfag
Posts: 2480
Joined: 11 Jan 2017, 17:59

Re: Can I Send Lots Of Text In An Easier Fashion

12 Apr 2019, 06:24

1# yes copy paste them
2# fileread command

Code: Select all

clipboard := ""
fileread clipboard, msg.txt
clipwait 1
send ^v
Mulsiphix
Posts: 50
Joined: 20 Nov 2015, 17:56

Re: Can I Send Lots Of Text In An Easier Fashion

12 Apr 2019, 06:58

Holy cow!! That code is so simple and easy. Thank you so very much :lol:. This works beautifully in notepad. But in the online platform where I wish to paste these text blocks, the new lines are not recognized. Instead the messages come out with all newlines removed. Example:
Hello Jim,

Nice seeing you recently. Hope we can do it again soon.

Best Regards,
Marty

Instead is pasted like this...
Hello Jim,Nice seeing you recently. Hope we can do it again soon.Best Regards,Marty

Obviously this is an issue with the platform. Is there a way that I could get the script to press Enter on the keyboard each time a new line occurs? That is, could this be accomplished without manually preparing each message line-by-line, as I showcased in my first post?
burque505
Posts: 957
Joined: 22 Jan 2017, 19:37

Re: Can I Send Lots Of Text In An Easier Fashion

12 Apr 2019, 07:22

@Mulsiphix, maybe you can try this code.

Code: Select all

clipboard := ""
out := ""
loop, read, msg.txt
	out .= (A_LoopReadline . "`r`n")
clipboard := out
clipwait 1
send ^v
If it doesn't work, try replacing

Code: Select all

loop, read, msg.txt
	out .= (A_LoopReadline . "`r`n")
with

Code: Select all

loop, read, msg.txt
	out .= (A_LoopReadline . "`r")
or

Code: Select all

loop, read, msg.txt
	out .= (A_LoopReadline . "`n")
Regards,
burque505
Mulsiphix
Posts: 50
Joined: 20 Nov 2015, 17:56

Re: Can I Send Lots Of Text In An Easier Fashion

12 Apr 2019, 08:50

Thank you for your time and assistance burque505. Unfortunately, all three versions of the code you suggested provide the same result. I think the only thing that will work in this particular case, because my text is being sent into a chat box, is for new lines to be handled with "Send, [Enter]". Is it possible to use that though, using this clipboard method?
burque505
Posts: 957
Joined: 22 Jan 2017, 19:37

Re: Can I Send Lots Of Text In An Easier Fashion

12 Apr 2019, 10:05

Shooting in the dark here, but . . . if it's going in to the chat box as HTML, maybe . . .

Code: Select all

clipboard := ""
out := ""
loop, read, msg.txt
	out .= (A_LoopReadline . "<br>")
clipboard := out
clipwait 1
send ^v
return
EDIT: Well, I tried it here and it didn't work :( However, the first version DID work on that page . . .
Mulsiphix
Posts: 50
Joined: 20 Nov 2015, 17:56

Re: Can I Send Lots Of Text In An Easier Fashion

12 Apr 2019, 11:02

Sadly it doesn't accept HTML. Just comes out as <br>. The website is https://online-go.com/. I coach new players and their chat box is the worst. It is tiny and you can't resize it. But getting people to read an off site article is harder for some reason. They'll read a bunch of text in a cramped little box but won't leave the site to view a resource :wtf:.

That's okay. I figured it was worth asking about but I can just divide the text into single Send, {TEXT} lines. For the clipboard route I think the approach would have to be more involved. The text would have to be processed by the script. Dividing it up into different variables based on the occurrence of new lines. The script would have to paste a variable, send it with Send, paste the next variable, send again, etc.... when ^v is pressed.

I'll get there one day. My kung-fu isn't strong, but my desire to learn it is :superhappy:. Thank you so much for your help. I got a lot farther than I ever have before and I learned a couple of new things. Today is a win in my book :mrgreen: .
burque505
Posts: 957
Joined: 22 Jan 2017, 19:37

Re: Can I Send Lots Of Text In An Easier Fashion

12 Apr 2019, 11:10

Very interesting site, by the way!
list
Posts: 137
Joined: 26 Mar 2014, 14:03
Contact:

Re: Can I Send Lots Of Text In An Easier Fashion

13 Apr 2019, 07:00

Perhaps lintalist might be useful? See https://www.autohotkey.com/boards/viewtopic.php?f=6&t=3378
( there is a file plugin which can read texts from files) - in general it pastes the entire text but you can set the linefeed per application - here your browser if need be - http://lintalist.github.io/#Configuration-Linefeed )
Mulsiphix
Posts: 50
Joined: 20 Nov 2015, 17:56

Re: Can I Send Lots Of Text In An Easier Fashion

13 Apr 2019, 12:16

list wrote:
13 Apr 2019, 07:00
Perhaps lintalist might be useful? See https://www.autohotkey.com/boards/viewtopic.php?f=6&t=3378
( there is a file plugin which can read texts from files) - in general it pastes the entire text but you can set the linefeed per application - here your browser if need be - http://lintalist.github.io/#Configuration-Linefeed )
:superhappy: I am so happy right now. I use AHK to work with text all of the time. This tool is going to save me so much time! You don't even know :dance:. Thank you so much!!!! for telling me about this :lol:
burque505 wrote:
12 Apr 2019, 11:10
Very interesting site, by the way!
It is, isn't it? I've been playing there for about 4 months and have starched teaching beginners how to play better. Most of that is done through the very inadequate chat box. I've decided to get my act together and standardize some responses so I can help more people in a quicker fashion. I was preparing the responses in AHK until Lintalist was mentioned. I think this will work perfectly. Thank you so much for your help along the way :wave:

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], Kobaltauge, Odlanir, ozzy5454, swagfag and 122 guests