pub struct Bot {
pub window: Option<Window>,
/* private fields */
}
Expand description
The Bot
struct provides automation capabilities for interacting with a window.
Fields§
§window: Option<Window>
The Window
that the Bot
interacts with.
Implementations§
source§impl Bot
impl Bot
sourcepub fn set_window_from_name(&mut self, name: &str)
pub fn set_window_from_name(&mut self, name: &str)
Sets the window based on the specified name.
sourcepub fn set_window_from_regex(&mut self, regex: &str)
pub fn set_window_from_regex(&mut self, regex: &str)
Sets the window based on the specified regex.
sourcepub fn set_window_from_id(&mut self, id: i64)
pub fn set_window_from_id(&mut self, id: i64)
Sets the window based on the specified id.
sourcepub fn set_controller(&mut self, controller: Enigo)
pub fn set_controller(&mut self, controller: Enigo)
Sets the Enigo controller.
sourcepub fn set_high_dpi_ratio(&mut self, ratio: u32)
pub fn set_high_dpi_ratio(&mut self, ratio: u32)
Sets High DPI mode (for standard screen: 1, for Retina-like: 2).
sourcepub fn set_wait_time(&mut self, duration: Duration)
pub fn set_wait_time(&mut self, duration: Duration)
Sets the delay between mouse move and mouse down and up.
sourcepub fn set_capture_frequency(&mut self, value: f32)
pub fn set_capture_frequency(&mut self, value: f32)
Sets the number of captures per seconds.
sourcepub fn click(&mut self, relative_x: u32, relative_y: u32) -> Result<(), Error>
pub fn click(&mut self, relative_x: u32, relative_y: u32) -> Result<(), Error>
Clicks the mouse button at the specified coordinates relative to the window.
sourcepub fn mouse_down_on(
&mut self,
relative_x: u32,
relative_y: u32
) -> Result<(), Error>
pub fn mouse_down_on( &mut self, relative_x: u32, relative_y: u32 ) -> Result<(), Error>
Pushes down the mouse button at the specified coordinates relative to the window.
sourcepub fn mouse_up_on(
&mut self,
relative_x: u32,
relative_y: u32
) -> Result<(), Error>
pub fn mouse_up_on( &mut self, relative_x: u32, relative_y: u32 ) -> Result<(), Error>
Releases the mouse button at the specified coordinates relative to the window.
sourcepub fn activate_window(&mut self) -> Result<(), Error>
pub fn activate_window(&mut self) -> Result<(), Error>
Clicks at the top of the bottom to activate the window.
sourcepub fn find(&mut self, template: &Path) -> Result<Rect, Error>
pub fn find(&mut self, template: &Path) -> Result<Rect, Error>
Searches for a a specified image within the window and returns the Rect
coordinates.
sourcepub fn click_on_image(
&mut self,
template: &Path,
time_out: u64
) -> Result<(u32, u32), Error>
pub fn click_on_image( &mut self, template: &Path, time_out: u64 ) -> Result<(u32, u32), Error>
Searches for a specified image within the window and clicks at its center.