My employer is financial institution, therefore a lot of securities were imposed on laptop. Although the laptop could have restricted access to internet, but any download will be blocked. Setting was made so that the laptop will be lock after few minutes, good when in office, but a hassle when working from home. Since download was blocked, so anti-idle application could not be downloaded and used.
Therefore, the app was born, so that I could make a coffee with ease of mind.
mouse-automove is a simple Java application that uses Java AWT Robot API to move the mouse pointer.
- Pure Java 8 SDK only, without any other 3rd party API library.
- Shutdown hook to close the timer properly with its queued task.
- Pause / resume the timer with 'p' keyboard input.
- Exit the application 'e' keyboard input.
- Randomize the interval in seconds for each mouse pointer movement, between 15 seconds to 60 seconds.
- Currently, three types of mouse pointer movement set:
- Mouse pointer moved to random point on screen.
- Mouse pointer moved at edge of screen.
- Mouse pointer moved in circular motion from middle point of screen.
- Mouse pointer move randomly:
- Mouse pointer move on edge:
- Mouse pointer move in circular motion:
- Move mouse pointer from current position to the middle of screen.
- Radius of circle is calculated based on screen height and width.
- Move to 0o along positive x-axis, based on radius.
- Move in full circular motion from 0o until 360o.
- Random number of circular round, between 1 and 3.
- Return to middle of screen and back to original mouse pointer position when finished.
Significant Java SDK API that was used:
- Robot - Component that allow automatic mouse movement, provided with specific coordinate.
- Timer - Background object to execute mouse move task in random intervals.
- TimerTask - Runnable task to execute a set of mouse movement.
- Point - Coordinate representation for where mouse would be moved.
- Dimension - Height and width representation for screen resolution size.
- SecureRandom - Random number generator for randomization feature.
- GraphicsDevice - Provider for default screen resolution size.
- GraphicsEnvironment - Provider for default screen used.
- MouseInfo - Provider for current mouse pointer location.
Script folder was provided with batch/shell scripts to compile and run.
- compile.sh / compile.bat: Perform compilation on java class and package class and manifest into jar file
- run.sh / run.bat: Execute jar file
./script/compile.bat
./script/compile.sh
./script/run.bat
./script/run.sh
During application started:
- Type 'p' in console and press 'Enter' to pause or resume.
- Type 'e' in console and press 'Enter' to exit.
Next plan:
- Create configurable properties for number of intervals, random step, and rounds for edge and circular movement.
Pull request are welcome. Do contact me to learn more.
MIT
- Feel free to use the codes and logics for whatever usage.