Monotonous computer activities Roboticized.
Have there been times where you'd like to automate many of your typing
tasks? Have your actions required coordination across windows — type
a few letters here, click on the other window, wait a few seconds,
type some more? Robotonous is might be for you.
Since Java 1.3, the Java SDK has had the class
java.awt.Robot
that allows mouse control and text entry. Robot is low level. For
instance, I'd like to make the computer type something but Robot
doesn't have a type
API. Adding those capabilities is Robotonous's
main contribution.
Note: Robotonous is in early stages of development and use. It is messy and not easy to use. At the current state its features are powered more for my usecases (my YouTube channel) than for usability. That said it has improved with each video produced.
Java 17 is the minimum required version for Robotonous because it uses switch expressions.
javac -d bin `find src -type f -name '*.java'`
Running the program is as shown below. See §Instructions for details.
java -cp bin com.lvijay.robotonous.Main instructions.robo
To use, specify instructions in a text file. Most letters are typed as is with special instructions to type special keys.
Robotonous expects typing instructions in ascii text, specifically a
typical 104 key qwerty keyboard layout with unicode keys issuing
special commands. When Robotonous encounters ordinary keyboard
characters, it will type them the same way a human might. For
instance, the string Hello!
will result in typing SHIFT h
followed
by e
, l
, l
, o
, and finally SHIFT 1
. (On my US-English
qwerty keyboard !
is typed by pressing SHIFT
and 1
together.)
See a sample video below.
Typing keyboard keys is straightforward. The keys as they appear will be typed.
Typing multiple keys at once is known as chording. Ever typed the keyboard shortcuts for Cut/Copy/Paste? You've key chorded.
To chord in Robotonous you enter a special character, «
is the
default character (it can be customized, see
§Customizations below). A character sequence that
starts with «
and ends with «
be typed together. The default
character for the SHIFT key is §
, the chord «§abcdef«
types out
ABCDEF. Similarly, the chord «¢c«
types CTRL C
because ¢
is the
default character for the CTRL
key.
Robotonous uses non-ascii characters – technically Unicode character code points past Basic Latin – to type modifier keys (CTRL, ALT, SHIFT, ...) and other special keys (ESCAPE, BACKSPACE...).
The available controls, their default keys, and purpose are described in the table below.
Key Name | Default key | Documentation |
---|---|---|
keyCommentLine | © | Ignores all content until the end of the line. |
keyChord | « | Initiates a chord. Reuse the character to indicate termination of the chord. «§123« types SHIFT 1 2 3 |
keyCopy | ¶ | Seeing text appear on the screen one key at a time gets boring fast. For a (literally) graphic illustration of slow character by character viewing see my first robotonous video. Robotonous's Copy/Paste feature allows rapid text insertion. hello, ¶world!¶ executes as h e l l o, SPACE world! . See Paste example to see it in action. |
keySpeak | γ | See §Speak below. |
keySpeakWait | ω | See §Speak below. |
keyControl | ¢ | Represents the CTRL key |
keyAlt | æ | Represents the Alt or Option key |
keyShift | § | Represents the SHIFT key |
keyMeta | ± | Represents the META key |
keyEscape | ␛ | Represents the ESCAPE key |
keyNewline | ␊ | In normal text, Robotonous will just type a newline when it encounters the \n character. In more complicated key chord usecases (specifically, in ones involving GNU Screen) I found a character easier to use and read. I think you can get by using Robotonous and never need this key. Represents the RETURN key |
keyTab | ␉ | A simple way to make Robotonous enter TAB (ASCII Character 9, '\t'). Unlike newlines, this is actually useful because TABs are otherwise indistinguishable from spaces. |
keyBackspace | ‹ | Represents the Backspace key |
keyDelete | › | Represents the Delete key |
pasteChord | keyMeta + "v" | Defaults to the Mac OS X's ⌘v because that's the computer I'm using. Customize to suit your OS. Ideally, this should default itself in an OS dependent manner with customization support in contextual environments (GNU Emacs uses CTRL Y to paste, for eg.) PRs welcome. |
Many keys, such as the arrow keys and function keys, are unrepresented and unsupported if only because a usecase was pending. PRs welcome.
An example of the paste action.
The string encased between two ¶ (PILCROW SIGN
characters) is
inserted into the system clipboard and pasted. This is much quicker
than typing character by character.
Robotonous supports customizing the Unicode character representing a
special key. At the start of a file, give the key name (column 1 in
§Special Keys above) =
and your preferred Unicode
character. Use four hyphens on a separate line to show the
customizations section is over. For example:
keyMeta = ⌘
----
In the above, the META key alone is customized. The Unicode character PLACE OF INTEREST represents it.
TBD
In 2020, I pulled off a git "magic trick". It was screen recorded and shared as a YouTube video. The entire narration was done typing on a screen. Now, I type fast, but I also make many mistakes and typos and I made too many mistakes while recording. (Performance art is hard. Who knew?) The software engineer's credo is don't do manually what you can make a computer do. And thus was born Robotonous.
Click the image below.
The code is available under the Affero GNU GPL v3.0. Share and share alike.