past file.txt content to a URL (chat)

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Nylream
Posts: 2
Joined: 05 Sep 2022 05:46

past file.txt content to a URL (chat)

#1 Post by Nylream » 05 Sep 2022 06:00

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

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

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

#2 Post by aGerman » 05 Sep 2022 10:07

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

Nylream
Posts: 2
Joined: 05 Sep 2022 05:46

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

#3 Post by Nylream » 05 Sep 2022 10:11

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 ?

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

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

#4 Post by aGerman » 05 Sep 2022 10:57

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

Post Reply