Files
Start-PTW-Auto-Disconnect/README.md
T

81 lines
3.4 KiB
Markdown

# PTW Auto-Disconnect
Standalone desktop app that monitors your PTW sessions page and automatically disconnects sessions matching certain product/feature keywords. Runs in a small window **without opening Chrome**.
## Features
- **Auto-disconnect** — When Monitor is ON, scans the sessions table and clicks Disconnect on **PTW70** product rows whose **Feature** matches the configured list (or modules 19 / 9).
- **Logged in** — Left panel shows who is logged in, grouped by user, with product/feature per session.
- **Activity log** — Right panel shows timestamps and disconnect/refresh events.
- **Config on startup** — On launch, checks `http://localhost:1947/_int_/config.html` and ensures **Table Rows per Page** is set to **100** (and submits if changed).
- **Stay awake** — While the app is running, prevents Windows from sleeping and the display from turning off.
- **One-click run** — Double-click **Start PTW Auto-Disconnect.vbs** (or the built exe) to run without opening a terminal.
## Target keywords (disconnect when present)
Applies only when **Product** contains **`PTW70`** (e.g. `1 PTW70`). Matching uses the **Feature** column only (substring for the list below; exact cell for modules 19 and 9).
- PTW_DATAEXCHANGE
- PTW_ARC_FLASH
- PTW_DEVEVAL
- PTW_AFAULT
- PTW_DAPPER
- PTW_COOREVAL
- PTW_CAPTOR
- PTW_IEC_FAULT
- PTW_IEC61363
**Modules 19 and 9:** Same **PTW70** product line; **Feature** equals exactly `19` or `9`.
## Requirements
- **To run from source:** Node.js (LTS) and `npm install`.
- **Sessions server:** The app expects the sessions page at `http://localhost:1947/_int_/sessions.html` (and config at `http://localhost:1947/_int_/config.html`). Start your server first.
## Run from source
```bash
npm install
npm start
```
Or double-click **Start PTW Auto-Disconnect.vbs** (no terminal window).
## Build executables
```bash
npm run dist
```
Output in **`dist`**:
| Output | Description |
|--------|-------------|
| **PTW Auto-Disconnect Setup 2.2.0.exe** | Windows installer |
| **PTW Auto-Disconnect 2.2.0.exe** | Portable single exe (no install) |
| **win-unpacked/** | No-install folder; run **PTW Auto-Disconnect.exe** from inside (avoids ffmpeg path issues on some systems) |
Optional: build and create a zip of the no-install folder:
```bash
npm run dist:portable
```
Then use **`dist\PTW Auto-Disconnect-no-install.zip`** — unzip anywhere and run the exe from the extracted folder.
## Running on a new PC
- **From source:** Install Node.js, copy the project, run `npm install`, then `npm start` or the VBS launcher.
- **Built exe/installer:** Copy the installer or the **win-unpacked** folder (or the portable exe). No Node.js required.
## Behavior summary
- **Monitor ON/OFF** — Toggle monitoring; when ON, the sessions page is reloaded every 60 seconds and matching rows are disconnected.
- **Clear** — Clears the activity log display (persisted logs are cleared).
- **Config check** — On startup the app loads the config page, sets rows per page to 100 if needed, submits, then opens the sessions page. The activity log shows: *Config: rows per page already 100* or *Config: rows per page set to 100* (or a message if the input was not found).
- The sessions page is loaded in a hidden webview; only the compact GUI (panels + buttons) is visible.
## License
See [LICENSE](LICENSE).