Jonathon M
Jonathon M

Reputation: 71

Script to type out a text file

I've been wanting to make a program that takes a text file and types it out into a different form. In the current application, I'd have it type out 500 characters, press enter, and continue with the next 500. This could be used with twitter, for example, to type long text files into tweet form. I have no intent to distribute this, so System-specific solutions would be fine. I am using Ubuntu 16.04.

What would be the best language to go about doing this? I am already familiarised with Java, but I'm not sure how to get it to use my keyboard directly. Is there a way for Java to do this? If not, what would be a language suitable for my application?

Upvotes: 0

Views: 194

Answers (1)

Joakim
Joakim

Reputation: 136

According to this answer you could use the Robot API in Java.

Robot r = new Robot();
r.keyPress(KeyEvent.VK_ENTER);
r.keyRelease(KeyEvent.VK_ENTER);

Which you possible could use in combination with reading the text file 500 characters at a time.

Upvotes: 1

Related Questions