Exemplo n.º 1
0
def execute(]str):


	if str == 'left_mouse click':
		pyautogui.click( button = 'left' )
		print('kam hoise')
	elif str == 'right_mouse click':
		pyautogui.click( button = 'right' )
	elif str == 'middle_mouse click':
		pyautogui.click( button = 'middle' )
	elif str == 'scroll_up':
		pyautogui.scroll(10)
	elif str == 'scroll_down':
		pyautogui.scroll(-10)
	elif str == 'scroll_right':
		pyautogui.hscroll(10)
	elif str == 'scroll_left':
		pyautogui.hscroll(-10)
	elif str == 'page_up':
		pyautogui.press('pgup')
	elif str == 'page_down':
		pyautogui.press('pgdn')
	elif str == 'zoom_out':
		pyautogui.keydown('shift')
		pyautogui.press('+')
		pyautogui.keyup('shift')
	elif str == 'zoom_in':
		pyautogui.keydown('shift')
		pyautogui.press('-')
		pyautogui.keyup('shift')
	elif str == 'refresh':
		pyautogui.press('f5')
	elif str == 'screenshot':
		pyautogui.screenshot()
	elif str == 'volume_up':
		pyautogui.press('volumeup')
	elif str == 'volume_down':
		pyautogui.press('volumedown')
	elif str == 'next_track':
		pyautogui.press('nexttrack')
	elif str == 'prev_track':
		pyautogui.press('prevtrack')
	elif str == 'play/pause':
		pyautogui.press('playpause')
Exemplo n.º 2
0
def move ():	
    deadzone_x = 200
    deadzone_y = 200
    key_delay = 0.4
        
    PORT = "/dev/ttyACM1"
    #~ PORT = "/dev/serial/by-id/usb-MBED_MBED_CMSIS-DAP_9900023431864e45001210060000003700000000cc4d28bd-if01"
    BAUD = 115200
    
    s = serial.Serial(PORT)
    s.baudrate = BAUD
    s.parity = serial.PARITY_NONE
    s.databits = serial.EIGHTBITS
    s.stopbits = serial.STOPBITS_ONE
    
    while True:
        data = s.readline().decode('UTF-8')
        data_list = data.rstrip().split(' ')
        try:
            x, y, z, a, b = data_list
            if int(x) < (0 - deadzone_x) :
                print("A generated")
                pyautogui.typewrite('aaaaa') # This works, but barely
                pyautogui.keydown('a')
                time.sleep(key_delay)
                pyautogui.keyup('a')
            if int(x) > deadzone_x:
                print("D generated")
                pyautogui.keydown('d')
                time.sleep(key_delay)
                pyautogui.keyup('d')
            if int(y) < (0 - deadzone_y):
                print("W generated")
                pyautogui.keydown('w')
                time.sleep(key_delay)
                pyautogui.keyup('w')
            if int(y) > deadzone_y:
                print("S generated")
                pyautogui.keydown('s')
                time.sleep(key_delay)
                pyautogui.keyup('s')
            #~ else:
                #~ pyautogui.keyup('a')
                #~ pyautogui.keyup('d')
                #~ pyautogui.keyup('w')
                #~ pyautogui.keyup('s')
            #~ print(x, y, z, a, b)
        
        except:
            pass
        
    s.close()
Exemplo n.º 3
0
    time.sleep(5)
    pyautogui.doubleClick()  # Double click the mouse at the

    # # pyautogui.typewrite('p')
    # # time.sleep(2)
    # for j in range(1, 45):
    #     pyautogui.keyDown('tab')
    #     pyautogui.keyUp('tab')
    # pyautogui.keyDown('enter')
    # pyautogui.keyUp('enter')
    # j=0
    # for j in range(1, 13):
    #     pyautogui.keyDown('tab')
    #     pyautogui.keyUp('tab')
    #
    # pyautogui.keyDown('enter')
    # pyautogui.keyUp('enter')

    pyautogui.keyDown('Esc')
    pyautogui.keyup('Esc')

    pyautogui.keyDown('ctrl')
    pyautogui.keyDown('enter')
    pyautogui.keyUp('enter')
    pyautogui.keyUp('ctrl')

    time.sleep(3)

    pyautogui.write(['f6'])
    time.sleep(1)
Exemplo n.º 4
0
    def execute(self, str):

        if str == 'left_mouse click':
            pyautogui.click(button='left')
        elif str == 'right_mouse click':
            pyautogui.click(button='right')
        elif str == 'up':
            pyautogui.press('up')
        elif str == 'down':
            pyautogui.press('down')
        elif str == 'right':
            pyautogui.hscroll(10)
        elif str == 'scroll_left':
            pyautogui.hscroll(-10)
        elif str == 'page_up':
            pyautogui.press('pgup')
        elif str == 'page_down':
            pyautogui.press('pgdn')
        elif str == 'spacebar':
            pyautogui.press('space')
        # elif str == 'middle_mouse click':
        #     pyautogui.click( button = 'middle' )
        elif str == 'scroll_up':
            pyautogui.scroll(10)
        elif str == 'scroll_down':
            pyautogui.scroll(-10)
        elif str == 'scroll_right':
            pyautogui.hscroll(10)
        elif str == 'scroll_left':

            pyautogui.hscroll(-10)
        elif str == 'up':
            pyautogui.press('up')
        elif str == 'down':
            pyautogui.press('down')
        elif str == 'page_up':
            pyautogui.press('pgup')
        elif str == 'page_down':
            pyautogui.press('pgdn')

        elif str == 'zoom_out':
            pyautogui.keydown('shift')
            pyautogui.press('+')
            pyautogui.keyup('shift')
        elif str == 'zoom_in':
            pyautogui.keydown('shift')
            pyautogui.press('-')
            pyautogui.keyup('shift')
        elif str == 'refresh':
            pyautogui.press('f5')

        elif str == 'screenshot':
            from time import gmtime, strftime
            showtime = strftime("%Y-%m-%d%H:%M:%S", gmtime())
            #print(showtime)
            pyautogui.screenshot('../../screenshots/' + showtime + '.jpg')
            playsound('camera-shutter-click-01.wav')
        elif str == 'volume_up':
            pyautogui.keyDown('command')
            pyautogui.press('up')
        elif str == 'volume_down':
            pyautogui.press('volumedown')
        elif str == 'next_track':
            pyautogui.press('nexttrack')
        elif str == 'prev_track':
            pyautogui.press('prevtrack')
        elif str == 'play/pause':
            pyautogui.press('playpause')
Exemplo n.º 5
0
def gamecontrol():
    while True:
        if "c" in message.lower():
            pyautogui.keydown('q')
            message = ""
            pyautogui.keyup('q')
Exemplo n.º 6
0
        app = wolframalpha.Client("JP2YWQ-77RG44KALT")
        q = query
        res = app.query(q)
        b = (next(res.results).text)
        engine.say(b)
        engine.runAndWait()
        print(b)
if 'open LinkedIn' in query:
    engine.say('sure opening sir')
    engine.runAndWait()
    webbrowser.open('https://www.linkedin.com/in/anubhab-chowdhury-517549204/')
if 'window' in query:
    pyautogui.keyDown("alt")
    pyautogui.press("tab")
    time.sleep(1)
    pyautogui.keyup("alt")
if 'news' in query:
    main_url = 'https://newsapi.org/v2/top-headlines?sources=techcrunch&apiKey=61c35f9010d544859e1c1f63e51cbe67'
    main_page = requests.get(main_url).json()
    article = main_page["articles"]
    head = []
    day = [
        "first", "second", "third", "fourth", "fifth", "sixth", "seventh",
        "eight", "ninth", "tenth"
    ]
    for ar in article:
        head.append(ar["title"])
    for i in range(len(day)):
        engine.say(f"today's {day[i]} news is :{head[i]}")
        engine.runAndWait()
        print(f"today's {day[i]} news is :{head[i]}")