コード例 #1
0
ファイル: MessageHandler.py プロジェクト: sagielevy/Kommander
def _release(char):
    # Convert to pyAutoGui char
    if char in _ARD_TO_PYAUTOGUI_KEYS:
        char = _ARD_TO_PYAUTOGUI_KEYS[char]

    _pressed_list.remove(char)
    pyautogui.keyUp(char)  # Verify
コード例 #2
0
ファイル: start.py プロジェクト: ofer515/project
def play_music(url):
    webbrowser.open(url, 0, autoraise=False)
    time.sleep(0.1)
    pyautogui.keyDown("Alt")
    pyautogui.keyDown("Tab")
    pyautogui.keyUp("Alt")
    pyautogui.keyUp("Tab")
コード例 #3
0
    def setGameOutput(self,output):

        self.gameOutput = output
        self.gameOutputString = self.getDiscreteState(output)

        if (self.gameOutputString == 'DOWN'):
          # Skew
          pyautogui.keyUp('up')
          pyautogui.keyDown('down')
        elif (self.gameOutputString == 'NORM'):
          # DO Nothing
          pyautogui.keyUp('up')
          pyautogui.keyUp('down')
        else:

            # Filter JUMP
            if (self.lastOutputSet != 'JUMP'):
                self.lastOutputSetTime = time.time()

            # JUMP
            # Check if hasn't jump for more than 3 continuous secconds
            if (time.time() - self.lastOutputSetTime < 3000):
                pyautogui.keyUp('down')
                pyautogui.keyDown('up')
            else:
                pyautogui.keyUp('up')
                pyautogui.keyDown('down')

         
        self.lastOutputSet = self.gameOutputString
コード例 #4
0
def resize(n, dir):
    pag.keyDown('winleft')
    pag.press('r')
    pag.keyUp('winleft')
    for i in range(n):
        pag.press(dir)
    pag.press('escape')
コード例 #5
0
def play():
    #get sensor data
    s.getSensorData()
    #sense keypress
    global rc_prev
    rc = s.RemoteCode
    #remove double clicks
    if not (rc == rc_prev):
        if rc  == '6C90':
            hmi.keyDown('up')
            hmi.keyUp('up')
        elif rc == 'CC30':
            hmi.keyDown('down')
            hmi.keyUp('down')
        elif rc == 'AC50':
            hmi.keyDown('right')
            hmi.keyUp('right')
        elif rc == '8C70':
            hmi.keyDown('left')
            hmi.keyUp('left')
        elif rc == '9C60':
            hmi.keyDown('p')
            hmi.keyUp('p')
        rc_prev = rc
    s.ledWrite(Red, On)
    wait(20)
    s.ledWrite(Red, Off)
    wait(20)
コード例 #6
0
def tick(direction='right', count=0):
	global oldIm
	global newIm
	# no sleep but there's a long step size... is it hanging on the screenshot???
	# screenGrab(count)

	# oldPath, newPath = None, None
	if count is 0:
		newIm = screenGrab(count)
	else:
		oldIm = newIm
		newIm = screenGrab(count)

		# shouldn't be getcwding every time
		# oldPath = os.getcwd() + '/caps/' + str(count - 1) + '.png'
		# oldPath = s
		# newPath = os.getcwd() + '/caps/' + str(count) + '.png'
	# direction = bestMove(oldPath, newPath)
	oldDirection = direction
	direction = bestMove(oldIm, newIm)

	if oldDirection not in ['space','sit']:
		pyautogui.keyUp(oldDirection)
	if direction not in ['space','sit']:

		pyautogui.keyDown(direction)
		# time.sleep(0.05)
	elif direction == "space":
		pyautogui.press('space')
	count += 1
	tick(direction, count)
コード例 #7
0
ファイル: hajs.py プロジェクト: plizonczyk/AGHacks-2015
def do_right(area):
    print area
    if area > 33000 and pressedAtt == 0:
	pyautogui.keyDown("enter")
	pyautogui.keyUp("enter")
	global pressedAtt
	pressedAtt = 1
	print "ATT"

    if area < 10000 and pressedDef == 0:
	pyautogui.keyDown("ctrlright")
	
	global pressedDef
	pressedDef = 1
	print "DEF"
	
    else:
        if pressedAtt == 1 and area < 33000:
		global pressedAtt
		pressedAtt = 0
	if pressedDef == 1 and area > 10000:
		print "DUPA"
		pyautogui.keyUp("ctrlright")
		global pressedDef
		pressedDef = 0
コード例 #8
0
ファイル: Keyboard.py プロジェクト: jjvilm/osrmacro
def type_this(strings):
    """Types the passed characters with random pauses in between strokes"""
    for s in strings:
        # delay between key presses--key UP/DOWN
        #autopy.key.toggle(s, True)
        pyautogui.keyDown(s)
        RandTime.randTime(0,0,0,0,0,9)
        pyautogui.keyUp(s)
コード例 #9
0
ファイル: commands.py プロジェクト: girish946/SG-remote
def startup_menu():
    """
    this method shows the startup menu....
    """
    p.keyDown('alt')
    p.keyDown('f1')
    p.keyUp('f1')
    p.keyUp('alt')
コード例 #10
0
 def make(recipe):
     pyautogui.keyDown('down')
     time.sleep(2)
     pyautogui.keyUp('down')
     pyautogui.press('p')
     if recipe.com == 's':
         pyautogui.press(recipe.com)
     pyautogui.press('enter')
コード例 #11
0
def zoom_out(scale):
    pyautogui.keyDown('ctrlleft')
    for x in range(0,scale):
        print("zooming out")
        pyautogui.keyDown('-')
        pyautogui.keyUp('-')
    pyautogui.keyUp('ctrlleft')
    return True
コード例 #12
0
def Tu_Dong_Go_Phim():
    time.sleep(2)
    i = 0
    while i < 10:
        i += 1
        keyDown('enter', pause=0.25)
        keyUp('enter', pause=0.25)
        typewrite(str(i), interval=0.5)
コード例 #13
0
def clicker(coordinate):  # generate click event on a particular coordinate
    x = coordinate
    pyautogui.keyDown('ctrlleft')
    print(x)
    pyautogui.moveTo(x[0], x[1], duration=0.1) # This duration specifies how speed the mouse travels
    pyautogui.click(x[0], x[1])
    pyautogui.keyUp('ctrlleft')
    return True
コード例 #14
0
ファイル: commands.py プロジェクト: girish946/SG-remote
def close():
    """
    this method presses alt+f4 of the virtual key board.
    """
    p.keyDown('alt')
    p.keyDown('f4')
    p.keyUp('f4')
    p.keyUp('alt')
コード例 #15
0
ファイル: commands.py プロジェクト: girish946/SG-remote
def cut():
    """
    this method presses ctrl+x of the virtual key board.
    """
    p.keyDown('ctrl')
    p.keyDown('x')
    p.keyUp('x')
    p.keyUp('ctrl')
    notify('cut '+ clipboard.paste())
コード例 #16
0
ファイル: commands.py プロジェクト: girish946/SG-remote
def paste():
    """
    this method presses ctrl+v of the virtual key board.
    """
    p.keyDown('ctrl')
    p.keyDown('v')
    p.keyUp('v')
    p.keyUp('ctrl')
    notify('paste '+ clipboard.paste())
コード例 #17
0
ファイル: commands.py プロジェクト: girish946/SG-remote
def copy():
    """
    this method presses ctrl+c of the virtual key board.
    """
    p.keyDown('ctrl')
    p.keyDown('c')
    p.keyUp('c')
    p.keyUp('ctrl')
    notify('copy '+ clipboard.paste())
コード例 #18
0
ファイル: hotkeyway.py プロジェクト: nmix/hotkeyway
def OnKeyboardEvent(event):
    if chr(event.Ascii) == 'i' and event.IsAlt():
        pyautogui.keyDown('alt')
        pyautogui.keyDown('shift')
        pyautogui.keyUp('shift')
        pyautogui.keyUp('alt')
        pyautogui.hotkey('ctrl', 'i')
        return False
    return True
コード例 #19
0
ファイル: browser_easi.py プロジェクト: erickstm87/url_opener
def click_through(i):
    ad_spotter(i)
    #for i in range(0,3):
    #    pyautogui.click()
    time.sleep(2)
    #pyautogui.click()
    #close_tab()
    pyautogui.keyDown('command')
    pyautogui.press('w')
    pyautogui.keyUp('command')
コード例 #20
0
 def key_down(self, key, down_tm: float):
     """
     Custom sleep time for when a key needs to be
     held down for a cooking recipe
     :param down_tm: sleep time
     """
     pyautogui.keyDown(key, _pause=False)
     time.sleep(down_tm)
     pyautogui.keyUp(key, _pause=False)
     time.sleep(self.key_press_sleep)
コード例 #21
0
ファイル: char.py プロジェクト: artofboom/fmbot
 def moveCharToTheLeftOfFM(self):
     CharIsLeft = False
     pyautogui.keyDown('left')
     while not CharIsLeft:
         im = pyautogui.screenshot(region=(0, 0, 800, 600))
         left = im.getpixel((9, 138))
         if 212 < left[0] and left[0] < 224:
             if 200 < left[1] and left[1] < 208:
                 if 14 < left[2] and left[2] < 18:
                     CharIsLeft = True
     pyautogui.keyUp('left')
コード例 #22
0
ファイル: runner.py プロジェクト: jiangyy/c3
def keypress(cmd):
  FNKEY = ['ctrl', 'alt']
  keys = cmd.lower().split('-')
  for key in keys:
    if key in FNKEY:
      pyautogui.keyDown(key)
    else:
      pyautogui.press(key)
  for key in keys:
    if key in FNKEY:
      pyautogui.keyUp(key)
コード例 #23
0
def play():
	pyautogui.hotkey('winleft', '9')
	time.sleep(0.5)
	pyautogui.hotkey('ctrl', 't')
	pyautogui.typewrite('http://www.kanyezone.com/', interval = 0.05)
	pyautogui.press('enter')
	time.sleep(4)
	# pyautogui.press('enter')
	pyautogui.keyDown('right')
	time.sleep(0.25)
	pyautogui.keyUp('right')
	tick()
コード例 #24
0
ファイル: SimpleBot.py プロジェクト: Zerixos/CrusaderBot
def click(x=None, y=None, keydown=None):
    if x is None:
        pyautogui.click()
        return

    if keydown:
        pyautogui.keyDown(keydown)

    pyautogui.click(x, y)

    if keydown:
        pyautogui.keyUp(keydown)
コード例 #25
0
 def SendKey( self, aKey ):
     if self.doTimeStamp:
         print( "press %5s @ %15.3f" % (aKey, time.time()) )
     pyautogui.keyDown(aKey)
     if self.doTimeStamp:
         print( "press %5s @ %15.3f" % (aKey, time.time()) )
     time.sleep( self._pressKeySec )
     if self.doTimeStamp:
         print( "upkey %5s @ %15.3f" % (aKey, time.time()) )
     pyautogui.keyUp(aKey)
     if self.doTimeStamp:
         print( "upkey %5s @ %15.3f" % (aKey, time.time()) )
     time.sleep( self._gap2KeySec )
コード例 #26
0
ファイル: pyautostuff.py プロジェクト: Drag14/AGHacks
    def setkey(self, keyAct, key, debug=False):
        if keyAct == 11:
            if debug:
                print "\n", "set up, key: ", self.keys[key], "\n"
            pyautogui.keyUp(self.keys[key])

        elif keyAct == 10:
            if debug:
                print "set down, key: ", self.keys[key]
            pyautogui.keyDown(self.keys[key])

        else:
            if debug:
                print keyAct, key
コード例 #27
0
ファイル: driver_main.py プロジェクト: HackerSchool/HES
def run_driver(button_bindings=ButtonBindings()):
    pyautogui.PAUSE = 0  # No delay when pressing/releasing keys
    with HESInterface() as controller:
        while True:
            action, button = controller.read_data()
            key = button_bindings.translate_button(button)
            if key:
                if action == 'P':  # pressed
                    pyautogui.keyDown(key)
                    # Note: Don't worry if by holding down the button it doesn't repeat the key in a text editor.
                    # The key is held down (try it in a game) but it isn't firing periodic keyDown()'s like keyboards do
                if action == 'R':  # released
                    pyautogui.keyUp(key)

                sleep(settings.poll_delay)
コード例 #28
0
def example():
    screenWidth, screenHeight = pag.size()
    currentMouseX, currentMouseY = pag.position()
    pag.moveTo(500, 550)
    pag.click()
    pag.moveRel(None, 10)  # move mouse 10 pixels down
    pag.doubleClick()
    # pag.moveTo(500, 500, duration=2, tween=pyautogui.tweens.easeInOutQuad)  # use tweening/easing function to move mouse over 2 seconds.
    pag.typewrite('Hello world!', interval=0.25)  # type with quarter-second pause in between each key
    pag.press('esc')
    pag.keyDown('shift')
    pag.press(['left', 'left', 'left', 'left', 'left', 'left'])
    pag.keyUp('shift')
    pag.hotkey('ctrl', 'c')
    delta_y = 50
コード例 #29
0
    def type_with_keys_down(self, text, *keys):
        """Press keyboard keys down, then write given text, then release the
        keyboard keys.

        See valid keyboard keys in `Press Combination`.

        Examples:

        | Type with keys down | write this in caps  | Key.Shift |
        """
        valid_keys = self._validate_keys(keys)
        for key in valid_keys:
            ag.keyDown(key)
        ag.typewrite(text)
        for key in valid_keys:
            ag.keyUp(key)
コード例 #30
0
ファイル: commands.py プロジェクト: girish946/op-mate
def alt_tab():
    """
    this method takes the control to the previously
    opened window.
    """
    if os.environ['XDG_CURRENT_DESKTOP'] == 'Unity':
        p.keyDown('alt')
        p.keyDown('\t')
        p.keyUp('\t')
        p.keyUp('alt')
    elif os.environ['XDG_CURRENT_DESKTOP'].lower() == 'mate':
        p.keyDown('alt')
        p.keyDown('shift')
        p.keyDown('\t')
        p.keyUp('\t')
        p.keyUp('shift')
        p.keyUp('alt')
コード例 #31
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def taskbar():
    pyautogui.keyDown("win")
    pyautogui.press("t")
    pyautogui.keyUp("win")
コード例 #32
0
ファイル: Craft.py プロジェクト: tsaowesley/Logi_education
    def wrapperUpdateUI(self, msg):
        global glist, sessionId
        totalDeltaValue = 0
        totalRatchetDeltaValue = 0
        count = 0
        listCount = 0
        global firstObject

        if (msg['message_type'] == "crown_turn_event"):
            glist.append(msg)
            listCount = len(glist)
            if listCount == 0:
                return
            currentToolOption = glist[0]['task_options']['current_tool_option']
            print("+++currentToolOption = ", currentToolOption)
            print("listCount = ", listCount)
            firstObject = glist[0]
            for i in range(listCount):
                if currentToolOption == glist[i]['task_options'][
                        'current_tool_option']:
                    totalDeltaValue = totalDeltaValue = glist[i]['delta']
                    totalRatchetDeltaValue = totalRatchetDeltaValue + glist[i][
                        'ratchet_delta']
                else:
                    break
                count += 1

            if listCount >= 0:
                glist.clear()
            print("totalDeltaValue = ", totalDeltaValue)
            print("firstObject = ", firstObject['message_type'])

            if firstObject['message_type'] == "deactivate_plugin":
                return

            try:
                if firstObject['message_type'] == "crown_turn_event":
                    print("turn event =====")
                    if firstObject['task_options']['current_tool'] == 'Slider':
                        print("\n", "selected slider")
                        v = slider.GetValue()
                        tvalue = v + totalDeltaValue
                        if tvalue <= 0:
                            tvalue = 0
                        if tvalue > 1000:
                            tvalue = 1000
                        slider.SetValue(tvalue)
                        print("report called....", tvalue, msg)
                        self.report(msg, tvalue)
                    elif firstObject['task_options'][
                            'current_tool'] == 'SpinCtrl':
                        print("\n", "selected SpinCtrl")
                        v = spin.GetValue()
                        tvalue = v + totalDeltaValue
                        if tvalue <= 0:
                            tvalue = 0
                        if tvalue > 1000:
                            tvalue = 1000
                        spin.SetValue(tvalue)
                        self.report(msg, tvalue)
                    elif firstObject['task_options'][
                            'current_tool'] == 'Gauge':
                        if firstObject['task_options'][
                                'current_tool_option'] == 'gauge':
                            print("\n", "selected Gauge")
                            v = gauge.GetValue()
                            tvalue = v + totalDeltaValue
                            if tvalue <= 0:
                                tvalue = 0
                            if tvalue > 500:
                                tvalue = 500
                            gauge.SetValue(tvalue)
                            self.report(msg, tvalue)
                        if firstObject['task_options'][
                                'current_tool_option'] == 'gaugeRatchet':
                            print("\n", "selected gaugeRatchet")
                            v = gauge.GetValue()
                            tvalue = v + (totalRatchetDeltaValue * 10)
                            if tvalue <= 0:
                                tvalue = 0
                            if tvalue > 500:
                                tvalue = 500
                            gauge.SetValue(tvalue)
                            self.report(msg, tvalue)

                    elif firstObject['task_options'][
                            'current_tool'] == 'ComboBox':
                        if totalRatchetDeltaValue != 0:
                            print("\n", "selected ComboBox")
                            v = combo.GetSelection()
                            width, height = pyautogui.size()
                            divider = 6
                            multi_wid = int(width / divider)
                            if multi_wid * 6 != width:
                                divider = 8
                                multi_wid = int(width / divider)
                            x_now, y_now = pyautogui.position()
                            pyautogui.moveTo(v * multi_wid, y_now)
                            if (v == 1 and totalRatchetDeltaValue < 0) or (
                                    v == divider - 1
                                    and totalRatchetDeltaValue > 0):
                                widthto = 0
                            elif totalRatchetDeltaValue > 0:
                                widthto = multi_wid
                            else:
                                widthto = -multi_wid
                            pyautogui.drag(widthto, 0, 1, button='left')
                            #pyautogui.moveTo(x_now, y_now)
                            combo.SetSelection(v + widthto / multi_wid)
                            pyautogui.keyDown('alt')
                            pyautogui.press('tab')
                            pyautogui.keyUp('alt')
                            x_now, y_now = pyautogui.position()
                            print(x_now)
                            self.report(msg, tvalue)
                    elif firstObject['task_options'][
                            'current_tool'] == 'TextCtrl':
                        print("\n", "selected TextCtrl")
                        v = txt.GetSize()
                        h = v.height + totalDeltaValue
                        w = v.width + totalDeltaValue
                        txt.SetSize(w, h)
                        self.report(msg, w)
                    elif firstObject['task_options'][
                            'current_tool'] == 'ListBox':
                        print("\n", "selected ListBox")
                        v = lb.GetSelection()
                        v = v + totalRatchetDeltaValue
                        if v <= 0:
                            v = 0
                        if v > 999:
                            v = 999
                        lb.SetSelection(v)
                        lb.EnsureVisible(v)
                        self.report(msg, v)
            except ValueError:
                print("Error: update UI")

        elif (msg['message_type'] == "register_ack"):
            print("register_ack = ", msg['message_type'])
            sessionId = msg['session_id']
            print("Session Id = ", sessionId)

            defaultTool = "ComboBox"

            connectMessage = {
                "message_type": "tool_change",
                "session_id": sessionId,
                "tool_id": defaultTool
            }
            regMsg = json.dumps(connectMessage)
            ws.send(regMsg.encode('utf8'))
コード例 #33
0
def downsig():
    pyautogui.keyDown(down_key)
    time.sleep(0.25)
    pyautogui.press(heavy)
    pyautogui.keyUp(down_key)
    time.sleep(1)
コード例 #34
0
 def double_key(a, b):
     pyautogui.keyDown(a)
     pyautogui.press(b)
     pyautogui.keyUp(a)
コード例 #35
0
import pyautogui
import pyperclip

pyautogui.moveTo(441, 207, 1)
pyautogui.click()

# 문자입력
pyautogui.write("i'am a robot!", interval=0.1)

# 키보드 키입력
pyautogui.press('enter')
pyautogui.write("automatic program", interval=0.1)

# 한글입력
# 클립보드에 복사
pyperclip.copy("한글입력해보자")

# 붙여넣기
pyautogui.keyDown("ctrl")
pyautogui.press("v")
pyautogui.keyUp("ctrl")
コード例 #36
0
def vaaka():
    # FAL ase pystykuva koordinaatit ensimmainen
    x1 = 1254
    x2 = 1399
    y1 = 74
    y2 = 455
    # lippaan kuvan etsinnan koordinaatit
    x3 = 730
    x4 = 952
    y3 = 713
    y4 = 923
    # toisen lippaan etsimisen koordit
    xx3 = 1299
    xx4 = 1566
    yy3 = 725
    yy4 = 926
    lipasC = [847, 370, 1161, 558]

    # ekan lippaan dragauskoordinaatit
    x5 = 1545
    y5 = 650
    # scrolli
    scrol = 0
    # %5 resetin jlk draggayskoordinaatit lippaasta aseeseen
    # uusi aseen koordinaatti lippaan draggaykseen
    ylip = 0
    # vaaka arvot falikuvan etsimiselle
    ax = 1264
    ay = 80
    ax2 = 1641
    ay2 = 205

    pyautogui.click(x=1660, y=552)
    for i in range(1, 35):
        pyautogui.scroll(1)
    pyautogui.moveTo(x=1899, y=406)
    pyautogui.dragTo(1887, 692, 2, button='left')



    for i in range(0, 26):
        print("kierros",i)
        print("ax=",ax,"ax2= ",ax2, "ay=", ay, "ay2= ",ay2)
        if i%2==0  and i != 0:
            # x akseli resetti
            ax = 1264
            ax2 = 1641
            ay +=126
            ay2 +=126

        if i == 12:
            pyautogui.click(x=1660, y=552)
            for i in range(1, 14):
                pyautogui.scroll(-1)

            ax = 1264
            ax2 = 1641
            ay =179
            ay2 =305

        falkuva = imagesearcharea("falkuva1.png", x1, y1, x2, y2, precision=0.7, im=None)


        falkuva1 = imagesearcharea("falkuva.png", ax, ay, ax2, ay2, precision=0.7, im=None)
        falextreme = imagesearcharea("falextremeV.png", ax, ay, ax2, ay2, precision=0.7, im=None)
        falEL = imagesearcharea("lyhytfalV.png", ax, ay, ax2, ay2, precision=0.7, im=None)
       # kivaa = ImageGrab.grab(bbox=(ax, ay, ax2, ay2))
        #kivaa.show()


        # PYSTYASENTOETSINTA


        # VAAKATASOSEARcHI
        if falkuva1 != [-1, -1] or falextreme != [-1, -1] or falEL != [-1, -1]:

            pyautogui.click(ax + falkuva1[0] + 20, ay + falkuva1[1] + 20, button='right')
            time.sleep(0.2)
            #etsii klikatun inspectí ikkunan
            ins = (imagesearch("inspect.png", precision=0.5))
            print("inspectikuva: ", ins)
            time.sleep(0.2)
            #klikkaa inspectiä
            pyautogui.click(ins[0] + 2, ins[1] + 5)
            time.sleep(0.3)
            #etsii lipasta inspectistä
            lipas = imagesearcharea("lipas.png", x3, y3, x4, y4)

            print(lipas)

            #jos lipasta ei löydy, siirrytaan seuraavaan aseeseen
            if lipas[0] == -1:
                ax += 250
                ax2 += 253

                pyautogui.press('esc')
                #JOS TARVII DRAGATA LIPAS POIS
            if lipas[0] != -1:
            #     #jos ase on extreme, annetaan eri koordinaatit, jotta draggays onnistuu
            #     if falextreme == [-1, -1]:
            #
            #         pyautogui.moveTo(990, 70)
            #         pyautogui.dragTo(1722, 78, 2)
            #     else:
            #         pyautogui.moveTo(985, 8)
            #         pyautogui.dragTo(1722, 78, 2)

                lipas = imagesearcharea("lipas.png", x3, y3, x4, y4)
                # lippaan päälle hiiri
                pyautogui.moveTo(x3 + lipas[0] + 3, y3 + lipas[1] + 3, 0.5)
                #VANHA LIPPAAN ETSIMISBOKSI JOS DRAGGAA INSPECTI RUUDUN OIKEAAN REUNAAN
                #pyautogui.moveTo(xx3 + lipas[0] + 3, yy3 + lipas[1] + 3, 0.5)
                pyautogui.keyDown('ctrl')
                pyautogui.click()
                pyautogui.keyUp('ctrl')
                # vetaa lippaan reppuun
                #--vanha
                # pyautogui.dragTo(1128, 631, 1.5)
                #--vanha
                # pyautogui.click(1128, 631, button='right')
                #--uusi ctrl
                pyautogui.press('esc')
               # pyautogui.click(879, 507, button='right')
                # klikkaa unload ammo'
               # time.sleep(0.2)

                #--vanha drag
                # pyautogui.click(1128 + 20, 631 - 82)
                #--uus ctrl
                #time.sleep(0.3)
               # pyautogui.click(889, 416)
                #  time.sleep(1.5)

                #--vanha drag
               # pyautogui.moveTo(1128, 631, 0.4)
                #--uus ctrl
               # pyautogui.moveTo(879, 507, 0.4)
                lipasreppu = imagesearcharea("lipasiso3.png", lipasC[0], lipasC[1], lipasC[2], lipasC[3], precision=0.5)
                if lipasreppu != [-1, -1]:
                    pyautogui.moveTo(lipasC[0] + lipasreppu[0] + 5, lipasC[1] + lipasreppu[1] + 5)
                    pyautogui.click(button='right')
                    pyautogui.click(lipasC[0] + lipasreppu[0] + 50, lipasC[1] + lipasreppu[1] - 88)
                    pyautogui.moveTo(lipasC[0] + lipasreppu[0] + 5, lipasC[1] + lipasreppu[1] + 5)
                    pyautogui.dragTo(ax + 40, ay + 60 + ylip, 1.5)


                ax += 250
                ax2 += 253
                x5 + 51


        else:
            ax += 250
            ax2 += 253
コード例 #37
0
ファイル: EncerrarEntrega.py プロジェクト: Aniroth/AutoCTE
def EncerrarKlabin(qtde, flag):

    for i in range(qtde):

        ClickOn("./AutoCTE/Buttons/CHECKEncViag.bmp")
        Sleep(1)
        pyautogui.keyDown('altleft')
        WriteOn('on')
        pyautogui.keyUp('altleft')
        PressKey('down', 5)
        PressKey('right')
        PressKey('enter')
        ClickOn("./AutoCTE/Buttons/OK2.bmp")
        CheckFor('./AutoCTE/Buttons/CHECKFechada.bmp', precision=0.95)
        pyautogui.keyDown('altleft')
        WriteOn('on')
        pyautogui.keyUp('altleft')
        PressKey('down', 4)
        PressKey('enter')
        Sleep(1)
        WriteOn('a')
        Sleep(1)
        today = date.today()
        now = datetime.now()
        day = today.strftime("%d%m%y")
        WriteOn(str(day))
        WriteOn(now.strftime("%H%M"))
        WriteOn(str(day))
        WriteOn(now.strftime("%H%M"))
        ClickOn("./AutoCTE/Buttons/CONFIRMAR5.bmp")
        PressKey('down')
        WriteOn('a')
        WriteOn(str(day))
        WriteOn(now.strftime("%H%M"))
        WriteOn(str(day))
        WriteOn(now.strftime("%H%M"))
        ClickOn("./AutoCTE/Buttons/CONFIRMAR5.bmp")
        WriteOn('s')
        Sleep(3)
        pyautogui.keyDown('altleft')
        WriteOn('on')
        pyautogui.keyUp('altleft')
        PressKey('down', 6)
        PressKey('enter')
        WriteOn('a')
        CheckFor('./AutoCTE/Buttons/CHECKRegOcorr.bmp', precision=0.95)
        PressKey('right')
        PressKey('enter')
        WriteOn(str(day))
        PressKey('enter')
        WriteOn(now.strftime("%H%M"))
        PressKey('enter')
        WriteOn('0002')
        ClickOn("./AutoCTE/Buttons/SALVAR.bmp")
        Sleep(2)
        WriteOn('s')
        Sleep(1)
        pyautogui.keyDown('altleft')
        WriteOn('on')
        pyautogui.keyUp('altleft')
        PressKey('down', 7)
        PressKey('right')
        PressKey('enter')
        ClickOn("./AutoCTE/Buttons/OK2.bmp")
        PressKey('down')
コード例 #38
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def cortana():
    pyautogui.keyDown("win")
    pyautogui.press("c")
    pyautogui.keyUp("win")
コード例 #39
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def options():
    pyautogui.keyDown("win")
    pyautogui.press("x")
    pyautogui.keyUp("win")
コード例 #40
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def alignleft():
    pyautogui.keyDown("win")
    pyautogui.press("left")
    pyautogui.keyUp("win")
コード例 #41
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def controll():
    pyautogui.keyDown("win")
    pyautogui.press("b")
    pyautogui.keyUp("win")
コード例 #42
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def three():
    pyautogui.press("tab")
    pyautogui.press("tab")
    pyautogui.press("tab")
    pyautogui.keyUp("alt")
コード例 #43
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def close():
    pyautogui.keyDown("alt")
    pyautogui.press("f4")
    pyautogui.keyUp("alt")
コード例 #44
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def two():
    pyautogui.press("tab")
    pyautogui.press("tab")
    pyautogui.keyUp("alt")
コード例 #45
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def settings():
    pyautogui.keyDown("win")
    pyautogui.press("i")
    pyautogui.keyUp("win")
コード例 #46
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def lockpc():
    pyautogui.keyDown("win")
    pyautogui.press("l")
    pyautogui.keyUp("win")
コード例 #47
0
def falmyynti():
    #FAL ase pystykuva koordinaatit ensimmainen
    x1=1254
    x2=1399
    y1=74
    y2=455
    #lippaan kuvan etsinnan koordinaatit
    x3=730
    x4= 952
    y3=713
    y4=923
    #toisen lippaan etsimisen koordit
    xx3=1299
    xx4= 1566
    yy3=725
    yy4= 926
    #lipas boksi repussa
    lipasC = [847, 370, 1161, 558]

    #ekan lippaan dragauskoordinaatit
    x5=1545
    y5=650
    #scrolli
    scrol = 3
    #%5 resetin jlk draggayskoordinaatit lippaasta aseeseen
    #uusi aseen koordinaatti lippaan draggaykseen
    ylip = 0
    #vaaka arvot falikuvan etsimiselle
    ax= 1264
    ay= 80
    ax2= 1641
    ay2= 205

   # pyautogui.click(x=1660, y=552)
    #jos haluaa klikata sivun ylös, spammii joku 4 kertaa
    pyautogui.click(1901, 93, 2)




    pyautogui.click(x=1660, y=552)
    for i in range(1,35):
        pyautogui.scroll(1)
    pyautogui.moveTo(x=1899, y=406)
    pyautogui.dragTo(1887, 692, 2, button='left')
    print("moi")


    for i in range(0,20):
        print(i,"kierrokset vilisee silimissä")
        if i ==5:
            pyautogui.click(x=1660, y=552)
            for i in range(1, scrol+4):
                pyautogui.scroll(-1)
            # x akseli resetti
            x1 = 1254
            x2 = 1399
            scrol += 6
            #ylip += 375
        if i == 10:
            pyautogui.moveTo(x=1660, y=552)
            for i in range(1, 10):
                pyautogui.scroll(-1)
            x1 = 1264
            x2 = 1389
            y1= 179
            y2= 557
        if i == 15:
            x1 = 1264
            x2 = 1389
            y1= 556
            y2 = 934

        falkuva =imagesearcharea("falkuva1.png", x1, y1, x2, y2, precision=0.7, im=None)
        falkuvaextP =imagesearcharea("falextremepysty.png", x1, y1, x2, y2, precision=0.7, im=None)
        falkuvaextLP =imagesearcharea("lyhytfalP.png", x1, y1, x2, y2, precision=0.7, im=None)
        print(falkuva, falkuvaextLP, falkuvaextP)


        #PYSTYASENTOETSINTA
        if falkuva !=[-1,-1] or falkuvaextP != [-1,-1]or falkuvaextLP != [-1,-1]:
            print("normifal:", falkuva, " extreme:",falkuvaextP)
            pyautogui.click(x1+falkuva[0]+20,y1+falkuva[1]+20, button='right')
            time.sleep(0.2)
            ins = (imagesearch("inspect.png", precision=0.5))
            print("inspectikuva: ",ins)
            time.sleep(0.2)

            pyautogui.click(ins[0] + 2, ins[1] + 5)
            time.sleep(0.3)
            lipas= imagesearcharea("lipas.png",x3, y3, x4, y4)



            print(lipas)


            if lipas[0]== -1:
                x1 += 127
                x2 += 127

                pyautogui.press('esc')
            if lipas[0] != -1:

                #lipas
               #lipas = imagesearcharea("lipas.png", x3, y3, x4, y4)
                # lippaan päälle hiiri
                pyautogui.moveTo(x3 + lipas[0] + 3, y3 + lipas[1] + 3, 0.5)
                pyautogui.keyDown('ctrl')
                pyautogui.click()
                pyautogui.keyUp('ctrl')
                pyautogui.press('esc')
                #pyautogui.click(879, 507, button='right')
                # klikkaa unload ammo
                time.sleep(0.3)
               # pyautogui.click(889, 416)
               # pyautogui.moveTo(879, 507, 0.4)
                lipasreppu = imagesearcharea("lipasiso3.png", lipasC[0], lipasC[1], lipasC[2], lipasC[3], precision=0.5)
                if lipasreppu != [-1, -1]:
                    pyautogui.moveTo(lipasC[0] + lipasreppu[0] + 5, lipasC[1] + lipasreppu[1] + 5)
                    pyautogui.click(button='right')
                    pyautogui.click(lipasC[0] + lipasreppu[0] + 50, lipasC[1] + lipasreppu[1] - 88)
                    pyautogui.moveTo(lipasC[0] + lipasreppu[0] + 5, lipasC[1] + lipasreppu[1] + 5)

                    pyautogui.dragTo(x1+40, y1+170+ylip,1.5)
                x1+=127
                x2+=127
                x5+51


        else:
             x1 += 127
             x2 += 127




    falmyynti2()
コード例 #48
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def one():
    pyautogui.press("tab")
    pyautogui.keyUp("alt")
コード例 #49
0
 def need_jump(self):
     keyUp("down")
     keyDown("space")
     sleep(self.zipla)
     keyUp("space")
     keyDown("down")
コード例 #50
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def dict():
    pyautogui.keyDown("win")
    pyautogui.press("h")
    pyautogui.keyUp("win")
コード例 #51
0
 def multiple_alttab(a):
     pyautogui.keyDown('alt')
     for i in range(a):
         pyautogui.press('tab')
         time.sleep(0.5)
     pyautogui.keyUp('alt')
コード例 #52
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def gamebar():
    pyautogui.keyDown("win")
    pyautogui.press("g")
    pyautogui.keyUp("win")
コード例 #53
0
ファイル: 12tails3.py プロジェクト: paipay2539/12tails
def key_hold(key, hold_time):
    pyautogui.keyDown(key)
    time.sleep(hold_time)
    pyautogui.keyUp(key)
コード例 #54
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def show_desktop():
    pyautogui.keyDown("win")
    pyautogui.press("d")
    pyautogui.keyUp("win")
コード例 #55
0
def keyboardOp():
    """
    键盘上可以按的键都可以调用
    每次键入的时间间隔: secs_between_keys = 0.1
    pyautogui.typewrite('Hello world!\n', interval=secs_between_keys)
    多个键也可以
    pyautogui.typewrite(['a', 'b', 'c', 'left', 'backspace', 'enter', 'f1'], interval=secs_between_keys)
    :return: 
    """
    #  在每次输入之间暂停0.25秒
    pyautogui.typewrite('Hello world!', interval=0.25)
    # 要按那些功能键,可以用press()函数把pyautogui.KEYBOARD_KEYS里面按键对应的字符串输入进去。
    # 例如:
    #  ENTER键
    pyautogui.press('enter')
    #  F1键
    pyautogui.press('f1')
    #  左方向键
    pyautogui.press('left')
    # esc
    pyautogui.press('esc')
    # press()函数其实是keyDown()和keyUp()函数的包装,模拟的按下然后松开两个动作。
    # 这两个函数可以单独调用。例如,按下shift键的同时按3次左方向键
    #  按下`shift`键
    pyautogui.keyDown('shift')
    pyautogui.press('left')
    pyautogui.press('left')
    pyautogui.press('left')
    #  松开`shift`键
    pyautogui.keyUp('shift')

    # 和typewrite()函数一样,可以用数组把一组键传入press()。例如
    pyautogui.press(['left', 'left', 'left'])

    # 然后按着shift+左箭头,选中world! ,下面left有6个,也就是从!位置开始往左移动
    pyautogui.keyDown('shift')
    pyautogui.press(['left', 'left', 'left', 'left', 'left', 'left'])
    pyautogui.keyUp('shift')
    # 多个键也可以
    secs_between_keys = 0.1
    pyautogui.typewrite(['a', 'b', 'c', 'left', 'backspace', 'enter', 'f1'],
                        interval=secs_between_keys)
    # 按键名称列表
    pyautogui.KEYBOARD_KEYS[:10]
    # 结果是:['\t', '\n', '\r', ' ', '!', '"', '#', '$', '%', '&']

    # 键盘的一些热键像Ctrl-S或Ctrl-Shift-1都可以用hotkey()函数来实现
    pyautogui.hotkey('ctrl', 'a')  # 全选
    pyautogui.hotkey('ctrl', 'c')  # 复制
    pyautogui.hotkey('ctrl', 'v')  # 粘贴

    # 每个按键的按下和松开也可以单独调用
    key_name = 'ctrl'
    pyautogui.keyDown(key_name)
    pyautogui.keyUp(key_name)

    pyautogui.hotkey('ctrl', 'shift', 'ese')
    # 等价于:
    pyautogui.keyDown('ctrl')
    pyautogui.keyDown('shift')
    pyautogui.keyDown('esc')
    pyautogui.keyUp('esc')
    pyautogui.keyUp('shift')
    pyautogui.keyUp('ctrl')
コード例 #56
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def search():
    pyautogui.keyDown("win")
    pyautogui.press("s")
    pyautogui.keyUp("win")
コード例 #57
0
ファイル: Chrome-Dino.py プロジェクト: muratseven/chrome-dino
def pressSpace():  # zıplama ve eğilme
    pyautogui.keyUp('down')
    pyautogui.keyDown('space')
    time.sleep(0.19)
    pyautogui.keyUp('space')
    pyautogui.keyDown('down')
コード例 #58
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def notification():
    pyautogui.keyDown("win")
    pyautogui.press("a")
    pyautogui.keyUp("win")
コード例 #59
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def run():
    pyautogui.keyDown("win")
    pyautogui.press("r")
    pyautogui.keyUp("win")
コード例 #60
0
ファイル: key.py プロジェクト: MBS2003/LESTER
def minimize():
    pyautogui.keyDown("win")
    pyautogui.press("m")
    pyautogui.keyUp("win")