atbswp icon indicating copy to clipboard operation
atbswp copied to clipboard

CRTL Left+Key doesn't work on Windows

Open crile opened this issue 4 years ago • 6 comments

Hi,

It seems that the key combination, CTRL+key is not record. Or it is not replay. I don't know if there is any log or output that I can provide to help.

Thanks

Version : atbswp 0.1 Env : Windows 10 Python : 3.7.4

crile avatar Apr 30 '20 06:04 crile

Thanks for reporting this bug, can you provide more details? (Which key?), steps to reproduce?

RMPR avatar Apr 30 '20 18:04 RMPR

Additionally if you didn't input something sensible like a password or whatever, you can post the file %TMP%\atbswp-20200430

RMPR avatar Apr 30 '20 20:04 RMPR

Hi,

Steps to reproduce:

  • Ctrl+c to copy text
  • Ctrl+v to paste text

However, it seems that it is not supported, extract of atbswp temporary file:

    #!/bin/env python3
    # Created by atbswp (https://github.com/rmpr/atbswp)
    # on 04 May 2020 
    import pyautogui
    import time
    pyautogui.FAILSAFE = False

    pyautogui.moveTo(1492, 429)
    pyautogui.mouseDown(326, 243, 'left')
    pyautogui.mouseUp(326, 243, 'left')
    pyautogui.mouseDown(326, 242, 'left')
    pyautogui.mouseUp(214, 237, 'left')
    ### Key.ctrl_l is not supported yet
    pyautogui.keyDown('\x03')
    pyautogui.mouseDown(460, 279, 'left')
    pyautogui.mouseUp(460, 279, 'left')
    pyautogui.keyDown('enter')
    pyautogui.keyUp('enter')
    ### Key.ctrl_l is not supported yet
    pyautogui.keyDown('\x16')

crile avatar May 04 '20 06:05 crile

Will take a look at this, What happens when you use right Ctrl instead?

RMPR avatar May 04 '20 10:05 RMPR

Probably the Ctrl key that doesn't work

Nivekiba avatar May 04 '20 11:05 Nivekiba

It isn't a bug, just not implemented yet!

"Note that in the context of keyboard handling, the \x03 keycode may be associated with the Ctrl+C key, since Ctrl+C is often used to send an interrupt signal (SIGINT) on Unix and Windows systems to stop. the execution of a program."

Possible solution, in Win10 at least:

You can't do Ctrl+C and Ctrl+V in Windows. atbswp takes them like "### This key is not supported yet". I managed that with this:

on_press:

try:
    if key.char == '\x03':
        self._capture.append("pyautogui.hotkey('ctrl', 'c')")
    elif key.char == '\x16':
        self._capture.append("pyautogui.hotkey('ctrl', 'v')")
    else:
        self.write_keyboard_action(move='keyDown', key=key.char)

except AttributeError:
    self.write_keyboard_action(move="keyDown", key=LOOKUP_SPECIAL_KEY.get(key, self._error))

on_release:

    if len(str(key)) <= 3:
        self.write_keyboard_action(move='keyUp', key=key)
    else:
        if hasattr(key, 'char') and (key.char == '\x03' or key.char == '\x16'):
            pass
        else:
            self.write_keyboard_action(move="keyUp", key=LOOKUP_SPECIAL_KEY.get(key, self._error))

I don't know if works in other OS, in Windows 10, yes!

leomm20 avatar Jun 15 '23 14:06 leomm20