def type(self, s, blocking=True): """ Sends keystrokes using send_input, also escaping the string for use in AHK. :param s: the string to type :param blocking: if ``True``, waits until script finishes, else returns immediately. """ s = escape_sequence_replace(s) self.send_input(s, blocking=blocking)
def send(self, keys, delay=None, raw=False, blocking=False, escape=False): """ Send keystrokes directly to the window. Uses ControlSend https://autohotkey.com/docs/commands/Send.htm """ if escape: keys = escape_sequence_replace(keys) script = self._render_template('window/win_send.ahk', keys=keys, raw=raw, delay=delay, blocking=blocking) return self.engine.run_script(script, blocking=blocking)
def _send(self, keys, delay=10, raw=False, blocking=False, escape=False, press_duration=-1): if escape: keys = escape_sequence_replace(keys) script = self._render_template('window/win_send.ahk', title=f"ahk_id {self.id}", keys=keys, raw=raw, delay=delay, press_duration=press_duration, blocking=blocking) return script
def escape_sequence_replace(*args, **kwargs): return escape_sequence_replace(*args, **kwargs)
def type(self, s): """ Sends keystrokes using send_input, also escaping the string for use in AHK. """ s = escape_sequence_replace(s) self.send_input(s)