The Automation and Remote Control (henceforth ARC) app allows an Android device to send various configurable commands to a PC.
For example,
if the user needs to type the same text again and again, such as the date, or a company name, or an address,
ARC can be programmed with a macro to automate this. Likewise, if
the user frequently has to manipulate applications such as spreadsheets or calendars
in a repetitive fashion, these tasks can be reduced to a single button click.

At first, the app and console will not be able to communicate, and the console will inform
you of this with a message similar to the "No connection" error displayed here:

In this case, the Android app needs to connect using the IP 192.168.137.1.
The App can find this by using the
"Auto Scan for Server" button
or, if that doesn't succeed, by the user manually typing it into the app's "Change IP Manually" textbox. The
password and port can generally be ignored. See Advanced for more information.

Console Instructions

Basic Setup

The user may change the number of buttons and their colors as follows:

Number of Buttons

The number of buttons may be changed using the dropdown list labeled "Total Items". The default is
two.

Automatic Button Colors

Various automatic color schemes are available in the dropdown list labeled "Auto Colors".
The default is "Random".

Manual Button Colors

When a button is clicked, the other buttons will turn dark and the configuration options for
the selected button appear. After pressing the "Advanced" button, the color, size, and position
of the button can be set.

Macros

Basic Macros

Basic macros allow the user to type numerous keystrokes with a single keystroke. A typical use would be
an address, a company name, the current date, or anything else that needs to be frequently typed. An example follows:

1. To set up a macro, click on the desired button. In the above picture, the top button has been selected.
2. Select "Macro" from the "Type" dropdown box.
3. Enter the desired text.
4. If desired, click "New" to add another Macro for the same button. These can be selected on
the Android device by dragging the button.

Simple Key Bindings

In addition to normal text sequences, a number of special tags may be used. The first set of special
keys are straightforward and correspond to keys on most keyboards.

[esc]

The escape key.

[print scrn]

The print screen key.

[pause-key]

The Pause key.

[backspace]

The Backspace key.

[enter]

The Enter key.

[newline]

The new line character. This is similar to [enter] but can
be different depending on the system.

[insert]

The Insert key.

[home]

The Home key.

[end]

The End key.

[pageup]

The Page Up key.

[pagedown]

The Page Down key.

[delete]

The Delete key.

[tab]

The Tab key.

[openbrace]

The open brace key: [

[closedbrace]

The closed brace key: ]

[colon]

The colon key. This may be needed in rare cases,
as the [skip-to] tags require the use of the actual colon character on labels.

[f1]

,

[f2]

,

[f3]

, etc, through

[f24]

The function keys, F1 through F24.

Advanced Keyboard Controls

In addition to normal text sequences, a number of special tags may be used. The first set of special
keys are straightforward and correspond to keys on most keyboards.

[ctrl]

,

[alt]

, and

[windows]

Simulate the respective "ctrl", "alt", and "windows" keys. They each work in the same manner. For example, to simulate ctrl-v enter:

[ctrl]v[-ctrl]

[shift]

Simulates the "shift" key. While this can be used to capitalize a sequence of letters:

[shift]this will be written in capital letters[-shift]

...it is more typically used in combination with other keys. For example, this will open the
Windows task manager (ctrl-shift-esc):

[ctrl][shift][esc][-shift][-ctrl]

[cursor]

Moves the cursor, thus simulating the arrow keys. The following command will move the cursor
5 times to the right, 2 times up, 2 times down, and 3 times to the left.

[cursor]right 5, up 2, down 2, left 3[-cursor]

[keypress] and [keyunpress]

The [keypress] tag simulates holding down the specified keys, while [keyunpress] releases the same.
Notice that there is a 10 second shutoff for [keypress] to prevent accidentally locking up the system.
If more than 10 seconds is required, multiple instances, or the use of a [loop] tag is needed.

In the following example, the letters "abc" are repeated over and over for two seconds. There is no guarantee regarding
the order of the letters.

The number of milliseconds to pause before each keystroke occurs. This does not apply to [keypress].
In the following example, the characters "1234567890" will take a total of five seconds to
be typed.

[typingdelay]500[-typingdelay]
1234567890

Mouse Controls

[leftclick], [rightclick], [middleclick]

Full clicks of the corresponding mouse buttons.

[leftdown], [rightdown], [middledown]

The press (without release) of the corresponding mouse buttons.

[leftup], [rightup], [middleup]

The release of the corresponding mouse buttons.

[mouse]

Controls the mouse pointer. It can be used to move the pointer to
a particular part of the screen, using either percentages of the screen dimensions, or pixels. The
following will move the pointer to the middle of the screen:

[mouse]move-to 50%/50%[-mouse]

The following will move the mouse pointer to the position 200 pixels from the left of the screen, and 25 pixels from the top:

[mouse]move-to 200px/25px[-mouse]

The mouse tag can also move the pointer to a position relative to its current position. The following
command will move 25 pixels to the right, then 25 pixels toward the bottom.

[mouse]move 25px/0px, move 0px/25px[-mouse]

To perform delays after each move, use the following format. In this example the mouse will move,
then pause 1000 milliseconds.

[mouse]move-delay-1000 155px/25px[-mouse]

The mouse tag can also be used to perform clicks, presses, and releases, thereby facilitating drags
and highlighting. The following performs all of the available button functions, with "l", "m", and
"r" corresponding to the left, middle, and right buttons; and "c", "d", and "u" corresponding to
clicking, pressing down, and releasing.

[mouse]lc,ld,lu,mc,md,mu,rc,rd,ru[-mouse]

[mousedelay]

This defines the default pause after each mouse move. Use of the "mouse-delay-1000" format will
override this. In the following example, the first two moves will pause 1000 milliseconds, and
the third move will not pause at all.

Alters the x/y coordinates given to the [mouse] tag. In the following example, the
[mouse] tag will move to the 300px/450px position, since x and y are being incremented by 200 and 300
respectively.

[mousedelta]200/300[-mousedelta]
[mouse]move-to 100px/150px[-mouse]

Miscellaneous

[date]

Outputs the current date. A date similar in format to 2018-11-20 24-29-58 will be outputted with the default command:

[date][-date]

The custom format specifications can be found online.
As an example, the following will output a date similar to Nov 20, 2018:

[date]MMM dd, yyyy[-date]

[setdate]

Overrides the system clock. (Note that it does not set the system clock.) The date formats in the following
example are acceptable. The last is the number of milliseconds from January 1, 1970, 00:00:00 GMT.

Runs a command as if from the command prompt. The following example will copy a file.

[command]copy c:\temp\source.txt c:\temp\dest.txt[-command]

[popup-message]

Pops up a message.

[popup-message]Hello![-popup-message]

[beep]

Performs the system beep.

[onexit]

Designates the enclosed text to be run when the macro finishes. This will run even
when an error occurs, or when the [stop] tag is used.

[onexit]
[popup-message] Finished! [-popup-message]
[-onexit]

App Behavior Commands

[ignorenewlines]

This will ignore the line breaks in subsequent text. This is important when the associated macro is
intended for automation rather than outputting blocks of text. The following example will write
the date three times with newlines following each instance, and then three times on the same line.

Defines the directory for all [load] tags. The following example works exactly as the previous. Notice
that if this is not defined, or if the file is not otherwise found, the application will also
attempt to find any [load] tag's file by looking in the directory of the configuration file.

Causes a delay for a specified number of milliseconds. The following will output the word
'start', then pause for 2.5 seconds, then output the word 'end':

start [delay]2500[-delay] end

[cursordelay]

For any subsequent [cursor] commands, [cursordelay] will pause a given number of milliseconds for
each cursor movement. In the following example, the cursor will move right five times, then left
two times, and take seven seconds to complete.

[cursordelay]1000[-cursordelay]
[cursor]right 5, left 2[-cursor]

[tagdelay]

After any tag is executed, this will pause for a given number of milliseconds. The following will
take four seconds to execute.

The default button contains the text from the configuration. Using the [title] tag, the button
can contain custom text. The following example will override the text to "Restart Server".

[title]Restart Server[-title]

[exit]

Stops execution of the macro. In the following example only "First Line" is outputted.

First Line
[exit]
Third Line

[prompt-pause]

Makes a popup and pauses execution until the user presses the "Okay" button.

[stop]

Stops the currently running macro. This contrasts to [exit] in that it causes a different
macro to stop. If a configuration has one or more long-running macros, it is a good idea for one
of the buttons to consist only of a [stop], so that any process that goes awry can be forced to quit.
It cannot be used with any other characters preceding it.

[pause]

Pauses the current running macro.

[unpause]

Unpauses the current paused macro. It cannot be used with any other characters preceding it.

[pause/unpause]

Pauses the current running macro, and then unpauses it on a second press. It cannot be used with any other characters preceding it.

[disable]

Disables the given tag. In the following example, the user sees the first popup, but not the second.

[prompt-pause]
[disable][prompt-pause][-disable]
[prompt-pause]

[enable]

Enables the given tag. In the following example, the user will see both the first and second popups.

Sets the destination of output to a file, or to the keyboard. Keyboard is the default setting.

In the first example,
all of the output will go to the file "c:\data\output.txt". Note that in this example, the file
will be cleared prior to being written to. In the second, the output will
be appended instead. In the third example, the default keyboard output will be resumed after writing to the file.

[target]file,c:\data\output.txt[-target]
This will be written to a file.

[target]file,append,c:\data\output.txt[-target]
This will be appended to a file.

[target]file,c:\data\output.txt[-target]
This will be written to a file.
[target]keyboard[-target]
This will be shown on the screen, as usual.

[multiclick]

Defines how the app behaves when a button is clicked while already running. The options are as follows:

ignore

, which disregards any clicks while running; and

consecutive

, as in the example, which queues multiple clicks to run one after the other.
Consecutive is the default.

[multiclick]consecutive[-multiclick]

[tags-with-newlines]

This defines which tags will be followed by a newline, when they are followed by a new line in
the macro. By default, only [date] and [varout] are
configured this way. The following example is equivilent to the default setting:

[tags-with-newlines]date,varout[-tags-with-newlines]

[id]

Sets the ID of the tag. This is used mainly with the [page] tag. It can be any text.

[id]Button #1[-id]

[page]

Moves the given buttons a given number of pages. The following example will move all buttons
that have multiple pages 1.

[page]button=all,delta=1[-page]

The second example will move the button with the id "Button #1" back a single page. In addition,
the "flip" variable is set to false. This will prevent, for example, a button going from page
1 to page 3 (out of three). The default setting of "flip" is true.

[page]button=Button #1,delta=-1,flip=false[-page]

The last example sets the button to a specific page.

[page]button=Button #1,set=2[-page]

Note that when a macro uses a [page] tag, no other functionality can be used with it.

Loops, Controls, and Variables

These tags provide some programming-like features. Notice that advanced users may prefer
the Java Integration features instead.

[loop]

Repeats a sequence of text a specified number of times. If a zero (0) is indicated,
the loop will run infinitely, until an error occurs or [stop] command is sent. For example, the following will output

The word 'repeated' is repeatedrepeatedrepeated three times

:

The word 'repeated' is [loop] 3 repeated[-loop] three times

[loopdelay]

For any subsequent [loop] commands, [loopdelay] will pause a given number of milliseconds each iteration.
The following example will take five seconds to complete.

[loopdelay]1000[-loopdelay]
[loop] 5
Hello!
[-loop]

[skip-to] and [label]

The [skip-to] tag moves the process to wherever the specified label is located.

[skip-to]the-end[-skip-to]
This line is NOT written.
[label]the-end[-label]
This line IS written.

[options]

Prompts the with a number of options. The options are defined with a word or phrase that end in a colon.
The text that follows the selected option is then processed. The option window can be configured with
the following special option:

pre:

This is text that is processed for every subsequent option before any of
that option's specific text.

post:

This is text that is processed for every subsequent option after any of
that option's specific text.

always-on-top:

This forces the window to be on top of any others.

position:

This sets the position of the window. The default is in the
middle of the screen.

disable-hot-keys:

This disables the hotkeys (F1, F2, etc).

The following example shows several options as well as several configuration options.

[options]
pre:
This text will be written first.

post:
This text will be written last.

position:
100/200

Write The Date:
[date][-date]

Run Test One:
[skip-to]test-one[-skip-to]

Run Test Two:
[skip-to]test-two[-skip-to]

Exit Application:
[exit]

[-options]

[varset]

Sets a variable. The name of the variable must begin with a letter or underscore, and
the rest of the variable must consist of letters, numbers, or underscores. In the following
example, the variable "Name" is set to "Value".

[varset]Name,Value[-varset]

[varset-if-empty]

Works just as [varset] but only actually sets the variable if it hasn't been already. This
is typically used when a variable is expected to be set from the cache of previous processes
when that macro is run for the first time.

[varout]

Outputs a variable. In the following example, the output will be "Value".

[varset]Name,Value[-varset]
[varout]Name[-varout]

[varset-from-var]

Sets a variable to another variable. In the following example, the output is "Value".

Defines the scope of the variable. A global variable is available to all configurations. A common variable is available
to all buttons of the same configuration. A normal variable is only available to the button in which it is defined. The follow
example shows each. Note that 'normal' is the default scope.

Changes the default scope. In the following example, the default is changed to global.

[default-var-option]global[-default-var-option]

[def] and [defout]

Similar to [varset], [def] allows any text including other macros. It is not cached and so must be
defined in every macro in which it is used. It is best to keep commonly used [def] instances in a file
that can be reused by different macros with [load]. In the following example a letter template is
outputted, and the
cursor is placed in the empty body.

This allows using Java code from a macro. The user should have a basic command of
the Java programming language.

[java]

Used in a minimal way, any code between the [java] tags is inserted in the main(String args[]) method.
In the default configuration, all text that goes to System.out will be outputted as macro text. So this
example...

In the next example, a static method and class
are placed in a [body] tag. The text in the [main] tag goes to the main() method. If a [body] tag
is used, the [main] tag must also be used. The resulting output will be "Here's my new object: Hello World!".

The variables defined with the [varset] tag are automatically integrated into all generated Java code. Setters and getters
are created and any changes to the associated variables will be preserved once the [java] tag process finishes. In the following example,
the variable "var1" is defined, then changed. The output from this example is:

Here's my new object: Hello World!
Goodbye World!

In addition, the [settings] tag allows configuring the process in various ways. If a [settings] tag
is used, a [main] tag is required. In this example the
"showcode" setting is changed to "true" which will popup the generated Java code for debugging purposes.
The "showerrors" setting is also changed to "true" which will popup any data sent to the System.err PrintStream.
Also included is the "fastmode" setting. In the default compilation process, two variables, "line" and "loop"
are set by default. These simply indicate the line of the [java] tag and the progress of any ongoing
loops. In "fastmode", these variables are omitted, allowing a better chance that re-compilation won't
be necessary.

Additional settings include 'runmacro' which by default is set to true. Turning this to false allows
testing compilation or other issues without the risk of running the actual macro. The 'template' setting
will be covered in the next section.

In addition, the [import] tag may be used to include standard Java import statements. If
an [import] tag is used, the [main] tag is required.

Also note that numbers
work as expected. All numbers formatted with a decimal point become Double objects, with all others becoming
Long objects.

If the template setting is used, as in the previous example, the file it points to will override the internal template used to
generate code. The internal template is as follows, and the basic structure of any overriding template must be the
same.

_IMPORT

public class _CLASS
{
_BODY
_VARIABLES

public static void main(String args[])
{
_MAIN
_END
}
}

Known Issues

Notice that when the source code is generated, variables that are otherwise valid can cause
compilation errors due the creation of identical getters and setters. The following
example will fail as two instances of "setKey" and "getKey" will exist.

[varset]key,val1[-varset]
[varset]Key,val2[-varset]

[java]
System.out.println("Hello World!");
[-java]

Screenshots

[screenshots]

This allows configuring the app to take screenshots automatically at specified tags.
In this example, tags generate screenshots while blank lines and [mouse] movements do not. The
delay of 200 milliseconds occurs after the event and before the screenshot is taken.

Sets the location in which the screenshot files will be saved. If this is not set, the
directory of the configuration is used. This tag isn't necessary if a directory is
set by [screenshots]. In the following example, the directory is
set to c:\screenshots

[screenshot-directory]c:\screenshots[-screenshot-directory]

[screenshot]

Takes a single screenshot.

[screenshots-webpage]

This creates a webpage using the previously generated screenshots. The webpages can
be observed without a server or additional tools. The following simple example creates
a webpage with images scaled to 800/600, and can be seen here. Press
"next" or "previous" to see the steps of the script. The
optional browser parameter automatically loads the webpage.

This will take a screenshot when a key or mouse event is detected. In the following example, screenshots
will be taken infinitely, until a [stop] command is sent from another button, after which a website
of all the images will be created.

Shortcuts are various pre-set macros that perform common functions, such as Navigating back
in a web browser, showing the desktop, bringing the mouse to the center of the screen, etc.

Application Launching

Application Launching runs an executable or batch file in the normal manner. Many common
applications are included, such as Firefox, Chrome, notepad, etc. Notice that the supplied
directories and filenames are typical defaults, and don't necessarily correspond to every system.

Mouse by Remote Control

This allows using your device as a touchpad. It can be configured to disable clicking, and
to multiply the movement speed.

Saving And Uploading

An uploaded configuration must correspond to a configuration on your PC. By pressing the
"Save and Upload" button, the Console will automatically update the saved copy of your configuration,
or ask you to give it a name if you haven't done so. In addition, the "Save" button will save
your configuration without uploading it.

Advanced

As seen in the initial screenshots of the console and app,
the user can optionally set a password and a port. The port should not be changed unless another
application requires the default (15222). In any case, the port and password of the console must
match those of the app. If the port is changed, the app and console must
be completely restarted.