예제 #1
0
    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)
예제 #2
0
 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)
예제 #3
0
 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
예제 #4
0
 def escape_sequence_replace(*args, **kwargs):
     return escape_sequence_replace(*args, **kwargs)
예제 #5
0
파일: keyboard.py 프로젝트: ziux/ahk
 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)