Skip to content

Sequences 2.0: per-step actions and wait-for-image / wait-for-pixel steps #119

Closed

Description

@TMHSDigital

Why it matters

Sequences are linear and "always click" (README ~line 290). Most macro requests ("click here, type F5, wait until the Save button appears, click it") need per-step actions and waits. The engines for all of these already exist (hold, key, pixel condition, image match), so this is the highest-leverage feature: it covers most of what people want from a macro tool without a scripting language and its support and security load.

Who it's for

Users automating multi-window chores, testers, accessibility users who want one hotkey to run a routine.

Suggested approach

  • Versioned step schema: {type: click|hold|key|wait|wait_image|wait_pixel, ...}. Older sequences load as click steps.
  • Recorder keeps producing click steps; the step editor adds the other types.
  • Every wait step must honor all stop paths (stop, emergency, failsafe, limits, pause when unfocused) and have an optional timeout that ends the run with a clear reason.
  • Profiles/export carry the new schema (bump export version).
  • Write a short design note in docs/ARCHITECTURE.md first, given the stop-path table.

Done when

A design comment is agreed, then the schema, editor UI, engine support, migration tests and README section ship.

Activity

  1. added
    enhancement
    priority: medium
    feature
    on Oct 5, 2026
  2. TMHSDigital commented on Oct 6, 2026

    @TMHSDigital
    OwnerAuthor

    Design proposal

    Step schema (backward compatible)

    Each step gets an optional type; a step without one is a click, so every saved sequence, profile and export keeps loading unchanged.

    type Fields Does
    click (default) x, y, button, click_type, delay_ms As today
    hold x, y, button, hold_ms, delay_ms Press, hold, release (always released on every stop path)
    key key, delay_ms Press a key or combo into the window in front
    wait_image embedded image (same storage as image targets), image_region, image_tolerance, timeout_ms, on_timeout, delay_ms Wait until the image is on screen; optionally click it (click: true)
    wait_pixel x, y, color, tolerance, timeout_ms, on_timeout, delay_ms Wait until the pixel matches

    on_timeout is stop (end the run with a clear reason) or skip (go on to the next step). timeout_ms 0 means wait until stopped.

    Engine

    • _perform_sequence dispatches on type. Click, hold and key reuse _perform_click (spread and the failsafe corner check apply as today).
    • Wait steps poll every 100 ms with _stop_event.wait. Before each poll they re-check stop requests, click and time limits, pause when unfocused and the failsafe, so every stop path in the ARCHITECTURE table still holds mid-wait. Image waits grab their own region on the click thread (about 17 ms each since Image watcher screenshots the whole virtual desktop 10 times a second #97), so no extra watcher thread per step is needed.
    • Click and time limits count click, hold and key actions; waits don't count as clicks.
    • Pause when unfocused: windows under click and hold points count as before. Key steps and waits don't add a window, so the run stays on the windows it already knows.
    • A wait that times out with stop ends the run as completed, with the message "Step 4: the image didn't appear within 10 s".

    UI

    • The step list shows the type: 3. key ctrl+s, then 500 ms.
    • Add point becomes Add... with a small menu: Click point, Hold, Key, Wait for image, Wait for pixel. Each opens a short dialog that uses the existing pickers (point picker, area capture, pixel sampler).
    • Edit... replaces Wait... and opens the dialog for the selected step.
    • Recording still produces click steps only. It never records keystrokes, as the README promises.
    • Validation reports the step: "Step 4 key: Enter a key such as F5".

    Profiles, export and CLI

    • Export format version 2: images inside wait steps are embedded as base64 PNG (image_png), as image profiles already do. Version 1 files still import.
    • No new CLI flags. --sequence and --profile run whatever the sequence holds.

    Questions to settle first

    1. Default on_timeout: stop (safer) or skip?
    2. Should wait_image be able to click the image it waited for (click: true), or should that stay a separate image-target run?
    3. Keep the 50-step cap?

    Once this is agreed, it ships in pieces with tests:

    1. The schema and engine dispatch, with migration tests.
    2. Key and hold steps.
    3. The wait steps.
    4. The dialogs.
  3. TMHSDigital commented on Nov 14, 2026

    @TMHSDigital
    OwnerAuthor

    Settling the open questions so the work can start:

    1. Default on_timeout is stop. A wait that never succeeds ends the run with a clear reason instead of carrying on blind.
    2. wait_image may click the image it waited for (click: true), since "wait until Save appears, then click it" is the most common request. It stays off by default.
    3. The 50-step cap stays.

    First piece: the step type field and engine dispatch for click, hold and key steps, with migration tests. Wait steps and the step dialogs follow.

  4. TMHSDigital commented on Nov 14, 2026

    @TMHSDigital
    OwnerAuthor

    Piece 1 is in 03a423c: steps take an optional type (click, hold or key). Old sequences load unchanged as click steps, and the engine runs each step with its own action under the existing stop paths. Verified with make check (734 passed) and the new sequence-steps UI snapshot. Next: the wait_image and wait_pixel steps, then the Add and Edit dialogs.

  5. TMHSDigital commented on Nov 14, 2026

    @TMHSDigital
    OwnerAuthor

    Piece 2 is in 547cbc7: wait_image (with an optional click on the match) and wait_pixel steps, with timeout_ms and on_timeout (stop by default, or skip). The wait re-checks stops, limits, the failsafe corner and Pause when unfocused on every poll. Verified with make check (750 passed) and the sequence-steps snapshot. Remaining: the Add and Edit dialogs, export format v2 with wait-step images embedded, the README section and the CHANGELOG entry.

  6. TMHSDigital commented on Nov 14, 2026

    @TMHSDigital
    OwnerAuthor

    Done in four commits:

    • 03a423c: step type field; click, hold and key steps in the engine
    • 547cbc7: wait_image and wait_pixel steps with timeout_ms and on_timeout
    • 9d50fda: Add... menu and per-type Edit entries in the window; README and CHANGELOG
    • 7afde44: export format version 2 with wait-step images embedded

    Verified with make check (767 passed), the sequence and sequence-steps UI snapshots, and the step menus listed in menus.txt / menus-steps.txt. The Add menu and the prompts are native popups and still need a manual look on a real desktop.

    Two follow-ups are filed separately: a wait step that clicks the image doesn't add that window for Pause when unfocused, and replaced or removed step captures are never cleaned up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfeaturepriority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions