@echo off
chcp 65001 >nul
title Activity Monitoring Script
echo Starting activity monitoring script...
echo.

REM Switch to the script directory
cd /d "%~dp0"

REM Check if Node.js is installed
node --version >nul 2>&1
if %errorlevel% neq 0 (
    echo Error: Node.js not found. Please ensure Node.js is installed and added to PATH.
    pause
    exit /b 1
)

REM Check if dependencies are installed
if not exist "node_modules" (
    echo Dependencies not found, installing...
    npm install
    if %errorlevel% neq 0 (
        echo Failed to install dependencies
        pause
        exit /b 1
    )
)

REM Run the Node.js script
echo Starting activity monitoring...
node checkActivity.js

pause