pub enum Step {
Click {
target: String,
},
DoubleClick {
target: String,
},
Type {
text: String,
},
Key {
chord: String,
},
Drag {
from: String,
to: String,
},
Scroll {
target: String,
amount: i32,
axis: Axis,
},
Verify {
target: String,
},
WaitFor {
target: String,
},
WaitGone {
target: String,
},
Changed {
target: String,
tolerance: f64,
},
Pause {
ms: u64,
},
}Expand description
What a step does.
PartialEq but not Eq: changed’s tolerance is a percentage, and a
float has no total equality. Nothing keys a map on a step, so the
weaker bound costs nothing.
Variants§
Click
Click the resolved point of a labeled region.
DoubleClick
Double-click the resolved point of a labeled region.
Type
Type literal text through the platform’s Unicode path — layout
independent, and unable to express shortcuts (use key).
Key
Press a chord of physical keys, e.g. cmd+s.
Drag
Press at one region’s point, move, release at another’s.
Scroll
Hover a region and turn the wheel over it.
target picks what to scroll — a wheel event goes to whatever
is under the cursor — and resolves exactly like a click’s does.
amount is the one quantity in this tool that is not
exact: it counts 15° wheel clicks, and how far that moves depends
on the reader’s own OS scroll-speed setting. Scroll until
something is visible (wait_for), never a fixed distance.
Verify
Confirm a labeled region still matches its saved crop.
WaitFor
Poll until a labeled region matches its saved crop again, or the timeout expires. The honest alternative to guessing with a sleep: the OS accepts an event long before an app finishes reacting.
WaitGone
Poll until a labeled region STOPS matching — “wait until this spinner goes away”, “wait until the button changes state”.
Changed
Confirm a labeled region changed — the assertion that proves an action did something, rather than that it was accepted.
verify is the opposite question and answers it with normalized
correlation, which is brightness- and contrast-blind: a region that
dims uniformly behind a modal still scores ~1.0. This compares RGB
directly, so it sees what correlation cannot.
tolerance is the percentage of the region’s masked pixels that
must differ before it counts as changed. Zero — any pixel — is the
default and the right one for “did anything happen at all”: if the
action did nothing, nothing differs. Raise it when something
unrelated lives in the region; a text caret blinking inside one is
enough to register on its own.
Pause
Wait a fixed duration. Present because some waits genuinely have no observable, and pretending otherwise would push people to sleep-and-hope outside the tool.
Implementations§
Source§impl Step
impl Step
Sourcepub fn targets(&self) -> Vec<&str>
pub fn targets(&self) -> Vec<&str>
Every session label this step needs. Resolution fails before any action runs when one is missing.
Sourcepub fn injects(&self) -> bool
pub fn injects(&self) -> bool
Whether this step posts input, as opposed to only looking at the screen.
The distinction decides which regions must be present before a
run starts. Acting on a region whose position cannot be trusted
clicks an unknown thing; looking for one that is absent is the
entire job of wait_for.