def sendChars(self, chars):
     inputs = []
     for ch in chars:
         input = winUser.Input()
         input.type = winUser.INPUT_KEYBOARD
         input.ii.ki = winUser.KeyBdInput()
         input.ii.ki.wScan = ord(ch)
         input.ii.ki.dwFlags = winUser.KEYEVENTF_UNICODE
         inputs.append(input)
     winUser.SendInput(inputs)
Exemple #2
0
    def sendChars(self, chars: str):
        """Sends the provided unicode characters to the system.
		@param chars: The characters to send to the system.
		"""
        inputs = []
        for ch in chars:
            for direction in (0, winUser.KEYEVENTF_KEYUP):
                input = winUser.Input()
                input.type = winUser.INPUT_KEYBOARD
                input.ii.ki = winUser.KeyBdInput()
                input.ii.ki.wScan = ord(ch)
                input.ii.ki.dwFlags = winUser.KEYEVENTF_UNICODE | direction
                inputs.append(input)
        winUser.SendInput(inputs)
	def sendChars(self, chars: str):
		"""Sends the provided unicode characters to the system.
		@param chars: The characters to send to the system.
		"""
		inputs = []
		for ch in chars:
			for direction in (0,winUser.KEYEVENTF_KEYUP): 
				input = winUser.Input()
				input.type = winUser.INPUT_KEYBOARD
				input.ii.ki = winUser.KeyBdInput()
				input.ii.ki.wScan = ord(ch)
				input.ii.ki.dwFlags = winUser.KEYEVENTF_UNICODE|direction
				inputs.append(input)
		winUser.SendInput(inputs)
		focusObj = api.getFocusObject()
		if keyboardHandler.shouldUseToUnicodeEx(focusObj):
			# #10569: When we use ToUnicodeEx to detect typed characters,
			# emulated keypresses aren't detected.
			# Send TypedCharacter events manually.
			for ch in chars:
				focusObj.event_typedCharacter(ch=ch)