Enhance SandwichReminder-AutoOrder feature with direct checkout navigation and improved logic

- Added new configuration options for direct checkout navigation, including `useDirectCheckoutNavigation`, `checkoutPath`, and `checkoutOpenDelayMs`.
- Updated the auto-order flow to navigate directly to the checkout page, skipping the mini-cart and date/time steps.
- Improved keyboard automation logic for item remark and order confirmation processes.
- Removed the old SandwichAutoOrder.ps1 file as its functionality has been integrated into SandwichReminder-AutoOrder.ps1.
- Introduced a new runner-launcher.vbs to start the runner.ps1 without a visible console window, ensuring WinForms dialogs can appear.
- Implemented a mutex mechanism in runner.ps1 to prevent concurrent execution of the same feature.
This commit is contained in:
Arne Moerman
2026-05-11 13:59:22 +02:00
parent 2592c0145f
commit 6c10d359d2
7 changed files with 525 additions and 205 deletions
+7 -8
View File
@@ -38,12 +38,11 @@ ArnePowershellAutomation/
│ ├── NetworkUtils.ps1 # DNS suffix detection
│ ├── ToastHelper.ps1 # Windows 11 toast notifications
│ ├── PromptHelper.ps1 # Multi-choice dialog boxes (up to 4 buttons)
│ └── SandwichAutoOrder.ps1 # Browser keyboard automation for sandwich auto-order
├── features/ # Automation feature modules
│ ├── DynamicLock.ps1 # Toggle Dynamic Lock on network presence
│ ├── DefaultBrowser.ps1 # Monitor default browser setting
│ ├── SandwichReminder.ps1 # Time-based reminder with snooze options
│ └── SandwichReminder-AutoOrder.ps1 # Personal browser automation for sandwich ordering
│ └── SandwichReminder-AutoOrder.ps1 # Personal browser automation for sandwich ordering (self-contained flow)
└── data/
├── config.json # Feature toggles & settings (auto-seeded)
├── state/
@@ -140,12 +139,12 @@ Shows a reminder dialog at a specific time on a specific network with snooze opt
### SandwichReminder-AutoOrder
Personal browser automation feature that drives the sandwich ordering website via keyboard navigation.
- **Settings**: Base URL, item ID, browser window title hint, tab counts for each navigation step, delays, calibration mode
- **Logic**: Opens the item modal URL, brings the browser window to the foreground (with retry), then sends keyboard inputs to: toggle option checkboxes → click add-to-cart → refresh page → tab to mini-cart → open cart → tab to confirm order button → open delivery popup
- **Logic**: Opens the item modal URL, brings the browser window to the foreground (with retry), then sends keyboard inputs to: toggle option checkboxes → click add-to-cart → navigate directly to `/checkout` → fill remarks → confirm order → confirm default payment option
- **Key settings**:
- `tabsToOption1` / `tabsBetweenOptions` / `tabsToAddButton`: navigation within item modal
- `refreshBeforeCart`: send F5 after add-to-cart to reset focus to a known page position
- `tabsToCartButton` / `tabsToConfirmButton`: navigation after refresh
- `calibrationOnly` + `calibrationTabs`: safe mode to manually count tab stops without clicking
- `tabsToOption1` / `tabsBetweenOptions` / `tabsToAddButton`: navigation within item modal
- `useDirectCheckoutNavigation` + `checkoutPath`: skip mini-cart/date-time by opening checkout directly
- `tabsToItemRemarkButton` / `tabsToOrderRemarkInput` / `tabsToFinalConfirmButton` / `tabsToPaymentOption`: navigation on checkout and payment screens
- `calibrationOnly` + `calibrationTabs`: safe mode to manually count tab stops without clicking
- **Note**: Uses WScript.Shell SendKeys (best-effort); relies on stable tab order in the target website
## Usage Guide
@@ -190,7 +189,7 @@ When you select a feature for configuration, you'll be prompted for each setting
- **Windows 11 Only for Toasts**: Toast notifications require WinRT (Windows 10+), but full Windows 11 support is assumed. Win10 may work but is untested.
- **Scheduled Task Security**: The runner task executes as the current user with Limited RunLevel (no elevation). Features cannot perform system-wide administrative tasks; they're limited to user-level operations.
- **DNS Suffix Matching**: Network detection relies on `Get-DnsClient` adapter DNS suffix. Make sure your network adapter is configured with the correct suffix for accurate detection.
- **Manual Execution & Repetition Timer**: Executing the runner manually via menu option 5 ("Execute runner now") runs the task immediately but does **not** start the 2-minute repetition timer. The repetition timer only activates on logon/restart. For continuous testing, you may need to restart or wait for next logon.
- **Manual Execution & Repetition Timer**: Executing the runner manually via menu option 5 ("Execute runner now") launches the runner directly via a hidden launcher and does **not** start the 2-minute repetition timer. The repetition timer only activates on logon/restart.
## Extending with New Features