Page 1 of 1

past file.txt content to a URL (chat)

Posted: 05 Sep 2022 06:00
by Nylream
Hello everyone,

I'm trying to copy the content of a file.txt, and past it once I've opened a URL pointing to a chat.
The URL directly get to the chat, any input once it's open will be taken.

I have manage to put in the clip a short text, but the goal is to take the full file.txt at once as it holds 16 lines including 3 empty lines.

Code: Select all

@echo off
(echo my text) |clip
I did found how to open the URL

Code: Select all

START FIREFOX http://my.url
I didn't succeed at pasting anything to the chat itself.

Any help would be very much appreciated.

Thank you for reading me,

Nyl

Re: past file.txt content to a URL (chat)

Posted: 05 Sep 2022 10:07
by aGerman
Nylream wrote:
05 Sep 2022 06:00
I didn't succeed at pasting anything to the chat itself.
That's because Batch doesn't interact with graphical interfaces ¯\_(ツ)_/¯

Steffen

Re: past file.txt content to a URL (chat)

Posted: 05 Sep 2022 10:11
by Nylream
oh, thank you for your answer.
So there is no way, with a batch, to send a text to a program like Firefox or Chrome ?

Re: past file.txt content to a URL (chat)

Posted: 05 Sep 2022 10:57
by aGerman
Right. Other scripting languages like VBScript support something like a SendKeys() method. However, even that wouldn't be foolproof because the window with the keyboard focus will receive the input. How would you ensure that the textbox in the browser window has the focus? How would you even ensure that the browser window is already open and ready for input at the time you start sending key strokes? That's all much more complicated than you may have expected.

Steffen