Copy line by line (absolute newbie) Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
NewHappyRabbit
Posts: 2
Joined: 10 Aug 2022, 13:44

Copy line by line (absolute newbie)

Post by NewHappyRabbit » 10 Aug 2022, 13:55

Hello guys, I’ve been reading a couple of scripts that can answer my newbie question but have absolutely no idea how the script language works (need it ASAP and im overthrown with other work).

This is what I want to do:
1. I will export a txt file (in C:\%user%\Downloads folder) with URLs separated by a new line (product links from eCommerce)
2. I will open Viber desktop and open my group chat
3. Click on the message text box
4. Start the script
5. Script copies the first link, pastes it into the message field and hit ENTER. And repeat until all links are sent.
6. Delete the file.

Thanks in advance to anyone who is going to help me! :)

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

Re: Copy line by line (absolute newbie)

Post by BoBo » 11 Aug 2022, 03:28

Looks like spamming a list of contacts with a complete file of URLs? :think:
Doesn't that sound like breaking the AHK forum rules?? :wtf:

gregster
Posts: 8916
Joined: 30 Sep 2013, 06:48

Re: Copy line by line (absolute newbie)

Post by gregster » 11 Aug 2022, 06:08

Depends on the group chat, I guess, and who owns it. If it's used intentionally to exchange specific links, it's not automatically a problem.
Since the OP indicated that it is their own group chat, I assume that any group members follow it voluntarily, and can leave anytime.
But of course, it wouldn't hurt to elaborate.

Btw, I don't know Viber, but it looks like there is a Bot API. In Telegram, you can use bots as group admins and send messages to the group (among other things).
If Viber is similar, this would be probably the best and most reliable way to go.
Of course, learning to handle a bot would take some time and work - time which you might not have.

NewHappyRabbit
Posts: 2
Joined: 10 Aug 2022, 13:44

Re: Copy line by line (absolute newbie)  Topic is solved

Post by NewHappyRabbit » 11 Aug 2022, 16:23

@BoBo I'm sorry I didn't go into detail of why exactly I want such a script, so here's the details.

I'm creating an clothing eCommerce website for a customer with WooCommerce. He is currently using a Viber group (7K+ people) in which he invites all his customers to (the group is closed so only he can send messages) and sends all his products there (image with product info - SKU, price, sizes, etc.)

Now, he wants to keep sending his products there (for the customers that can't use the internet and won't visit the website), but doesn't want to first upload his products to the eCommerce and then do the same task in Viber (understandably).

@gregster I've been looking into an Viber Business Account and Viber ChatBot, but they don't offer anything of this kind:
- Viber Business can mass send messages to a subscibers list but its of no use, as he receives around 200 new products every week and has to send: 200 links * 7000 customers * 0.05$ per message....).
- Viber ChatBot doesn't have the option to send messages to groups. My first idea was to create a NodeJS server to which I send info for every product directly on-upload to the website via a WebHook, but then when I got to the point to testing it - I realised there was no option to send to a group chat (only to specific number).....

EDIT:
I've been searching hard tonight and managed to create the script, no need for any further help :)
For anyone else looking to fix the same problem as me, here's the script with comments:

Code: Select all

; Press SPACE to start script
Space:: 

; Open file for read
Loop, read, D:\Downloads\urls.txt
{
    ; Read line-by-line
	Loop, parse, A_LoopReadLine, %A_Tab%
	{
		; Type the copied line (product URL) and then a new line ("`r" - same as ENTER key)
		Send %A_LoopField% `r
	}
}

; Kill script after its done
ExitApp
Instructions for use:
1. Change "D:\Downloads\urls.txt" to your actual file directory and name.
2. Click anywhere you want the script to type (for me - Viber chat box)
3. Press SPACE.
4. The script will copy and paste the URLs line-by-line and then a newline after each one (line break) to send each URL as individual message.
5. After the script finishes its works, it kills itself so you dont accidentaly press SPACE again and re-run the script.

Post Reply

Return to “Ask for Help (v1)”