Skip to content

MarchHare159/automation-time-tracking-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automation Time Tracking Bot

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.


Features

  • Randomly switches between the first 10 applications using Alt+Tab.
  • Simulates Ctrl+Tab for variety.
  • Includes scrolling events (scroll up and scroll 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.

Prerequisites

1. Install Node.js

You need to install Node.js to run the script.

  1. Visit the Node.js official website.
  2. Download the LTS version for your operating system.
  3. Run the installer and follow the instructions.
  4. After installation, verify Node.js is installed by running the following commands in the terminal:
    node -v
    npm -v
    These commands should print the installed versions of Node.js and npm (Node Package Manager).

2. Install Visual Studio Build Tools (for Windows)

If you're on Windows, some dependencies (like robotjs) require native compilation. Install Visual Studio Build Tools:

  1. Download the Visual Studio Build Tools.
  2. During installation, select:
    • Desktop development with C++
    • MSVC v142 - VS 2019 C++ x64/x86 build tools
    • Windows 10 SDK
  3. Restart your computer after installation.

Installation Instructions

  1. Clone this repository or download the files:

    git clone https://github.com/alwaysfriend494/automation-time-tracking-bot.git
    cd automation-time-tracking-bot
  2. Install dependencies:

    npm install
  3. (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

Usage

Running the Script

  1. Start the script:

    node automation.js
  2. Enter the total time for automation when prompted (in minutes):

    Enter the total time for automation (in minutes): 10
    
  3. 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.
  4. Once the specified time is completed, the script will exit automatically:

    Automation completed for 10 minutes.
    

Packaging the Script into an Executable (Optional)

If you want to create a standalone .exe file for deployment:

  1. Install the pkg tool globally:

    npm install -g pkg
  2. Package the script into an executable:

    pkg automation.js --targets node16-win-x64 --output automation.exe
  3. Share the automation.exe file with others. They can run it directly without needing Node.js installed.


Example Output

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.

Troubleshooting

Common Issues

  1. 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
  2. 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).
  3. 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.
  4. 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.

Dependencies

  • robotjs: Library for simulating keyboard and mouse events.
  • pkg: Tool for packaging Node.js applications into executables.

"# automation-time-tracking-bot"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published