This bot is a Node.js-based automation tool that randomly switches between application windows using keyboard shortcuts like Alt+Tab
and Ctrl+Tab
and simulates scrolling actions (scroll up
and scroll down
). It simulates natural, human-like delays and works within a specified time duration.
- Randomly switches between the first 10 applications using
Alt+Tab
. - Simulates
Ctrl+Tab
for variety. - Includes scrolling events (
scroll up
andscroll down
) for more natural behavior. - User-defined automation duration (in minutes).
- Logs all actions with time intervals for monitoring.
- Uses keyboard-based automation without mouse click interactions.
You need to install Node.js to run the script.
- Visit the Node.js official website.
- Download the LTS version for your operating system.
- Run the installer and follow the instructions.
- After installation, verify Node.js is installed by running the following commands in the terminal:
These commands should print the installed versions of Node.js and npm (Node Package Manager).
node -v npm -v
If you're on Windows, some dependencies (like robotjs
) require native compilation. Install Visual Studio Build Tools:
- Download the Visual Studio Build Tools.
- During installation, select:
- Desktop development with C++
- MSVC v142 - VS 2019 C++ x64/x86 build tools
- Windows 10 SDK
- Restart your computer after installation.
-
Clone this repository or download the files:
git clone https://github.com/alwaysfriend494/automation-time-tracking-bot.git cd automation-time-tracking-bot
-
Install dependencies:
npm install
-
(Optional) If you encounter issues with
robotjs
installation, make sure:- You have Python installed and in your system's PATH.
- Run this to rebuild
robotjs
:npm rebuild robotjs
-
Start the script:
node automation.js
-
Enter the total time for automation when prompted (in minutes):
Enter the total time for automation (in minutes): 10
-
The script will:
- Randomly switch between 10 applications using
Alt+Tab
. - Occasionally use
Ctrl+Tab
. - Simulate scrolling up and scrolling down for variety.
- Simulate human-like delays between actions.
- Log all actions and the time intervals in the terminal.
- Randomly switch between 10 applications using
-
Once the specified time is completed, the script will exit automatically:
Automation completed for 10 minutes.
If you want to create a standalone .exe
file for deployment:
-
Install the
pkg
tool globally:npm install -g pkg
-
Package the script into an executable:
pkg automation.js --targets node16-win-x64 --output automation.exe
-
Share the
automation.exe
file with others. They can run it directly without needing Node.js installed.
For a 10-minute session, the terminal output might look like this:
Enter the total time for automation (in minutes): 10
Automation will run for 10 minutes.
Switching to application #3 using Alt+Tab
Next action in 19 seconds
Simulating Ctrl+Tab
Next action in 14 seconds
Simulating scroll down
Next action in 20 seconds
Switching to application #5 using Alt+Tab
Next action in 18 seconds
Simulating scroll up
Next action in 22 seconds
Switching to application #2 using Alt+Tab
Next action in 18 seconds
Automation completed for 10 minutes.
-
robotjs
Fails to Install:- Make sure Visual Studio Build Tools are installed.
- Ensure Python is installed and available in your PATH.
- Rebuild
robotjs
manually:npm rebuild robotjs
-
pkg
Errors While Creating Executable:- Use Node.js version 16 or 18 (as newer versions may not be supported by
pkg
). - Specify the correct target platform (
node16-win-x64
for Windows).
- Use Node.js version 16 or 18 (as newer versions may not be supported by
-
Script Doesn't Switch Applications or Scroll:
- Ensure multiple application windows are open before running the script.
- Applications should be arranged in the
Alt+Tab
list.
-
Script Fails to Scroll:
- Ensure you are testing the script on a scrollable page or application. Scrolling actions may not visibly work in certain environments.
- robotjs: Library for simulating keyboard and mouse events.
- pkg: Tool for packaging Node.js applications into executables.
"# automation-time-tracking-bot"