Window Anchors
Window Anchors
Section titled “Window Anchors”A Window Anchor is an action ClicKey inserts automatically before clicks and scrolls to record which window the input was meant for. Anchors are what make a macro robust – they let playback find the correct window even if it has moved, changed size, or sits on another monitor.
Overview
Section titled “Overview”When you record, ClicKey watches the window you are working in. As soon as it changes – a different app, a different window of the same app, the desktop, or even just the same window after it’s been resized – ClicKey inserts a Window Anchor action right before your next action. The anchor stores:
- The owning app’s name
- The window title at the time
- The window’s position and size (frame)
- Which monitor it was on
- A flag for input that landed on the empty desktop
At playback time the Pre-Playback Window Check uses these anchors to confirm every needed window is open and reachable. If a window has moved monitors, ClicKey translates the recorded frame into the new monitor automatically. If it’s on a different Space, ClicKey will switch to it.
Anchors are inserted only when the window context changes. A click followed by ten more clicks in the same window only needs one anchor – the others inherit it.
A Scroll is anchored by exactly the same rule, using the window the gesture started over. Since scrolling is delivered to whatever sits under the pointer, that anchor is what lets playback bring the right window forward first and follow it if it has moved since recording. Scroll after clicking in the same window and no second anchor appears – the scroll inherits the click’s.
How to use
Section titled “How to use”You usually don’t add Window Anchors by hand – recording does it for you, and so does + Add Action: Mouse Clicks, Mouse Drags, Scrolls, and Find actions automatically get an anchor in front of them when their window differs from the last anchor.
No anchor is added for:
- Actions set to Relative to cursor position
- Scrolls with no captured position
But you can:
- Edit a recorded anchor. Double-click it in the action list to change the app, title, frame, or display, or to mark it as “Excluded from the pre-playback check.”
- The window dropdown’s first entry is Desktop / No window. Choose it for clicks that aren’t tied to any window – the desktop, Dock, or menu bar; playback then uses absolute screen coordinates and skips the window check for the following actions. Recording picks this automatically for such clicks.
- Add one manually. Use + Add Action → Window Anchor to insert one. Useful when you build a macro by hand, or when an app’s window title has changed.
- Delete an anchor. Subsequent actions are then mapped to the previous anchor.
How matching works at playback
Section titled “How matching works at playback”The Pre-Playback Window Check tries to match each anchor against the currently running windows. In rough order:
- App match – finds running windows of the same app.
- Title match – prefers a window whose title matches the recorded one.
- Frame match – falls back to position/size similarity.
- Display match – if your monitor layout changed, the recorded frame is translated into the equivalent rectangle on the new display.
- Cross-Space resolution – if the window is on another Mission Control Space, ClicKey will also find it. See Cross-Space Window Targeting.
If none of that finds a match, the check shows the anchor as Not Found and lets you pick a replacement window from the running windows list (with an optional Match pos & size checkbox to also move and resize it to the recorded frame).
Naming a window by hand
Section titled “Naming a window by hand”The window picker in the anchor editor lists windows that are open right now, which leaves two things impossible: anchoring a window that a later step will open, and anchoring one whose title changes between runs.
Choose Enter name manually… from the picker and type the name instead. It is matched against exactly what the picker shows – App – Window title:
| You type | Matches |
|---|---|
Mail | only a window called exactly that |
Mail – Inbox (*) | Mail – Inbox (17), Mail – Inbox (3) |
Invoice * – Acme | any Acme invoice window, and nothing from another client |
* – Excel | any Excel window |
{customer} – Excel | the window for whatever the variable currently holds |
* stands for any number of characters, and it is the only wildcard. Everything outside a * has to match, at both ends – Mail does not match Mail – Inbox.
{variable} references are resolved before matching, so one anchor can target a different window on every pass of a loop.
A name without variables is checked before the run. The pre-playback window check counts the windows the name matches:
| Before the run the name fits | What the check shows |
|---|---|
| exactly one window | nothing – the anchor is settled and the run starts as usual |
| several windows | a Multiple Matches card with a picker holding exactly those windows, the best-ranked one preselected |
| no window | a Window not open card with a picker holding every open window, so you can point this one run somewhere else without editing the macro |
Go to window on either card brings the window currently selected in the picker to the front, so you can check it is the right one before starting.
A name with a variable can only be resolved once the run reaches it, so the pre-playback check skips it entirely – the value it would test is not the value the run will use, and the check’s own remedy (“pick a window to replace”) would overwrite the name. The anchor editor shows this: Exclude from pre-playback check appears ticked and locked while a variable is in the name.
Instead ClicKey asks during playback, on screen and – if Slack is connected – in Slack, whichever answers first:
| At run time the name fits | What happens |
|---|---|
| exactly one window | it is used, nothing is asked |
| several windows | you pick from them; after 60 seconds without an answer the best-ranked one is used, so the run doesn’t get stuck |
| no window | you pick from all open windows; nothing is preselected, because none of them matched. Without an answer no window is chosen and the run carries on without this anchor |
The dialog offers the list and nothing else – there is no field to type a window name into, since only an entry from the list can resolve to a real window. Clicking a row answers immediately; Cancel stops the run.
Position and size work exactly as for a picked window: they say where the window should be, and the check moves it there before playback.
Notes & limitations
Section titled “Notes & limitations”- Anchors only auto-insert before clicks and scrolls, not before key presses. Typed input uses whichever window is currently focused on the running machine.
- Title changes that happen between record and playback can break exact matches. The resolver falls back to other heuristics, but for very dynamic titles (e.g. “Order #4839 - Form”) consider editing the anchor to a shorter substring that still uniquely identifies the window.
- The “Is desktop” flag tells playback there was no real window under the click or scroll. Anchors with this flag won’t try to bring a window forward.
- “Exclude from pre-playback check”: The anchor is still recognized during playback, but it will not block the pre-playback check if the window is missing. Use this for windows the macro opens later, because they are not expected to exist before playback starts.
- Editing an anchor after recording is safe – it doesn’t affect the clicks themselves, only how playback targets them.
Related
Section titled “Related”- What Gets Captured – everything recording captures, including the anchors.
- The Pre-Playback Window Check – the dialog that resolves anchors before a run.
- Cross-Space Window Targeting – how anchors work across Mission Control Spaces.
- Resize and Reposition Window – explicit window-management actions you can add by hand.
- Embedded Macros – how anchors behave across embedded macro boundaries.