async def control(websocket, path):
    try:
        async for message in websocket:
            data = json.loads(message)
            logging.debug(data)

            if data['action'] == 'onmouseup':
                pyautogui.mouseDown(**extractMouseParameter(data))
            elif data['action'] == 'onmousedown':
                pyautogui.mouseDown(**extractMouseParameter(data))
            elif data['action'] == 'onmousemove':
                pyautogui.moveTo(duration=0,
                                 **extractMouseParameter(data, button=False))
            elif data['action'] == 'onmousewheel':
                deltax = convertScroll(data['parameter']['deltaX'])
                deltay = convertScroll(data['parameter']['deltaY'])
                if deltax != 0:
                    pyautogui.hscroll(
                        deltax, **extractMouseParameter(data, button=False))
                if deltay != 0:
                    pyautogui.vscroll(
                        deltay, **extractMouseParameter(data, button=False))
            elif data['action'] == 'onclick':
                pyautogui.click(**extractMouseParameter(data))
            elif data['action'] == 'onkeyup':
                key = extractKey(data)
                pyautogui.keyUp(key)
            elif data['action'] == 'onkeydown':
                key = extractKey(data)
                pyautogui.keyDown(key)
            else:
                logging.error("unsupported event: {}", data)
    finally:
        pass
Esempio n. 2
0
def loop(
    joysticks: typing.Iterable[xinput.XInputJoystick],
    mouse_movements: typing.Iterable[MouseMovement],
    mouse_presses: Presses,
    keyboard_presses: Presses
) -> None:
    while True:
        # Dispatch all events.
        for joystick in joysticks:
            joystick.dispatch_events()
        # Mix all controllers together.
        combined = MouseMovement.combine(mouse_movements)
        # Do the mouse movement.
        pyautogui.move(*attr.astuple(combined.position_speed))
        # Do the mouse scrolling.
        pyautogui.hscroll(int(combined.scroll_speed.x))
        pyautogui.vscroll(int(combined.scroll_speed.y))
        # Do the mouse button presses.
        down, up = mouse_presses.process_queue()
        for button in down:
            pyautogui.mouseDown(button=button)
        for button in up:
            pyautogui.mouseUp(button=button)
        # Do the keyboard key presses.
        down, up = keyboard_presses.process_queue()
        for key in down:
            pyautogui.keyDown(key)
        for key in up:
            pyautogui.keyUp(key)
        # Sleep.
        try:
            time.sleep(0.017)
        except KeyboardInterrupt:
            break
Esempio n. 3
0
 def test_scroll(self):
     # TODO - currently this just checks that scrolling doesn't result in an error.
     pyautogui.scroll(1)
     pyautogui.scroll(-1)
     pyautogui.hscroll(1)
     pyautogui.hscroll(-1)
     pyautogui.vscroll(1)
     pyautogui.vscroll(-1)
Esempio n. 4
0
 def test_scroll(self):
     # TODO - currently this just checks that scrolling doesn't result in an error.
     pyautogui.scroll(1)
     pyautogui.scroll(-1)
     pyautogui.hscroll(1)
     pyautogui.hscroll(-1)
     pyautogui.vscroll(1)
     pyautogui.vscroll(-1)
Esempio n. 5
0
def speed(s):
    # s = 1, 1.25, 1.5
    click('setting_drive_video.png')
    click('speed_drive_video.png')
    p.sleep(0.5)
    p.vscroll(-400)
    p.sleep(0.5)
    click('s_{}.png'.format(s))
    click('setting_off_drive_video.png')
	def _handleScroll(self, data):
		move_type = data[:1]
		x = intFromBytes(data[1:5])
		y = intFromBytes(data[5:9])
		# Prevent bug with pyautogui library where x < 10 causes opposite horizontal scrolling behavior
		# https://github.com/asweigart/pyautogui/issues/154
		if not (-9 <= x and x <= -1):
			pyautogui.hscroll(x)
		if y:
			pyautogui.vscroll(y)
Esempio n. 7
0
 def scroll(value, up):  # pylint: disable=invalid-name
     """
     <br>`param value` int, how much to scroll, idk, how it work
     <br>`param up` boolean, scroll up or down
     <br>`return`
     """
     value = int(value)
     if not up:
         value = 0 - value
     pyautogui.vscroll(clicks=value)
     print("scrolled", value)
def guiThread():
    global stackIn, stackOut
    while True:
        try:
            if not stackOut:
                while stackIn:
                    stackOut.append(stackIn.pop())
            # read
            mouseBias = [0, 0]
            mouseClick = False
            str = None
            while stackOut:
                query = stackOut.pop()
                args = query.split()
                if args[0] == "m":
                    dx, dy = map(int, args[1:])
                    mouseBias[0] += dx
                    mouseBias[1] += dy
                elif args[0] == "c":
                    mouseClick = True
                elif args[0] == "t":
                    str = " ".join(args[1:])
                elif args[0] == "h":
                    gui.hotkey(*tuple(args[1:]))
                elif args[0] == "sv":
                    gui.vscroll(int(args[1]))
                elif args[0] == "sh":
                    gui.hscroll(int(args[1]))
                elif args[0] == "ss":
                    gui.screenshot("screenshot.png")
                else:
                    print("What is '{}'".format(query))
            # excute
            gui.move(mouseBias[0], mouseBias[1])
            if mouseClick:
                gui.mouseDown()
                time.sleep(0.01)
                gui.mouseUp()
                mouseClick = False
            if str != None:
                gui.typewrite(str)
        except Exception as e:
            print(e)
            continue
Esempio n. 9
0
def move():
    if running:

        # Run 100 times per second
        threading.Timer(0.01, move).start()

        # Left Analog -> Update mouse
        abs_x = cache.get('ABS_X', 0)
        abs_y = cache.get('ABS_Y', 0)
        mouse_dx = int(abs_x * mouse_sensitivity)
        mouse_dy = int(-abs_y * mouse_sensitivity)
        if mouse_dx**2 + mouse_dy**2 > mouse_epsilon**2:
            pyautogui.moveRel(mouse_dx, mouse_dy)

        # Right Analog -> Scroll
        abs_ry = cache.get('ABS_RY', 0)
        scroll_dy = int(abs_ry * scroll_sensitivity)
        if abs(scroll_dy) > scroll_epsilon:
            pyautogui.vscroll(scroll_dy)
    def fish(self, fish_time, verbose=None):

        # Select Fishing Tab
        auto.moveTo(100, 500)
        auto.scroll(10000)
        auto.click(x=30, y=820, button='left')

        # Move to Bottom Of Tab
        auto.moveTo(x=self.rez[0] / 2, y=self.rez[1] / 2)
        auto.vscroll(-1000)

        # Select Raw Swordfish & Start Fishing
        auto.click(x=464, y=752)
        auto.click(x=855, y=890)

        end = time.time() + fish_time

        while end > time.time():
            time.sleep(60)
            if verbose:
                print("Still Fishing")
Esempio n. 11
0
def main():

    speak("say    'Hi     Jarvis'     to     Activate     -JARVIS-   ")
    while True:
        print("say 'Hi jarvis' to Activate -JARVIS-")
        say = takeCommand().lower()
        if ("hi jarvis" == say):
            wishME()
            while True:

                query = takeCommand().lower(
                )  #Converting user query into lower case
                # Logic for executing tasks based on query
                if 'wikipedia' in query:  #if wikipedia found in the query then this block will be executed
                    speak('Searching Wikipedia...')
                    query = query.replace("wikipedia", "")
                    results = wikipedia.summary(query, sentences=2)
                    speak("According to Wikipedia")
                    print(results)
                    speak(results)

                # My Computer Handle
                elif 'go back' in query:
                    pyautogui.press('backspace')

                elif 'open my computer' in query:
                    path = 'C:\\Windows\\explorer.exe'
                    os.startfile(path)

                elif 'maximize tab' in query:
                    pyautogui.hotkey('win', 'up')

                elif 'go to windows' in query:
                    pyautogui.moveTo(304, 400, duration=0.1)
                    pyautogui.doubleClick()

                elif 'go to games' in query:
                    pyautogui.moveTo(831, 400, duration=0.1)
                    pyautogui.doubleClick()

                elif 'go to music' in query:
                    pyautogui.moveTo(1050, 400, duration=0.1)
                    pyautogui.doubleClick()

                elif 'go to movies' in query:
                    pyautogui.moveTo(296, 450, duration=0.1)
                    pyautogui.doubleClick()

                elif 'go to main' in query:
                    pyautogui.moveTo(552, 457, duration=0.1)
                    pyautogui.doubleClick()

                elif 'go to downloads' in query:
                    pyautogui.moveTo(1013, 267, duration=0.1)
                    pyautogui.doubleClick()

                elif 'items in start' in query:
                    pyautogui.moveTo(54, 755, duration=0.2)
                    pyautogui.click()
                    speak("what do you want to search")
                    say = takeCommand()
                    pyautogui.typewrite(say, interval=0.1)
                    pyautogui.press('enter')

                elif 'system shutdown' in query:
                    pyautogui.hotkey('ctrl', 'esc')
                    pyautogui.moveTo(27, 718, duration=0.1)
                    pyautogui.click()
                    pyautogui.moveTo(59, 629, duration=0.1)
                    pyautogui.click()

                elif 'system restart' in query:
                    pyautogui.hotkey('ctrl', 'esc')
                    pyautogui.moveTo(27, 718, duration=0.1)
                    pyautogui.click()
                    pyautogui.moveTo(57, 657, duration=0.1)
                    pyautogui.click()

                elif 'go to desktop' in query:
                    pyautogui.hotkey('win', 'd')
                # computer handle end

                # File Handling
                elif 'search karo' in query:
                    pyautogui.press('f3')
                    speak('search what sir!')
                    say = takeCommand()
                    pyautogui.write(say, interval=0.1)
                    pyautogui.press('down')
                    pyautogui.press('enter')

                elif 'close' in query:
                    pyautogui.hotkey('ctrl', 'w')

                elif 'create new folder' in query:
                    pyautogui.hotkey('ctrl', 'shift', 'n')
                    say = takeCommand()
                    if 'rename' in say:
                        speak("sir please say name for folder")
                        say = takeCommand()
                        pyautogui.write(say, interval=0.1)
                        pyautogui.press('enter')
                    else:
                        pyautogui.press('enter')

                elif 'maximize' in query:
                    pyautogui.hotkey('win', 'up')

                elif 'minimize' in query:
                    pyautogui.hotkey('win', 'up')

                elif 'copy file' in query:
                    pyautogui.hotkey('ctrl', 'c')

                elif 'paste file' in query:
                    pyautogui.hotkey('ctrl', 'v')

                elif 'cut file' in query:
                    pyautogui.hotkey('ctrl', 'x')

                elif 'open new' in query:
                    pyautogui.hotkey('ctrl', 'n')

                elif 'hold ctrl' in query:
                    pyautogui.keyDown('ctrl')

                elif 'hold shift' in query:
                    pyautogui.keyDown('shift')

                elif 'release ctrl' in query:
                    pyautogui.keyUp('ctrl')

                elif 'release shift' in query:
                    pyautogui.keyUp('shift')

                elif 'select all' in query:
                    pyautogui.hotkey('ctrl', 'a')
                # file handling end

                # Notepad handle
                elif 'open notepad' in query:
                    pyautogui.moveTo(54, 755, duration=0.2)
                    pyautogui.click()
                    pyautogui.write("notepad", interval=0.2)
                    pyautogui.press('enter')

                elif 'save this file' in query:
                    pyautogui.hotkey('ctrl', 's')
                    say = takeCommand()
                    pyautogui.write(say, interval=0.2)
                    pyautogui.press('enter')
                    pyautogui.hotkey('alt', 'f4')

                # Notes end

                # Start handle
                elif 'open start' in query:
                    pyautogui.hotkey('ctrl', 'esc')

                elif 'scroll up' in query:
                    pyautogui.vscroll(343)

                elif 'scroll down' in query:
                    pyautogui.vscroll(-343)

                #start end

                # Wifi Handle
                elif 'connect ' in query:
                    pyautogui.moveTo(1220, 756, duration=0.1)
                    pyautogui.click()
                    time.sleep(2)
                    pyautogui.moveTo(1058, 681, duration=0.1)
                    pyautogui.click()
                    time.sleep(2)
                    pyautogui.moveTo(1220, 756, duration=0.1)
                    pyautogui.click()

                elif 'disconnect ' in query:
                    pyautogui.moveTo(1220, 756, duration=0.1)
                    pyautogui.click()
                    time.sleep(2)
                    pyautogui.moveTo(1058, 681, duration=0.1)
                    pyautogui.click()
                    time.sleep(2)
                    pyautogui.moveTo(1220, 756, duration=0.1)
                    pyautogui.click()
                #wifi end

                elif 'who am i' in query:
                    print(speak)
                    speak(
                        'Your name is Masoom Zaid. You are a python programmer.'
                    )

                elif 'kya kar sakte ho' in query:
                    speak(
                        "Sir I can not        break        the           moon          and            stars             because         won't        be       that       logical        thing "
                    )
                    speak(
                        "But !  Sir    i      Do     allthings      what      do       you        want!"
                    )

                elif ("jarvis" == query):
                    speak("yes sir")

                #km player automation
                elif 'forward' in query:
                    pyautogui.press('right')

                elif 'more forward' in query:
                    pyautogui.press('right', presses=3)

                elif 'backward' in query:
                    pyautogui.press('left')

                elif 'more backward' in query:
                    pyautogui.press('left', presses=3)

                elif 'pause' in query:
                    pyautogui.press('space')

                elif 'play' in query:
                    pyautogui.press('space')

                elif 'full screen' in query:
                    pyautogui.hotkey('ctrl', 'enter')

                elif 'window screen' in query:
                    pyautogui.hotkey('ctrl', 'enter')

                elif 'jyada karo' in query:
                    pyautogui.press('up', presses=5)

                elif 'kam karo' in query:
                    pyautogui.press('down', presses=5)
                # KM Player End

                elif ("search on google" == query):
                    speak(
                        "sir can u tell me what do you want to search on Google"
                    )

                    said = takeCommand()
                    text = said
                    speak("Searching google....")
                    chromedriver = "C:\\Users\\Shadab\\Desktop\\jarvis\\chromedriver.exe"
                    driver = webdriver.Chrome(chromedriver)
                    driver.get("https://www.google.co.in/")
                    driver.find_element_by_name("q").send_keys(text)

                    driver.find_element_by_xpath(
                        "//*[@id='tsf']/div[2]/div[1]/div[3]/center/input[1]"
                    ).click()

                elif ("search on youtube" == query):

                    speak(
                        "sir can u tell me what do you want to search on Youtube"
                    )
                    said = takeCommand()
                    text = said
                    speak("Searching youtube....")
                    driver.get("https://www.youtube.com/")
                    driver.find_element_by_name("search_query").send_keys(text)

                    driver.find_element_by_xpath(
                        "//*[@id='search-icon-legacy']/yt-icon").click()

                elif ("search on gaana" == query):

                    speak(
                        "sir can u tell me what do you want to search on gaana"
                    )
                    said = takeCommand()
                    text = said
                    speak("Searching gaana....")
                    chromedriver = "C:\\Users\\Shadab\\Desktop\\jarvis\\chromedriver.exe"
                    driver = webdriver.Chrome(chromedriver)
                    driver.get("https://gaana.com/")
                    driver.find_element_by_id("sb").send_keys(text)

                    driver.find_element_by_xpath(
                        "//*[@id='mainarea']/div[1]/div[2]/div[1]/div[1]/a"
                    ).click()

                elif 'how are you' in query:
                    speak("i am fine sir thank you for asking!")
                    speak("How can i help you sir")

                elif ("open google" == query):
                    speak("opening google...")
                    webbrowser.open('google.com')

                elif ("google khol do" == query):
                    speak("opening google...")
                    webbrowser.open('google.com')

                elif 'open converter' in query:
                    speak("opening Y 3 Mate...")
                    webbrowser.open(
                        "https://www.y2mate.com/en5/download-youtube")

                elif ("open youtube" == query):
                    speak("opening youtube...")
                    webbrowser.open('youtube.com')

                elif 'open gaana' in query:
                    speak("opening gaana...")
                    webbrowser.open("gaana.com")

                elif 'open facebook' in query:
                    speak("opening facebook....")
                    webbrowser.open("facebook.com")

                elif 'open codewithharry' in query:
                    speak("opening code with harry....")
                    webbrowser.open("codewithharry.com")

                elif 'edureka channel' in query:
                    speak("openeing edureka....")
                    webbrowser.open(
                        "https://www.youtube.com/channel/UCkw4JCwteGrDHIsyIIKo4tQ"
                    )

                elif 'open programming channel' in query:
                    speak("opening sir")
                    webbrowser.open(
                        "https://www.youtube.com/channel/UCeVMnSShP_Iviwkknt83cww"
                    )

                elif 'open stackoverflow' in query:
                    speak("opening stack over flow")
                    webbrowser.open("stackoverflow.com")

                elif 'open torrent' in query:
                    speak("opening torrent...")
                    torrent_path = "C:\\Users\\Shadab\\AppData\\Roaming\\uTorrent\\uTorrent.exe"
                    os.startfile(torrent_path)

                elif 'open photoshop' in query:
                    speak("opening photoshop...")
                    photoshop_path = "C:\\Program Files (x86)\Adobe\\Adobe Photoshop CC 2014 (32 Bit)\\Photoshop.exe"
                    os.startfile(photoshop_path)

                elif 'open vs code' in query:
                    speak("opening v s code...")
                    vs_path = "C:\\Users\\Shadab\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe"
                    os.startfile(vs_path)

                elif 'open pycharm' in query:
                    speak("opening pycharm...")
                    pycharm_path = "C:\\Program Files\\JetBrains\\PyCharm Community Edition 2020.1.2\\bin\\pycharm64.exe"
                    os.startfile(pycharm_path)

                elif 'open music player' in query:
                    speak("opening  audio  player...")
                    km_path = "C:\\KMPlayer\\KMPlayer.exe"
                    os.startfile(km_path)

                elif 'open project folder' in query:
                    speak("opening projects...")
                    path_fol = "H:\\python projects"
                    os.startfile(path_fol)

                elif 'open full course' in query:
                    speak("opening courses...")
                    path_Lio = "H:\\Learn in one video"
                    os.startfile(path_Lio)

                elif 'programming tutorials' in query:
                    speak("opening tutorials...")
                    path_program = "H:\\Programming Videos"
                    os.startfile(path_program)

                elif 'open music folder' in query:
                    speak("opening sir...")
                    path_music = "F:\\New Songs"
                    os.startfile(path_music)

                elif 'play yalgaar song' in query:
                    speak("playing yalgaar ")
                    path_music = "F:\\musics\\15.mp3"
                    os.startfile(path_music)

                elif 'open sublime ' in query:
                    speak("opening sublime.")
                    sublime_path = "C:\\Program Files\\Sublime Text 3\\sublime_text.exe"
                    os.startfile(sublime_path)

                elif 'open voice' in query:
                    speak("opening sir!")
                    voice_path = "C:\\Users\\Public\\Desktop\\Vocal Remover Pro.exe"
                    os.startfile(voice_path)

                elif 'the time' in query:
                    strTime = datetime.datetime.now().strftime("%H:%M:%S")
                    speak(f"Sir, the time is {strTime}")

                elif 'play songs' in query:
                    os.startfile(random.choice(songs))

                elif 'change song' in query:
                    os.startfile(random.choice(songs))

                elif 'quit' in query:
                    speak("ok sir! have a nice day")
                    exit()
pyautogui.FAILSAFE = True
##
# разрешение и позиция
pyautogui.size()
pyautogui.position()
##
# перемещение мыши
pyautogui.moveTo(1920 / 2, 1080 / 2, duration=1)
pyautogui.move(-200, -200, duration=1)
##
# нажатие
pyautogui.click()
pyautogui.doubleClick()
pyautogui.tripleClick()
pyautogui.rightClick()
pyautogui.vscroll(200)
pyautogui.middleClick()
##
# перемещение с зажатием
# pyautogui.position()
pyautogui.moveTo(491, 412, duration=1)
pyautogui.dragTo(125, 412, duration=1)
pyautogui.move(100, None, duration=1)
##
# ввод с клавиатуры
sleep(0.5)
pyautogui.typewrite('Hello, World!', interval=0.2)
##
# нажатие клавиш: press, hotkey
sleep(0.5)
pyautogui.press('enter')
Esempio n. 13
0
def do_scroll(amount):
    print("scrolling " + str(amount))

    pyautogui.vscroll(int(amount))
Esempio n. 14
0
 time.sleep(4)
 driver.find_element_by_xpath(x2).send_keys(ID)
 driver.find_element_by_xpath(x3).send_keys(Password)
 driver.find_element_by_xpath(x4).click()
 time.sleep(3)
 driver.find_element_by_xpath(continue_).click()
 time.sleep(3)
 driver.get(moocs)
 time.sleep(2)
 driver.find_element_by_xpath(x1).click()
 time.sleep(2)
 driver.find_element_by_xpath(x5).click()
 time.sleep(5)
 pg.moveTo(x, y)
 time.sleep(2)
 pg.vscroll(-10)
 time.sleep(1)
 """ カーソルの位置の確認
 print(pg.position())
 time.sleep(1)
 print(pg.position())
 time.sleep(1)
 print(pg.position())
 time.sleep(1)
 print(pg.position())
 time.sleep(1)
 print(pg.position())
 """
 for i in range(slide_count):
     time.sleep(1)
     # 左上のx座標=0, 左上のy座標=50 の位置から幅300, 高さ=400
Esempio n. 15
0
#※ウィンドウの位置を動かしていしまうと座標の位置が変化するので動かさないように注意する
start_btn_x = 730
start_btn_y = 780
pgui.click(start_btn_x, start_btn_y)
print('start click')
time.sleep(5)

#クエストボタンクリック
quest_btn_x = 1454
quest_btn_y = 773
pgui.click(quest_btn_x, quest_btn_y)
print('quest click')
time.sleep(5)

#クエスト一覧から女王杯(PvPバトル)を選択する
pgui.vscroll(1500)
queen_cup_btn_x = 1588
queen_cup_btn_y = 699
pgui.click(queen_cup_btn_x, queen_cup_btn_y)
print('queen cup click')
time.sleep(5)

#女王杯の画面から一番上の対戦相手を選択する
enemy_select_x = 928
enemy_select_y = 453
pgui.click(enemy_select_x, enemy_select_y)
print('select enemy click')
time.sleep(5)

#女王杯出撃画面から出撃する
sortie_btn_x = 1432
Esempio n. 16
0
import pyautogui as m 
import time
import winsound

#       i = 0
#   while i < 10:
#       x1 = 743; y1 = 603
#       m.moveTo(x1, y1)
#       m.click()
#       m.scroll(-3000)
#       m.scroll(-1000)
#       m.vscroll(-1000)
#       time.sleep(0.5)
#       x2 = 2081; y2 = 1372
#       m.moveTo(x2, y2)
#       m.click()
#       time.sleep(4)
#       i += 1

while True:
    m.vscroll(-3000)
    m.vscroll(-1000)
    m.moveTo(1305, 1382)
    m.click()
    time.sleep(2)
# winsound.Beep(1200, 500)

Esempio n. 17
0
    def dataReceived(self, data):
        #fetch commands from data
        cmds = data.split(';');
        
        #exec each command
        for cmd in cmds:
            
            # cmd = object : action < :param < :param < :param ... >>>
            # each cmd contains atleast 'object' & 'action'
            splitted = cmd.split(':');
            
            #invalid cmd?
            if (len(splitted)<2):
                continue
            
            #number of params
            params   = len(splitted)-2

            obj = splitted[0]
            act = splitted[1]
            
            if obj == "mouse":   
                
                if act == "click":
                    if params == 0:
                        pyautogui.click()
                    
                    #click provided a parameter: number of clicks!
                    elif params == 1:
                        clicks = int(float(splitted[2]))
                        pyautogui.click(clicks=clicks)
            
                elif act == "doubleclick":
                    pyautogui.doubleClick()

                elif act == "tripleclick":
                    pyautogui.tripleClick()
                                    
                elif act == "rightclick":
                    pyautogui.rightClick()
                
                elif act == "scroll":
                    if params == 2:
                        x = int(float(splitted[2]))
                        y = int(float(splitted[3]))
                        pyautogui.hscroll(x);
                        pyautogui.vscroll(y);
                                    
                elif act == "drag":
                    if params == 1:
                        # indicate that dragging is activated, but not yet started
                        if splitted[2] == "start":
                            self.dragActive = True
                        # indicate that dragging in disactivated
                        elif splitted[2] == "end":
                            self.dragActive = False
                            #stop dragging when active
                            if self.dragStarted:
                                self.dragStarted = False
                                pyautogui.mouseUp()
                        else:
                            print "Unknown value for 'drag':" + splitted[2]

                    elif params == 2:
                        #are we already dragging?
                        if not self.dragStarted:
                            self.dragStarted = True
                            pyautogui.mouseDown()
                        
                        #fetch x/y movement
                        x = int(float(splitted[2]))
                        y = int(float(splitted[3]))
                        pyautogui.dragRel(x,y, mouseDownUp=False)
 
                                    
                elif act == "move":
                    if params == 2:
                        #fetch x/y movement
                        x = int(float(splitted[2]))
                        y = int(float(splitted[3]))
                        
                        #are we dragging?
                        pyautogui.moveRel(x,y)
                            

            elif obj == "key":
                key = splitted[2]
                print("keypress:" + act + " key:" + key)
                if (act == "press"):
                    pyautogui.press(key)
                elif (act == "down"):
                    pyautogui.keyDown(key)
                elif (act == "up"):
                    pyautogui.keyUp(key)
Esempio n. 18
0
# Sample form Screenshot will be added for reference
import pyautogui
pyautogui.click(582, 708)
pyautogui.typewrite("Paras Garg", interval=0.2)
pyautogui.click(592, 892)
pyautogui.vscroll(-400)
pyautogui.click(584, 710)
pyautogui.typewrite("1", interval=0.2)
pyautogui.vscroll(-200)
pyautogui.leftClick(592, 703)
pyautogui.click(592, 703)
pyautogui.click(592, 837)
pyautogui.vscroll(-500)
pyautogui.click(585, 590)
pyautogui.typewrite("No", interval=0.2)
pyautogui.click(584, 778)
pyautogui.typewrite("*****@*****.**", interval=0.2)
pyautogui.click(600, 866)
    # Speech recognition using Google Speech Recognition
    try:
        # for testing purposes, we're just using the default API key
        # to use another API key, use `r.recognize_google(audio, key="GOOGLE_SPEECH_RECOGNITION_API_KEY")`
        # instead of `r.recognize_google(audio)
        order = r.recognize_google(Listen()).lower()
        print("You said: " + order)

        if (order == "right" or order == "red"):
            pyautogui.click(button='right')
        elif (order == "left"):
            pyautogui.click(button='left')
        elif (order == "double"):
            pyautogui.click(button='left', clicks=2)
        elif (order == "go up"):
            pyautogui.vscroll(30)
        elif (order == "center"):
            pyautogui.moveTo(center_x, center_y)
        elif (order == "go down"):
            pyautogui.vscroll(-30)
        elif (order == "hold"):
            pyautogui.mouseDown(button='left')
            #stop_draging="running"
            print("############ Say "
                  "left"
                  " to stop draging ! #############")

    except sr.UnknownValueError:
        print("Google Speech Recognition could not understand audio")
    except sr.RequestError as e:
        print(
Esempio n. 20
0
def robbot(category ,title, text, price, traffic):
  # 初期ポジ
  pyautogui.moveTo(1, 1, duration=0)
  time.sleep(0.5)
  # データの場所に行く
  pyautogui.moveTo(1000, 115, duration=0.5)
  time.sleep(0.5)
  # ここで本当はドラッグコマンド
  pyautogui.dragTo(500, 700, 1.0, button='left')
  # pyautogui.moveTo(500, 700, duration=1.0)
  # いったんスクロール
  time.sleep(0.5)
  pyautogui.vscroll(-10)
  # 商品名へ移動
  time.sleep(0.5)
  pyautogui.moveTo(50, 500, duration=1.0)
  # クリックして商品名記入
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.click()
  # テキスト記入
  time.sleep(0.5)
  pyperclip.copy(title)
  time.sleep(0.5)

  #以下のコマンドmacとwinで分ける必要がある。
  # 以下mac
  pyautogui.hotkey('command', 'v')
  # 以下win
  # pyautogui.hotkey('ctr', 'v')
  time.sleep(0.5)

  # カテゴリ選択へ
  pyautogui.moveTo(50, 650, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)

  # カテゴリ検索へ
  pyautogui.moveTo(140, 630, duration=1.0)
  # クリックして商品名記入
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyperclip.copy(category)
  time.sleep(0.5)

  #以下のコマンドmacとwinで分ける必要がある。
  # 以下mac
  time.sleep(0.5)
  pyautogui.hotkey('command', 'a')
  time.sleep(0.5)
  pyautogui.hotkey('command', 'v')
  # 以下win
  # pyautogui.hotkey('ctr', 'v')
  time.sleep(0.5)

  # 検索ボタンへ移動クリック
  pyautogui.moveTo(800, 630, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)

  # スクロール
  pyautogui.vscroll(-8)
  time.sleep(0.5)

  # カテゴリを選択
  pyautogui.moveTo(40, 580, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.vscroll(-10)
  time.sleep(0.5)
  pyautogui.moveTo(500, 620, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)


  # 状態選択
  pyautogui.moveTo(140, 350, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.vscroll(-10)
  time.sleep(0.5)
  pyautogui.moveTo(140, 780, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.moveTo(140, 650, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()


  # 横いってクリック
  time.sleep(0.5)
  pyautogui.moveTo(650, 650, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()

  # スクロール
  time.sleep(0.5)
  pyautogui.vscroll(-10)

  # テキスト入力
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.click()
  pyperclip.copy(text)
  time.sleep(0.5)
  pyautogui.hotkey('command', 'a')
  time.sleep(0.5)
  pyautogui.hotkey('command', 'v')

  # 上移動しクリックスクロール
  time.sleep(0.5)
  pyautogui.moveTo(650, 250, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  pyautogui.vscroll(-10)


  # 発送地域選択
  time.sleep(0.5)
  pyautogui.moveTo(140, 650, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.1)
  pyautogui.vscroll(50)
  time.sleep(0.3)
  pyautogui.vscroll(-50)
  time.sleep(0.3)
  pyautogui.moveTo(140, 30, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.moveTo(650, 650, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)


  #送料負担選択
  pyautogui.moveTo(140, 800, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.moveTo(140, 760, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.moveTo(650, 650, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()


  # 発送方法選択
  time.sleep(0.5)
  pyautogui.vscroll(-26)
  time.sleep(0.5)
  pyautogui.moveTo(40, 660, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.click()

  #配送会社指定
  time.sleep(0.5)
  pyautogui.moveTo(100, 660, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.vscroll(-20)
  pyautogui.moveTo(100, 710, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.moveTo(140, 710, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  pyperclip.copy(traffic)
  time.sleep(0.5)
  pyautogui.hotkey('command', 'a')
  time.sleep(0.5)
  pyautogui.hotkey('command', 'v')


  # 発送までの期間を決める
  time.sleep(0.5)
  pyautogui.vscroll(-10)
  time.sleep(0.5)
  pyautogui.moveTo(140, 500, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.moveTo(140, 490, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.moveTo(400, 490, duration=1.0)
  time.sleep(0.5)


  # 値段入力
  pyautogui.vscroll(-10)
  time.sleep(0.5)
  pyautogui.moveTo(40, 450, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  pyperclip.copy(price)
  time.sleep(0.5)
  pyautogui.hotkey('command', 'a')
  time.sleep(0.5)
  pyautogui.hotkey('command', 'v')
  # 即決価格設定
  time.sleep(0.5)
  pyautogui.moveTo(40, 490, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.moveTo(40, 530, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  decision_price = str(int(price) + 200) 
  pyperclip.copy(decision_price)
  time.sleep(0.5)
  pyautogui.hotkey('command', 'a')
  time.sleep(0.5)
  pyautogui.hotkey('command', 'v')


  # 終了する日時
  time.sleep(0.5)
  pyautogui.moveTo(40, 700, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.moveTo(40, 650, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.moveTo(40, 760, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.moveTo(40, 800, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.moveTo(40, 760, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()
  time.sleep(0.5)
  pyautogui.moveTo(400, 770, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()


  time.sleep(0.5)
  pyautogui.vscroll(300)
  time.sleep(0.5)
  pyautogui.moveTo(80, 160, duration=1.0)
  time.sleep(0.5)
  pyautogui.click()

  time.sleep(0.5)
  pyautogui.hscroll(300)
  time.sleep(0.5)
  pyautogui.moveTo(740, 220, duration=1.0)
  
Esempio n. 21
0
     if 'click on link one' in r2.recognize_google(audio):
         print('click on link on')
         site = ("clicking....")
         print(site, s.speak(site))
         pyautogui.moveTo(x=891, y=589)
         pyautogui.click(button='left', x=866, y=392)
         print("mouse click is done")
         s.speak("mouse click is done")
     break
 while True:
     if 'scroll down' in r2.recognize_google(audio):
         print('scroll down')
         site = ("scrolling down....")
         print(site, s.speak(site))
         pyautogui.moveTo(x=891, y=589)
         pyautogui.vscroll(-200, x=866, y=392)
         print("scrolling is done")
         s.speak("scrolling is done")
     break
 while True:
     if 'scroll upward' in r2.recognize_google(audio):
         print('scroll upward')
         site = ("scrolling upward....")
         print(site, s.speak(site))
         pyautogui.moveTo(x=891, y=589)
         pyautogui.vscroll(200, x=866, y=392)
         print("scrolling is done")
         s.speak("scrolling is done")
     break
 while True:
     if 'scroll at the top' in r2.recognize_google(audio):
Esempio n. 22
0
 def scroll(value, up):
     value = int(value)
     if not up:
         value = 0 - value
     pyautogui.vscroll(clicks=value)
     print("scrolled", value)
Esempio n. 23
0
     if 'click on link one' in r2.recognize_google(audio):
         print('click on link on')
         site=("clicking....")
         print(site,s.speak(site))
         pyautogui.moveTo(x=891, y=589)
         pyautogui.click(button='left',x=891,y=589)
         print("mouse click is done")
         s.speak("mouse click is done")
     break
 while True:
     if 'scroll down' in r2.recognize_google(audio):
         print('scroll down')
         site=("scrolling down....")
         print(site,s.speak(site))
         pyautogui.moveTo(x=891, y=589)
         pyautogui.vscroll(-200,x=891,y=589)
         print("scrolling is done")
         s.speak("scrolling is done")
     break
 while True:
     if 'scroll upward' in r2.recognize_google(audio):
         print('scroll upward')
         site=("scrolling upward....")
         print(site,s.speak(site))
         pyautogui.moveTo(x=891, y=589)
         pyautogui.vscroll(200,x=891,y=589)
         print("scrolling is done")
         s.speak("scrolling is done")
     break
 while True:
     if 'scroll at the top' in r2.recognize_google(audio):
Esempio n. 24
0
import pyautogui
from PIL import Image
import time
jpgfile = Image.open("templ5.png")
for i in range (6):
        x, y = pyautogui.locateCenterOnScreen(jpgfile, grayscale=False)
        pyautogui.click(x,y)
        print x,y,"main" 
        for i in range (4):
                
                y=y+119
                 
                pyautogui.click(x,y)
                print x,y
                time.sleep(1)
        pyautogui.vscroll(-8) 
        time.sleep(3)
Esempio n. 25
0
import array
import shutil
import pyperclip

# 初期ポジ
pyautogui.moveTo(1, 1, duration=0)
time.sleep(0.5)
# データの場所に行く
pyautogui.moveTo(1000, 115, duration=0.5)
time.sleep(0.5)
# ここで本当はドラッグコマンド
pyautogui.dragTo(500, 700, 1.0, button='left')
# pyautogui.moveTo(500, 700, duration=1.0)
# いったんスクロール
time.sleep(0.5)
pyautogui.vscroll(-10)
# 商品名へ移動
time.sleep(0.5)
pyautogui.moveTo(50, 500, duration=1.0)
# クリックして商品名記入
time.sleep(0.5)
pyautogui.click()
time.sleep(0.5)
pyautogui.click()
# テキスト記入
time.sleep(0.5)
text = "BRIDGESTONE(ブリヂストン)ソーラーテールランプSLR100NF700040DGCSLR100N"
pyperclip.copy(text)
time.sleep(0.5)

#以下のコマンドmacとwinで分ける必要がある。
Esempio n. 26
0
pyautogui.PAUSE = 5  # 5 seconds till start
pyautogui.FAILSAFE = True  # drag mouse top left to stop
likeCounter = 0
y = input("enable sleep?")
t = input("how many likes?")

while (int(likeCounter) <= int(t)):

    if ((randrange(101) < 4) and (y == "yes")):
        x = randrange(1000)
        print("sleeping for: " + str(x) + " seconds...")
        print("total likes botted: " + str(likeCounter))
        time.sleep(x)
    else:
        try:
            x, y = pyautogui.locateCenterOnScreen('hearticon.png',
                                                  grayscale=True,
                                                  confidence=0.99)
            #print(x, y)
            x = (x / 2) - 42
            y = y / 2
            if ((x or y) != None):
                pyautogui.click(x, y)
                likeCounter += 1
                print("Likes placed: " + str(likeCounter))
        except Exception:
            pass
            randomScrollAmount = uniform(1.0, 20.0)
            #print("scrolling: "+str(randomScrollAmount))
            pyautogui.vscroll((randomScrollAmount * -1))
Esempio n. 27
0
pyautogui.tripleClick(x=None, y=None, interval=0.0, button='left', duration=0.0, tween=pyautogui.linear)

#右击
pyautogui.rightClick()

#中击
pyautogui.middleClick()

#  用缓动/渐变函数让鼠标2秒后移动到(500,500)位置
#  use tweening/easing function to move mouse over 2 seconds.
pyautogui.moveTo(x=500, y=500, duration=2, tween=pyautogui.easeInOutQuad)

#鼠标拖拽
pyautogui.dragTo(x=427, y=535, duration=3,button='left')

#鼠标相对拖拽
pyautogui.dragRel(xOffset=100,yOffset=100,duration=,button='left',mouseDownUp=False)

#鼠标移动到x=1796, y=778位置按下
pyautogui.mouseDown(x=1796, y=778, button='left')

#鼠标移动到x=2745, y=778位置松开(与mouseDown组合使用选中)
pyautogui.mouseUp(x=2745, y=778, button='left',duration=5)

#鼠标当前位置滚轮滚动
pyautogui.scroll()
#鼠标水平滚动(Linux)
pyautogui.hscroll()
#鼠标左右滚动(Linux)
pyautogui.vscroll()
Esempio n. 28
0
number_of_friends = int(input("Enter number of friends: "))
fr_h = number_of_friends * 105  # length of friends list in pixels
scr_h = pg.size()[1] - 165  # length of visible friends screen
scrollheight = scr_h - 210
rolls = int(fr_h // scrollheight)

for z in range(2, 0, -1):  # time to get ready
    print(f"Start in {z}")
    time.sleep(1)
print('START')

counter = 0
try:
    for roll in range(rolls):
        # print('scroll', roll)
        dogs = pg.locateAllOnScreen('dog.png')
        for dog in dogs:
            if dog[1] < pg.size()[1] - 110:
                pg.moveTo(dog, duration=0.2)
                delete_friend()
                counter += 1
                print('Del:', counter)
                pg.moveTo(dog, duration=0.2)
        pg.vscroll(-scrollheight)
        if dogs:
            time.sleep(0.3)
except KeyboardInterrupt:
    print('Stopped by user')
print(f"Unfriended {counter} DELETED friends"
      if counter else "No DELETED friends found")
        if action_text=='Movingmouse' or action_text_prev != action_text:
            # print('actionL', action_text)
            action_text_prev = action_text
            if action_text == 'Righthandnext':
                print('Righthandnext')
                pyautogui.hotkey('ctrl', 'tab')
            elif action_text == 'Movingmouse':
                print('Movingmouse')
                # leftWrist = humans[0].body_parts.get(4)
                data = np.array(list(action_q))
                # print('hand height:', data[4, 4 * 2 + 1])
                # by experiment.
                neck_y = data[4, 1 * 3 + 1]
                # print('neck_y:',neck_y)
                if (data[4, 4 * 3 + 1]) < neck_y:
                    pyautogui.vscroll(1)
                else:
                    pyautogui.vscroll(-1)
            else:
                print('Looking')
                1 + 1  # looking case

        cv2.imshow('tf-pose-estimation result', image)
        fps_time = time.time()
        if cv2.waitKey(1) == 27:
            break
        # logger.debug('finished+')

    cv2.destroyAllWindows()

'''
Esempio n. 30
0
def perform_capture():
    ''' read frames from the webcam and perform pupil detection '''
    global calibration_done, debug
    global height, width

    if height is None or width is None:
        read_dimensions(None, None)

        # if we still don't have dimensions, just make 'em up
        if height is None or width is None:
            height, width = 1, 1

    prev_p1, prev_p2 = None, None  # the previous positions of the two pupils
    init_y1, init_y2 = 0, 0  # the initial y position of both pupils
    T = 3  # threshold distance that each pupil must have moved less
    # than between frames to be considered calibrated

    t = .5

    if smooth_scrolling:
        conn = Client(('localhost', 6000), authkey=b'password')

    cap = cv.VideoCapture(0)

    while True:
        _, frame = cap.read()

        gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
        pupils, eyes, face = detect_pupils(gray,
                                           ret_eyes=True,
                                           ret_face=True,
                                           rel_coords=False)

        if calibration_done is None:
            if display:
                cv.imshow('frame', frame)
        elif not calibration_done:
            # Calibration is stopped when there are two consecutive frames where
            # the L2 distance of the (x, y) positions that each pupil has moved between
            # frames is smaller than a threshold.
            #
            # Therefore, if we are here, then that condition has not yet been satisfied.
            # Usually, this happens pretty quickly so this is probably towards the beginning of capture.

            if display:
                for p in pupils:
                    cv.circle(frame, (int(p['x']), int(p['y'])), int(p['r']),
                              (0, 0, 255), 2)

                for ex, ey, ew, eh in eyes:
                    cv.rectangle(frame, (int(ex), int(ey)),
                                 (int(ew + ex), int(eh + ey)), (0, 0, 255), 2)

                cv.imshow('frame', frame)

            if len(pupils) == 2:
                # Only determine if this frame is good enough to end
                # calibration if there are two pupils found. Crazy, right?

                p1, p2 = pupils[0], pupils[1]

                if prev_p1 is None or prev_p2 is None:
                    # If this is the first frame, then prev_p1
                    # and prev_p2 will be None, so set them.

                    prev_p1 = (p1['x'], p1['y'])
                    prev_p2 = (p2['x'], p2['y'])
                else:
                    # Otherwise, we are in not the first frame and should
                    # compare the found pupil positions to their previous position.

                    curr_p1 = (p1['x'], p1['y'])
                    curr_p2 = (p2['x'], p2['y'])

                    dist1 = dist(prev_p1, curr_p1)
                    dist2 = dist(prev_p2, curr_p2)

                    if dist1 < T and dist2 < T:
                        # Only consider calibrated if BOTH the distances moved
                        # is less than the threshold.

                        calibration_done = True

                        pad = 10  # This padding is used for two things:
                        #       1. Determining the upper boundary of the eye
                        oy1 = p1[
                            'r'] + pad  #          bounding box for tracking (giving the pupil some margin).
                        #       2. Trimming the horizontal dimension of the eye
                        oy2 = p2[
                            'r'] + pad  #          so that the corners and other junk is not included.
                        # This is a very crude method but it seem to works OK.

                        # The pupil tracker takes a tuple defining a circle as:
                        #       (x center, y center, radius)
                        tp1 = init_tracker((p1['x'], p1['y'], p1['r']), 'csrt',
                                           frame, 'pupil')

                        tp2 = init_tracker((p2['x'], p2['y'], p2['r']), 'csrt',
                                           frame, 'pupil')

                        init_y1 = p1['y']  #-eyes[0][1]
                        init_y2 = p2['y']  #-eyes[1][1]
                    else:
                        # Otherwise, update prev_p1 and
                        # prev_p2 and keep on chugging.

                        prev_p1 = curr_p1
                        prev_p2 = curr_p2

        else:
            # Once calibration has completed, we have four trackers:
            #       * One for the left eye (and one for the right eye)
            #       * One for the left pupil (and one for the right pupil)
            # These trackers are named:
            #       te1, tp1, te2, and tp2

            if len(eyes) > 0 and len(pupils) > 0:
                # This check is to make sure we do not try to track the pupil
                # when the user is blinking.
                #
                # During blinking, the eye trackers are not affected,
                # but the pupil trackers often jump to the eyebrow.
                #
                # The len(eyes) check is basically useless, but
                # len(pupils) ensures that the user is blinking (hopefully).

                p1 = track(tp1, frame, 'pupil')

                if display:
                    draw_circle(frame, p1)

                # The bounding box returned from track is of the format:
                #       (x origin, y origin, x width, y height)
                # So to determine the new y position, add half the height
                # to the origin.

                new_y1 = (p1[1] + p1[3] / 2)  #-ey
                delta_y1 = new_y1 - init_y1

                p2 = track(tp2, frame, 'pupil')

                if display:
                    draw_circle(frame, p2)

                new_y2 = (p2[1] + p2[3] / 2)  #-ey
                delta_y2 = new_y2 - init_y2

                if display:
                    cv.circle(frame, (int(p1[0]), int(init_y1)),
                              int(p1[3] / 2), (0, 255, 0), 2)
                    cv.circle(frame, (int(p2[0]), int(init_y2)),
                              int(p2[3] / 2), (0, 255, 0), 2)

                # To determine the amount to scroll, take the average
                # of the two y-deltas and scale it by the viewport height/1000.
                #
                # The viewport height scaling factor is used because of the
                # typical pixel height of my web browser. This would need
                # to be changed for different viewports.
                #
                # The scroll amount is also negated since positive y-delta's
                # correspond to downward movement but positive scroll amounts
                # correspond to upwards scrolling.

                mean_delta = (delta_y1 + delta_y2) / 2.
                scroll_amt = -(mean_delta) / height * 1000

                if smooth_scrolling:
                    if abs(scroll_amt) > t:
                        if scroll_amt > 0:
                            scroll_amt *= 10
                        conn.send('scroll:' + str(scroll_amt))
                else:
                    gui.vscroll(scroll_amt)

            if display:
                cv.imshow('frame', frame)

        key = cv.waitKey(1) & 0xFF
        if key == ord('q'):
            break

    if smooth_scrolling:
        conn.send('close')
        conn.close()

    cv.destroyAllWindows()
    cap.release()
Esempio n. 31
0
     if 'click on link one' in r2.recognize_google(audio):
         print('click on link on')
         site = ("clicking....")
         print(site, s.speak(site))
         pyautogui.moveTo(x=1165, y=272)
         pyautogui.click(button='left', x=1165, y=272)
         print("mouse click is done")
         s.speak("mouse click is done")
     break
 while True:
     if 'scroll down' in r2.recognize_google(audio):
         print('scroll down')
         site = ("scrolling down....")
         print(site, s.speak(site))
         pyautogui.moveTo(x=1165, y=272)
         pyautogui.vscroll(-200, x=1165, y=272)
         print("scrolling is done")
         s.speak("scrolling is done")
     break
 while True:
     if 'scroll upward' in r2.recognize_google(audio):
         print('scroll upward')
         site = ("scrolling upward....")
         print(site, s.speak(site))
         pyautogui.moveTo(x=1165, y=272)
         pyautogui.vscroll(200, x=1165, y=272)
         print("scrolling is done")
         s.speak("scrolling is done")
     break
 while True:
     if 'scroll at the top' in r2.recognize_google(audio):
Esempio n. 32
0
#   That can abort the program
pyautogui.FAILSAFE = True
# move mouse to XY coordinates over num_second seconds
pyautogui.moveTo(x, y, duration=num_seconds)
# move mouse relative to its current position
pyautogui.moveRel(xOffset, yOffset, duration=num_seconds)
# drag mouse to XY
pyautogui.dragTo(x, y, duration=num_seconds)
# drag mouse relative to its current position
pyautogui.dragRel(xOffset, yOffset, duration=num_seconds)
# Hold click to somewhere
pyautogui.rightClick(x=moveToX, y=moveToY)
pyautogui.middleClick(x=moveToX, y=moveToY)
pyautogui.doubleClick(x=moveToX, y=moveToY)
pyautogui.tripleClick(x=moveToX, y=moveToY)
# Positive scrolling will scroll up, negative scrolling will scroll down:
pyautogui.scroll(amount_to_scroll, x=moveToX, y=moveToY)
pyautogui.hscroll(10)  # scroll right 10 "clicks"
pyautogui.vscroll(10)  # scroll top 10 "clicks"
# To print all types of key names
pyautogui.KEYBOARD_KEYS
# Hotkeys
pyautogui.hotkey('ctrl', 'c')  # ctrl-c to copy
pyautogui.hotkey('ctrl', 'v')  # ctrl-v to paste
# Press Key
pyautogui.press('enter')  # press the Enter key
# Hold key pressed or down
pyautogui.keyDown('shift')  # hold down the shift key
# Release Key pressed
pyautogui.keyUp('shift')  # Release the shift key