コード例 #1
0
ファイル: AutomaticScolder.py プロジェクト: Tom-Li1/P-works
class AutomaticScolder():
	def __init__(self):
		self.m = PyMouse()
		self.k = PyKeyboard()
		self.words = {
			'name':[],
			'location':["厕所里","宿舍里","房顶上","草坪上","树上","草丛里","操场上","教室里"],
			'verb':["吃","喝","玩","摸","拿","踢","举起","放下"],
			'noun':["屎","尿","鸡巴","屁眼","头","大屌","逼"]
			}

	def buildUpSentence(self):
		word_list = [] # Be used to temporary store words for one sentence.
		for v in self.words.values():
			word_list.append(random.choice(v)) # random choice a word from the words dic and append into word list.
		return "{0}在{1}{2}{3}".format(word_list[0], word_list[1], word_list[2], word_list[3]) # return the sentence be formated.

	def sendSentence(self):
		pyperclip.copy(self.buildUpSentence())
		self.k.press_key(self.k.control_key) 
		self.k.tap_key('V')
		time.sleep(0.1)
		self.k.release_key(self.k.control_key)
		time.sleep(0.1)
		self.k.tap_key(self.k.enter_key)
コード例 #2
0
class Robot(object):

    def __init__(self):
        self.mouse = PyMouse()
        self.keyboard = PyKeyboard()
        self.przyciskPSP2klawiatura = {'up': 'w', 'right': 'd', 'down': 's', 'left': 'a', 'triangle': self.keyboard.enter_key,
                                       'circle': 'f', 'cross': 'g', 'square': 'h', 'l': self.keyboard.control_r_key, 'r': self.keyboard.shift_r_key, 'start': 'k', 'select': 'l'}

    def reaguj(self, x, y, przyciskPSP2Stan):
        self.reaguj_mysz(x, y)
        self.reaguj_klawiatura(przyciskPSP2Stan)

    def reaguj_mysz(self, x, y):
        max_predkosc_kursora = 0.00000000000000000000000000000000000000000000000000001
        x += int((x / float(128)) * max_predkosc_kursora +
                 self.mouse.position()[0])
        y += int((y / float(128)) * max_predkosc_kursora +
                 self.mouse.position()[1])
        x, y = min(self.mouse.screen_size()[0], x), min(
            self.mouse.screen_size()[1], y)
        x, y = max(0, x), max(0, y)
        self.mouse.move(x, y)

    def reaguj_klawiatura(self, przyciskPSP2Stan):
        for przycisk_psp, czyWcisniety in przyciskPSP2Stan.iteritems():
            przycisk_klawiaturowy = self.przyciskPSP2klawiatura[przycisk_psp]
            if czyWcisniety == '1':
                if przycisk_klawiaturowy == 'g':
                    self.mouse.click(*self.mouse.position())
                    break
                self.keyboard.press_key(przycisk_klawiaturowy)
            else:
                self.keyboard.release_key(przycisk_klawiaturowy)
コード例 #3
0
ファイル: Func.py プロジェクト: TigerReborn/SkypeBot
def sendMessage(message):
    if Var.locked:
        return

    if not (type(message) is str):
        try:
            message = str(message)
        except Exception:
            pass

    try:
        message = message.encode('ascii', 'ignore')
    except Exception:
        message = message.encode('utf-8', 'ignore')

    Var.locked = True
    k = PyKeyboard()

    try:
        k.type_string(message)
    except Exception:
        k.press_key(k.control_l_key)
        k.tap_key('A')
        k.release_key(k.control_l_key)
        k.tap_key(k.backspace_key)

        k.type_string("Message Contains Unknown Characters")

    k.tap_key(k.enter_key)
    Var.locked = False
コード例 #4
0
ファイル: HIDremServer.py プロジェクト: nowyouare/HIDrem
class HIDremServerProtocol(com.LengthPrefixedReceiver):
	"""The communication protocol."""
	def setup(self):
		self.k = PyKeyboard()
		self.m = PyMouse()
	
	def got_message(self, msg):
		"""called when a message was received."""
		if not msg:
			return
		idb, msg = msg[0], msg[1:]
		if idb == common.ID_PING:
			# echo message
			self.send_message(idb + msg)
		elif idb == common.ID_KEYBOARD:
			action, keyname = msg[0], msg[1:]
			if action == common.ACTION_PRESS:
				self.k.press_key(keyname)
			elif action == common.ACTION_RELEASE:
				self.k.release_key(keyname)
			else:
				# protocol violation
				self.close()
		elif idb == common.ID_MOUSE:
			pass
		else:
			# protocol violation
			self.close()
コード例 #5
0
def change_window_start():

    print('*_* change_window_start')
    k = PyKeyboard()
    k.release_key(k.alt_key)
    k.press_key(k.alt_key)
    k.tap_key(k.tab_key)
コード例 #6
0
def Voice_Game():
    button_1 = PyKeyboard()
    NUM_SAMPLES = 1000
    pa = PyAudio()
    while True:
        SAMPLING_RATE = int(
            pa.get_device_info_by_index(0)['defaultSampleRate'])
        stream = pa.open(format=paInt16,
                         channels=1,
                         rate=SAMPLING_RATE,
                         input=True,
                         frames_per_buffer=NUM_SAMPLES)
        string_audio_data = stream.read(NUM_SAMPLES)
        k = max(struct.unpack('1000h', string_audio_data))
        if k > 3000:
            button_1.press_key("a")
            time.sleep(1)
            button_1.release_key("a")
        if k > 8000:
            #    button_1.tap_key("^[[D")
            button_1.tap_key("w")
            time.sleep(1)
            button_1.release_key("w")
        if k > 13000:
            #    button_1.tap_key("^[[D")
            button_1.tap_key("s")
            time.sleep(1)
            button_1.release_key("s")
        time.sleep(0.1)
    return 0
コード例 #7
0
def previous_focus():

    print('*_* next_focus')
    k = PyKeyboard()
    k.press_key(k.shift_key)
    k.tap_key(k.tab_key)
    k.release_key(k.shift_key)
コード例 #8
0
ファイル: robouser.py プロジェクト: boylea/qtbot
def key_combo(key0, key1):
    k = PyKeyboard()
    if key0 == 'ctrl':
        key0 = k.control_key
    k.press_key(key0)
    k.tap_key(key1)
    k.release_key(key0)
コード例 #9
0
ファイル: pymouse_demo.py プロジェクト: 612twilight/toolkits
def xx():
    br = webdriver.Chrome(r"D:/迅雷下载/chromedriver_win32/chromedriver.exe")
    br.implicitly_wait(30)
    # 设置浏览器最大化
    br.maximize_window()
    br.get('http://www.baidu.com')
    m = PyMouse()
    kb = PyKeyboard()
    time.sleep(3)

    m.click(650, 358, 1)
    # kb.press_key(kb.control_key)
    # kb.press_key(kb.shift_key)
    # kb.release_key(kb.control_key)
    # kb.release_key(kb.shift_key)
    kb.type_string("test")
    kb.press_key(kb.enter_key)
    kb.release_key(kb.enter_key)
    time.sleep(5)
    m.click(763, 143, 1)
    time.sleep(10)

    # 获取当前坐标的位置
    tt = m.position()
    print(tt)
コード例 #10
0
    def test_changetime_ui(self):
        #close auto-sync
        self.td.SetNTP(0)

        k = PyKeyboard()
        m = PyMouse()
        c_hour = strftime('%H', localtime())
        new_hour = int(c_hour) + 1
        self.dcc.showModule('datetime')
        self.dcc.dccObj.child('Time Settings', roleName='frame').click()
        time.sleep(1)
        k.press_key('Tab')
        k.release_key('Tab')
        time.sleep(1)
        k.type_string(str(new_hour))
        time.sleep(1)
        (x, y) = m.position()
        print(x + 95, y + 69)
        m.click(x + 95, y + 69)
        time.sleep(2)

        changed_hour = strftime('%H', localtime())
        print(new_hour, changed_hour)
        self.assertTrue(int(new_hour) == int(changed_hour))

        self.dcc.page_deep += 2
        self.dcc.backToIndex()
コード例 #11
0
ファイル: ioFacade.py プロジェクト: eric-horvat/match3bot
def switchFocus(n=1, sleepTime=0.1):
    """ Performs alt tab, can skip n-1 applications """
    k = PyKeyboard()
    k.press_key(k.alt_key)
    time.sleep(sleepTime)
    for i in range(n):
        k.tap_key(k.tab_key)
        time.sleep(sleepTime)
    k.release_key(k.alt_key)
コード例 #12
0
def close_tab():
    print('*_* new_tab')
    k = PyKeyboard()
    k.release_key(k.control_l_key)

    k.press_key(k.control_l_key)
    k.tap_key(k.function_keys[4])F

    k.release_key(k.control_l_key)
コード例 #13
0
class EasyMonkey:
    def __init__(self):
        self.mouse = PyMouse()
        self.keyboard = PyKeyboard()
        self.sleep = 0.5
        time.sleep(1)

    # 模拟鼠标左键单击
    def left_click(self, x, y):
        self.mouse.move(x, y)
        self.mouse.click(x, y)
        print("在(%s,%s)位置进行了鼠标左键单击操作" % (x, y))
        time.sleep(self.sleep)
        return x, y

    # 模拟鼠标左键双击
    def left_doubleclick(self, x, y):
        self.mouse.move(x, y)
        self.mouse.click(x, y, button=1, n=2)
        print("在(%s,%s)位置进行了鼠标左键双击操作" % (x, y))
        time.sleep(self.sleep)
        return x, y

    # 模拟鼠标右键单击
    def right_click(self, x, y):
        self.mouse.move(x, y)
        self.mouse.click(x, y, button=2, n=1)
        print("在(%s,%s)位置进行了鼠标右键单击操作" % (x, y))
        self.mouse.click(x, y, button=1, n=1)
        time.sleep(self.sleep)
        return x, y

    # 模拟使用键盘随机按键
    def enter_key(self, x, y):
        self.mouse.move(x, y)
        keys = [
            "a", "b", self.keyboard.numpad_keys[2],
            self.keyboard.numpad_keys[4]
        ]
        index = random.randint(0, (len(keys) - 1))
        key = keys[index]
        self.keyboard.press_key(key)
        self.keyboard.release_key(key)
        print("在(%s,%s)位置进行了键盘随机按键操作" % (x, y))
        time.sleep(self.sleep)
        return x, y

    # 模拟使用键盘产生随机输入
    def input_key(self, x, y):
        self.mouse.move(x, y)
        strs = ["123", "456"]
        index = random.randint(0, (len(strs) - 1))
        str0 = strs[index]
        self.keyboard.type_string(str0)
        print("在(%s,%s)位置进行了键盘产生随机输入操作" % (x, y))
        time.sleep(self.sleep)
        return x, y
コード例 #14
0
def new_tab():
    print('*_* new_tab')
    k = PyKeyboard()
    k.release_key(k.control_l_key)

    k.press_key(k.control_l_key)
    k.tap_key('t')

    k.release_key(k.control_l_key)
コード例 #15
0
 def desktop_by_number(inp):  # switches desktop on mac
     inp = tp.breakOuter()
     if self.booltesting:
         if not inp.isdigit() or len(inp) != 1:
             raise RuntimeError("invald direction")
     kb = PyKeyboard()
     kb.press_key('control')
     kb.tap_key(inp)
     kb.release_key('control')
コード例 #16
0
    def webbrowser_login(self, q):
        m = PyMouse()
        k = PyKeyboard()
        with open('browser_setting.txt') as b:
            bro = b.readlines()
            for index, i in enumerate(bro):
                bro_name, browser = i.strip().split(',', 1)

                # 浏览器地址
                chromepath = browser
                web.register(bro_name, None, web.BackgroundBrowser(chromepath))

                url = 'http://sem.taobao.com/login.html'
                web.get(bro_name).open(url, new=1)
                time.sleep(5)

                k.tap_key(k.right_key)
                k.tap_key(k.enter_key)
                time.sleep(1)

                # 读取用户名和密码
                with open('name_pwd.txt', encoding='utf8') as f:
                    n_p = f.readlines()
                    name_pwd = n_p[index].split(',')
                    username = name_pwd[0]
                    password = name_pwd[1]

                    pyperclip.copy(username)    # 复制用户名

                    m.click(900, 285)
                    time.sleep(1)

                    # 组合键-复制粘贴
                    k.press_key(k.control_key)  # 按住alt键
                    k.tap_key('v')    # 点击v建
                    k.release_key(k.control_key)    # 松开alt键
                    time.sleep(1)

                    k.tap_key(k.tab_key)
                    pyperclip.copy(password)
                    time.sleep(1)

                    # 组合键-粘贴
                    k.press_key(k.control_key)  # 按住alt键
                    k.tap_key('v')
                    k.release_key(k.control_key)    # 松开alt键
                    time.sleep(1)

                    k.tap_key(k.enter_key)
                    time.sleep(5)

                    message = q.get()
                    print(message)
                    if '抓包完成' == message:
                        # 解析包
                        self.parse_pcap()
コード例 #17
0
def next_tab():

    print('*_* next_tab')
    k = PyKeyboard()

    k.press_key(k.control_l_key)
#    k.press_key(k.shift_key)
    k.tap_key(k.tab_key)

    k.release_key(k.control_l_key)
コード例 #18
0
def previousPage():
    from pykeyboard import PyKeyboard
    import time

    k = PyKeyboard()
    time.sleep(0.1)

    k.press_key(k.left_key)
    time.sleep(0.05)
    k.release_key(k.left_key)
コード例 #19
0
def capture(url, save_fn="capture.png"):
    mouse = PyMouse()
    keyboard = PyKeyboard()

    browser = webdriver.Firefox(executable_path='/home/wws/Soft/geckodriver'
                                )  # Get local session of firefox

    browser.set_window_size(1900, 900)
    browser.get(url)

    mouse.click(300, 250)
    # Load page
    #   browser.execute_script("""
    #   (function () {
    #     var y = 0;
    #     var step = 100;
    #     window.scroll(0, 0);
    #
    #     function f() {
    #       if (y < document.body.scrollHeight) {
    #         y += step;
    #         window.scroll(0, y);
    #         setTimeout(f, 50);
    #       } else {
    #         window.scroll(0, 0);
    #         document.title += "scroll-done";
    #       }
    #     }
    #
    #     setTimeout(f, 1000);
    #   })();
    # """)
    #   browser.execute_script()

    # browser.save_screenshot('first.png')
    keyboard.press_keys([keyboard.shift_key, 'F2'])
    # keyboard.release_keys(["Shift","F2"])
    # png = base64.b64decode(browser.execute('screenshot --fullpage')['value'].encode('ascii'))
    # with open('first1.png', 'wb') as f:
    #     f.write(png)
    # # browser.execute("screenshot")
    #
    # keyboard.press_key(keyboard.page_down_key)
    # keyboard.release_key(keyboard.page_down_key)
    # time.sleep(1)
    # browser.save_screenshot('second.png')
    # browser.close()
    time.sleep(1)
    keyboard.type_string(
        "screenshot --fullpage /home/wws/workspace/git/SPIDER/Crawler-master/amazon/fullpage.png"
    )

    keyboard.press_key(keyboard.enter_key)
    keyboard.release_key(keyboard.enter_key)
    time.sleep(1)
コード例 #20
0
ファイル: test.py プロジェクト: xhyumiracle/SyWorld
def keyboard(event):
    if event.KeyID == 27:
        key = PyKeyboard()
        print "key1"
        key.press_key(162)  # ctrl
        key.press_key(67)  # c
        key.release_key(67) # c
        key.release_key(162)  # ctrl
        print "key2"
    print event.KeyID
    return True
コード例 #21
0
    def run(self, args):

        # for windows 10, if the UseLogonCredential registry is not present or disable (equal to 0), not plaintext password can be retrieved using mimikatz.
        if args.wdigest:
            ok, message = self.client.conn.modules["pupwinutils.wdigest"].wdigest(args.wdigest)
            if ok:
                self.success(message)
            else:
                self.warning(str(message))
            return

        proc_arch       = self.client.desc["proc_arch"]
        mimikatz_path   = None
        output          = ''

        if "64" in proc_arch:
            mimikatz_path = self.client.pupsrv.config.get("mimikatz","exe_x64")
        else:
            mimikatz_path = self.client.pupsrv.config.get("mimikatz","exe_Win32")

        if not os.path.isfile(mimikatz_path):
            self.error("Mimikatz exe %s not found ! please edit Mimikatz section in pupy.conf"%mimikatz_path)
        else:
            mimikatz_args = args.args
            interactive = False

            if not mimikatz_args:
                interactive = True
            else:
                mimikatz_args.append('exit')

            if args.logonPasswords:
                mimikatz_args = ['privilege::debug', 'sekurlsa::logonPasswords', 'exit']
                interactive = True

            output = exec_pe(self, mimikatz_args, path=mimikatz_path, interactive=interactive)

            try:
                from pykeyboard import PyKeyboard
                k = PyKeyboard()
                k.press_key(k.enter_key)
                k.release_key(k.enter_key)
            except:
                pass

        # store credentials into the database
        if output:
            try:
                creds = self.parse_mimikatz(output)
                db = Credentials(client=self.client.short_name(), config=self.config)
                db.add(creds)
                self.success("Credentials stored on the database")
            except:
                self.error('No credentials stored in the database')
コード例 #22
0
def previous_tab():

    print('*_* previous_tab')
    k = PyKeyboard()

    k.press_key(k.control_l_key)
    k.press_key(k.shift_key)
    k.tap_key(k.tab_key)

    k.release_key(k.control_l_key)
    k.release_key(k.shift_key)
コード例 #23
0
def nextpage():
    from pykeyboard import PyKeyboard
    import time

    k = PyKeyboard()
    time.sleep(0.1)
    # To Create an Alt+Tab combo
    #k.press_key(k.alt_key)
    k.press_key(k.next_key)
    time.sleep(0.05)
    k.release_key(k.next_key)
コード例 #24
0
def keyboard(event):
    if event.KeyID == 27:
        key = PyKeyboard()
        print "key1"
        key.press_key(162)  # ctrl
        key.press_key(67)  # c
        key.release_key(67)  # c
        key.release_key(162)  # ctrl
        print "key2"
    print event.KeyID
    return True
コード例 #25
0
def auto_submit_and_shutdown(result_name,
                             submit_time,
                             sleep_time=600,
                             shutdown_flag=False):
    while (True):
        if (submit_time == time.strftime('%H:%M')):
            browser = webdriver.Firefox()
            browser.maximize_window()
            browser.get(
                'https://account.aliyun.com/login/login.htm?oauth_callback=https%3A%2F%2Ftianchi.shuju.aliyun.com%2Fcompetition%2Finformation.htm%3Fspm%3D5176.100069.5678.2.Jypv0M%26raceId%3D231591%26_is_login_redirect%3Dtrue%26_is_login_redirect%3Dtrue'
            )
            browser.switch_to_frame('alibaba-login-box')
            element = browser.find_element_by_id('J_Quick2Static')
            time.sleep(4.3)
            element.click()  #选择账号密码登录

            mouse = PyMouse()
            keyboard = PyKeyboard()

            mouse.click(1200, 410)  #选中账号框格
            keyboard.type_string('hipton')
            time.sleep(5.2)
            keyboard.type_string('ese')
            mouse.click(1200, 480)
            keyboard.type_string('2008723lgy')
            time.sleep(3.2)

            mouse.press(1140, 570)  #拖动滑块
            time.sleep(0.04)
            mouse.move(1200, 560)
            time.sleep(0.03)
            mouse.move(1280, 575)
            time.sleep(0.06)
            mouse.move(1400, 587)
            time.sleep(0.13)
            mouse.release(1400, 590)
            time.sleep(1.3)
            browser.find_element_by_id("login-submit").click()

            time.sleep(sleep_time)  #给手机验证者预留的时间
            mouse.click(400, 630)  #选择提交结果
            time.sleep(2.3)
            mouse.click(800, 490)  #选中提交窗口
            time.sleep(2.5)
            keyboard.type_string('G:\\tc_koubei_newBird\\dyy\\results\\' +
                                 result_name + '.csv')
            time.sleep(1)
            keyboard.press_key('\n')
            time.sleep(1)
            keyboard.release_key('\n')
            time.sleep(2)
            if (shutdown_flag):
                shutdown(1)
            break
コード例 #26
0
def fullscreen():
    from pymouse import PyMouse
    from pykeyboard import PyKeyboard

    m = PyMouse()
    k = PyKeyboard()

    x_dim, y_dim = m.screen_size()
    m.click(int(x_dim / 3), int(y_dim / 2), 1)
    k.press_key(k.control_key)
    k.tap_key(k.function_keys[11])
    k.release_key(k.control_key)
コード例 #27
0
def move ():    
    deadzone_x = 200
    deadzone_y = 200
    key_delay = 0.4
    
    keyboard = PyKeyboard()
    jumpPad = Button(4, pull_up=True)
    PORT = "/dev/ttyACM0"
    #~ 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:
        if jumpPad.is_pressed:
            # It's set to pullup then shorted to ground, so we're working backwards here.
            keyboard.press_key('space')
            time.sleep(key_delay)
            keyboard.release_key('space')
        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) :
                keyboard.press_key('a')
                time.sleep(key_delay)
                keyboard.release_key('a')
            if int(x) > deadzone_x:
                keyboard.press_key('d')
                time.sleep(key_delay)
                keyboard.release_key('d')
            if int(y) < (0 - deadzone_y):
                keyboard.press_key('w')
                time.sleep(key_delay)
                keyboard.release_key('w')
            if int(y) > deadzone_y:
                keyboard.press_key('s')
                time.sleep(key_delay)
                keyboard.release_key('s')
            else:
                keyboard.release_key('a')
                keyboard.release_key('d')
                keyboard.release_key('w')
                keyboard.release_key('s')
            #~ print(x, y, z, a, b)
        except:
            pass
        
    s.close()
コード例 #28
0
 def terminate_deepinscreenshot(self):
     p = PyKeyboard()
     p.press_key('Return')
     p.release_key('Return')
     time_now = time.strftime('%Y%m%d%H%M%S', time.localtime())
     picture_save_path = os.path.expandvars(
         '$HOME') + '/Desktop/' + '深度截图' + time_now + '.png'
     print(picture_save_path)
     time.sleep(2)
     save_bool = os.path.exists(picture_save_path)
     print(save_bool)
     self.assertTrue(save_bool)
コード例 #29
0
def Main():
    search = raw_input("Enter search term : ")
    browser = webdriver.Firefox()
    browser.get("https://www.google.com")
    searchElement = browser.find_element_by_id("lst-ib")
    searchElement.send_keys(search)
    keyboard = PyKeyboard()
    keyboard.press_key(keyboard.enter_key)#Keyboard press 'ENTER'

    os.system('cls')#os.system('clear') if Linux
    print colored.yellow("[+] Google Search success!")
    browser.close()
コード例 #30
0
def move():
    deadzone_x = 200
    deadzone_y = 200
    key_delay = 0.4

    keyboard = PyKeyboard()
    jumpPad = Button(4, pull_up=True)
    PORT = "/dev/ttyACM0"
    #~ 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:
        if jumpPad.is_pressed:
            # It's set to pullup then shorted to ground, so we're working backwards here.
            keyboard.press_key('space')
            time.sleep(key_delay)
            keyboard.release_key('space')
        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):
                keyboard.press_key('a')
                time.sleep(key_delay)
                keyboard.release_key('a')
            if int(x) > deadzone_x:
                keyboard.press_key('d')
                time.sleep(key_delay)
                keyboard.release_key('d')
            if int(y) < (0 - deadzone_y):
                keyboard.press_key('w')
                time.sleep(key_delay)
                keyboard.release_key('w')
            if int(y) > deadzone_y:
                keyboard.press_key('s')
                time.sleep(key_delay)
                keyboard.release_key('s')
            else:
                keyboard.release_key('a')
                keyboard.release_key('d')
                keyboard.release_key('w')
                keyboard.release_key('s')
            #~ print(x, y, z, a, b)
        except:
            pass

    s.close()
コード例 #31
0
ファイル: initialize.py プロジェクト: hejian5621/Aerobook
 def clear_AllowableCurve(self):
     """
     清除所有的许用值曲线
     :return:
     """
     from OperatingControls.enterModule import specialWay_OperatingControls, ctrW_AeroAerochcek
     from config.relative_location import path
     from PIL import Image
     from PIL import ImageChops
     relativeAddress = path.location()  # 获取相对位置
     operationWindow = "编辑材料许用值"
     self.dict["所在模块"] = "材料信息->定义复合材料参数"
     module = "Aerobook-Aerocheck"
     aero_window, son_window = pywin_openAProgram(module).menuOpen(
         self.dict)
     specialWay_OperatingControls(operationWindow).uia_OperatingControls()
     module_window = ctrW_AeroAerochcek(
         son_window).workField_composite_information()
     dlg_spec = module_window.child_window(title="GridWindow",
                                           class_name="wxWindowNR")
     # 进行图片对比,来判断材料许用值曲线表是否为空
     # 预期截图位置location_expect
     location_expect = relativeAddress + r"src\testCase\d_useCase_screenshot\Aerocheck\expectScreenshots\aaa.png"
     # 实际截图位置
     location_actual = relativeAddress + r"src\testCase\d_useCase_screenshot\Aerocheck\ActualScreenshots\\" + "实际材料许用值曲线表截图.png"
     while True:
         # 判断实际值截图是否存在,如果存在就删掉
         result = os.path.exists(location_actual)
         if result:  # 如果存在就删除实际图片
             os.remove(location_actual)
         dlg_spec.capture_as_image().save(location_actual)  # 截取实际值图片
         # 对比截图
         image_one = Image.open(location_expect)
         image_two = Image.open(location_actual)
         diff = ImageChops.difference(image_one, image_two)
         if diff.getbbox() is None:  # 如果图片一样,就说明材料许用值曲线表里没有内容
             break
         else:  # 如果不图片一样,就说明材料许用值曲线表里有内容,就删除内容
             i = 1
             dlg_spec.right_click_input(coords=(10, 10))  # 点击鼠标右键
             from pykeyboard import PyKeyboard  # 选择删除按钮
             # 选择右键下拉框的“独立显示”
             k = PyKeyboard()
             while i <= 2:
                 k.press_key(k.down_key)
                 time.sleep(0.5)
                 i = i + 1
             k.press_key(k.enter_key)
             # 删除实际截图
             result = os.path.exists(location_actual)
             if result:  # 如果存在就删除实际图片
                 os.remove(location_actual)
コード例 #32
0
ファイル: utils.py プロジェクト: liusida/thesis-bodies
def linux_fullscreen():
    """A helper for entering Full Screen mode in Linux.
    Faking a mouse click and a key press (Ctrl+F11).
    """
    from pymouse import PyMouse
    from pykeyboard import PyKeyboard
    m = PyMouse()
    k = PyKeyboard()
    x_dim, y_dim = m.screen_size()
    m.click(int(x_dim/3), int(y_dim/2), 1)
    k.press_key(k.control_key)
    k.tap_key(k.function_keys[11])
    k.release_key(k.control_key)
コード例 #33
0
ファイル: app.py プロジェクト: knjiang/Twilio-Plays-Pokemon
def sms():
    body = request.values.get('Body', None)
    resp = MessagingResponse()
    k = PyKeyboard()
    if body not in dictionary:
        resp.message(
            '\n Move/Scroll Up: Up , \n Move Left: Left, \n Move Right: Right, \n Move/Scroll Down: Down, \n Start: Start, \n Select : Select, \n A : A, \n B: B, \n L : L, \n R : R'
        )
    else:
        k.press_key(dictionary[body])
        time.sleep(0.1)
        k.release_key(dictionary[body])
    return str(resp)
コード例 #34
0
def main():
    browser = webdriver.Chrome()
    browser.get('https://baidu.com')  # 在当前浏览器中访问百度
    pyperclip.copy("selenium")
    browser.find_element_by_name('wd').click()  #点击一下百度的输入框
    time.sleep(0.5)
    k = PyKeyboard()
    #模拟键盘点击ctrl+v
    k.press_key(k.control_key)
    k.tap_key('v')
    k.release_key(k.control_key)
    browser.find_element_by_name('wd').click()
    time.sleep(1000)
コード例 #35
0
ファイル: Probe_utils.py プロジェクト: MMehdiMousavi/Probe
class Probe:
    def __init__(self):
        self.k = PyKeyboard()

    def press(self, key):
        self.k.press_key(key)
        time.sleep(0.1)
        self.k.release_key(key)

    def screenshot(self):
        self.press('c')

    def gray(self):
        self.press('e')

    def global_gt(self):
        self.press('g')

    def depth(self):
        self.press('t')

    def surface_normal(self):
        self.press('r')

    def global_step(self, num_pad_key=None, interval=0.08, step_size=0):
        self.k.tap_key(self.k.numpad_keys[num_pad_key],
                       n=step_size,
                       interval=interval)

        self.screenshot()
        time.sleep(0.1)

        self.gray()
        time.sleep(0.1)
        self.screenshot()
        self.gray()

        self.global_gt()  # global gt
        time.sleep(0.4)
        self.screenshot()
        self.global_gt()

        self.depth()  # depth
        time.sleep(0.1)
        self.screenshot()
        self.depth()

        self.surface_normal()
        time.sleep(0.1)
        self.screenshot()
        self.surface_normal()
コード例 #36
0
class Keyboard:
    def gen_keymap(self):
        self.special_key_map = {
            '\n': self.keyboard.enter_key,
            '\t': self.keyboard.tab_key
        }

        # It's a bug in PyUserInput
        if platform.system() == "Linux":
            self.special_key_map['<'] = self.keyboard.lookup_character_keycode(
                '<')

    def init(self):
        self.keyboard = PyKeyboard()
        self.gen_keymap()

    @staticmethod
    def read_file() -> str:
        try:
            with open("input.txt", "r") as file:
                data = file.read()
        except FileNotFoundError:
            with open("input-example.txt", "r") as file:
                data = file.read()
        if config.DEBUG:
            print(f"file:\n{data}")
        return data

    def run(self):
        self.init()
        data = self.read_file()
        print(f"Keyboard Emulation will run after {config.EXECUTION_DELAY}s")
        time.sleep(config.EXECUTION_DELAY)
        print("Running...")
        for item in data:
            if item in config.IGNORE_CHARS:
                continue
            key = self.special_key_map[
                item] if item in self.special_key_map else item
            try:
                self.keyboard.press_key(key)
                time.sleep(config.PRESS_DURATION / 1000)
                self.keyboard.release_key(key)
                if config.DEBUG:
                    print(f"Succeed press {item.encode()}")
            except Exception as ex:
                if config.DEBUG:
                    print(ex, file=sys.stderr)
                print(f"Ignore invalid symbol {item.encode()}")
            time.sleep(config.KEYS_INTERVAL / 1000)
        print("End!")
コード例 #37
0
 def right_click(self, window_name, controller, order):
     '''
     鼠标右键点击,下移进行菜单选择
     window_name : 窗口名
     controller:区域名
     order : 数字,第几个命令
     '''
     self.app[window_name][controller].RightClick()
     k = PyKeyboard()
     for down in range(order):
         k.press_key(k.down_key)
         time.sleep(0.5)
     k.press_key(k.enter_key)
     time.sleep(self.SLEEP_TIME)
コード例 #38
0
def Ctrl_s(url):
    browser = webdriver.Firefox()
    browser.maximize_window()#打开火狐窗口
    browser.get(url)
    time.sleep(2)#给予充足的打开页面网络延迟时间
    m = PyMouse()  # 创建鼠标对象
    k = PyKeyboard()  # 创建键盘对象
    k.press_key(k.control_key)
    k.tap_key('s')
    k.release_key(k.control_key)
    time.sleep(2)#否则会同时进行,Ctrl+s打开窗口时间没有点击和打字快
    # time.sleep(4)#给与时间移动鼠标到地址栏,然后输出鼠标位置     (307, 46),(599, 449)
    # print(m.position())
    m.click(307, 46 ,1)
    time.sleep(1)
    k.type_string('F:/blog')
    time.sleep(1)
    k.press_key(k.enter_key)
    time.sleep(0.1)
    k.press_key(k.enter_key)
    time.sleep(2)
    m.click(599,449, 1)
    k.press_key(k.enter_key)
    time.sleep(3)
    browser.close()
コード例 #39
0
 def flowInstancePrint(self):
     """适配打印逻辑"""
     self.switch_to_the_last_window()
     if not self.WorkFlowDetailConfig:
         self.WorkFlowDetailConfig = read_config("work_flow_details")
     self.basePage.is_click(self.WorkFlowDetailConfig['打印'])
     self.switch_to_the_last_window()
     time.sleep(10)
     self.basePage.switch(self.WorkFlowDetailConfig['打印iframe'])
     self.basePage.is_click(self.WorkFlowDetailConfig['打印报表'])
     time.sleep(5)
     virtual_keyboard = PyKeyboard()
     virtual_keyboard.press_key('Return')
     """需要提前配置打印机,只能模拟键盘操作,按Return键"""
コード例 #40
0
ファイル: Imagetest.py プロジェクト: cui-dev/cuixinghai
class ImageTest:
    def __init__(self):
        self.mouse = PyMouse()
        self.keyboard = PyKeyboard()
        self.match = ImageMatchByOpenCV()

    def start_app(self, cmd):
        os.system('start /b %s' % cmd)
        time.sleep(5)
        print('start application.')

    def on_click(self, target):
        x, y = self.match.find_image(target)
        self.mouse.click(x, y)
        time.sleep(1)
        print('在[%d, %d]位置单击%s一次。' % (x, y, target))

    def on_double_click(self, target):
        x, y = self.match.find_image(target)
        self.mouse.click(x, y, n=2)
        time.sleep(1)
        print('在[%d, %d]位置双击%s一次。' % (x, y, target))

    def input(self, target, content):
        self.on_double_click(target)
        self.keyboard.type_string(content)
        time.sleep(1)
        print('在%s上输入内容%s。' % (target, content))

    def select(self, target, count=0):
        self.on_click(target)
        for i in range(count):
            self.keyboard.press_key(self.keyboard.down_key)
            time.sleep(0.5)
        self.keyboard.press_key(self.keyboard.enter_key)
        time.sleep(0.5)
        print('在%s上选择第%d项。' % (target, count + 1))

    def start_test(self):
        self.start_app('java -jar JavaSwingCalc.jar')
        self.input('numberx.png', '200')
        self.input('numbery.png', '100')
        self.select('calctype.png', 1)
        self.on_click('docalc.png')
        time.sleep(2)
        if self.match.check_exist('result.png'):
            print('test success.')
        else:
            print('test fail.')
        self.on_click('doclose.png')
コード例 #41
0
ファイル: bldr.py プロジェクト: bschmuck/build18_2016
def faceTracker():
    k = PyKeyboard()
    faceCascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')

    video_capture = cv2.VideoCapture(0)
    centerX = 0;

    while True:
        # Capture frame-by-frame
        ret, frame = video_capture.read()

        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

        faces = faceCascade.detectMultiScale(
                                             gray,
                                             scaleFactor=1.1,
                                             minNeighbors=5,
                                             minSize=(150, 150),    )

        #Draw a rectangle around the faces
        #for (x, y, w, h) in faces:
        #    cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
    
        if len(faces) >= 1:
            (x,y,w,h) = faces[0]
            cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
            centerNew = x + w/2
            if centerNew < centerX - 10:
                #print "left"
                k.press_key('A')
                time.sleep(.2)
                k.release_key('A')
            if centerNew > centerX + 10:
                #print "right"
                k.press_key('D')
                time.sleep(.2)
                k.release_key('D')
            centerX = centerNew
    

        # Display the resulting frame
        #cv2.imshow('Video', frame)

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

    # When everything is done, release the capture
    video_capture.release()
    cv2.destroyAllWindows()
コード例 #42
0
def process_message(in_msg, midi_to_shortcut):
    """ processes message """
    keyboard = PyKeyboard()
    print(in_msg)
    try:
        if (in_msg.note, in_msg.channel) in midi_to_shortcut and in_msg.type != 'note_off':
            shortcut = midi_to_shortcut[(in_msg.note, in_msg.channel)]
            print('shortcut: ', shortcut)
            for key in shortcut:
                keyboard.press_key(key)
            for key in shortcut:
                keyboard.release_key(key)

    except OSError:
        print('note not recognized')
コード例 #43
0
def type_unicode(symbol):
    k = PyKeyboard()
    hexval = symbol.encode("unicode_escape")
    print hexval
    if hexval[:2] == '\u':                                  # if the value is a hex number
        k.press_key('Control_L')                            # press the control
        k.press_key('Shift_L')                              # the left shift
        k.tap_key('u')                                      # and the u key
        k.release_key('Control_L')                          # release the control
        k.release_key('Shift_L')                            # and shift keys
        hexval = hexval[2:]                                 # remove the unicode escape character
        k.type_string(hexval)                               # type the unicode string
        k.tap_key('Return')                                 # tap the return key
            
    else:                                                   # if the given string isnt a unicode character
        k.type_string(hexval)                               # just type the string
コード例 #44
0
class ScreenSaverPreventer(QtGui.QWidget):
    def __init__(self):
        QtGui.QWidget.__init__(self)
        self.key = PyKeyboard()
        
    def doSomething(self):
        self.key.press_key(self.key.control_l_key)
        self.key.release_key(self.key.control_l_key)

    def run(self):
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.doSomething)
        self.timer.start(59000)  # 59 sec
        
    def stop(self):
        self.timer.stop()
コード例 #45
0
ファイル: EagleCLI.py プロジェクト: abcinder/st-pattern-gen
def runScript(delay, SCRIPT_PATH, SCRIPT_NAME):
    screen = wnck.screen_get(0)
    #screen = wnck.screen_get_default()

    while gtk.events_pending():
        gtk.main_iteration()

    windowTitle = re.compile('.*Board.*')

    for window in screen.get_windows():
        if windowTitle.match(window.get_name()):
            window.activate(int(time.time()))
            window.maximize()

    #MOUSE CLICK TO ACTUALLY FOCUS EAGLE BOARD
    m = PyMouse()
    x, y = m.screen_size()
    #m.click(x/4, y/4, 1)

    #KEYBOARD INPUT
    k = PyKeyboard()

    caps_flag = 0
    if int(commands.getoutput('xset q | grep LED')[65]) % 2:
        k.tap_key(k.caps_lock_key)
        caps_flag = 1

    #BRING UP ALT-FILE MENU
    k.press_key(k.alt_key)
    k.type_string('f')
    k.release_key(k.alt_key)

    #PRESS T TO RUN SCRIPT FROM ALT-FILE MENUs
    k.type_string('t')

    time.sleep(delay)

    #TYPE IN SCRIPT NAME TO DIALOG BOX
    k.type_string(SCRIPT_PATH + SCRIPT_NAME)

    time.sleep(delay)
    time.sleep(delay)

    k.tap_key(k.enter_key)

    if caps_flag:
        k.tap_key(k.caps_lock_key)
コード例 #46
0
    def pressKey(self,key):

        k = PyKeyboard()
        keyMap = {'up':'k',
                'down':',',
                'right':'.',
                'left':'m',
                'start':'s',
                'select':'d',
                'a':'z',
                'b':'x',
                'l':'a',
                'r':'c'}

        if (key in keyMap):
            k.press_key(keyMap[key])
            sleep(0.1)
            k.press_key(keyMap[key])
コード例 #47
0
def get_page(user, driver, sleeptime=1, down_scrolls=int(3e2)):
    """
    collect data for a given username
    save webpage locally

    INPUT:  user, string name of user
            driver, Selenium driver object 
            sleeptime, integer number of seconds to pause between scrolls
            down_scrolls, integer number of times to scroll down user's page
    OUTPUT: None; raw page is saved to local drive
    """
    url = 'http://instagram.com/' + user
    driver.get(url)

    # Page is not available/404
    message_404 = 'The link you followed may be broken, or the page may have been removed.'
    if message_404 in driver.page_source:
        return
    # Must click 'Load More' button to see more content
    try:
        driver.find_element_by_link_text('LOAD MORE').click()
    # Content is not available for whatever reason
    except NoSuchElementException:
        print "Sorry, can't click LOAD MORE for {}".format(user)

    page = driver.page_source
    # Continue scrolling to load more content
    for i in xrange(down_scrolls):
        driver.execute_script('window.scrollTo(0, document.body.scrollHeight);')
        # Pause to update page
        time.sleep(sleeptime + random.random())
        # Stop early if the page hasn't changed since the last iteration
        if driver.page_source == page:
            break
        page = driver.page_source
    # Execute keyboard shortcuts to save entire page
    saveas = ActionChains(driver).key_down(Keys.CONTROL).send_keys('s').key_up(Keys.CONTROL)
    saveas.perform()
    # Pause again, to avoid 
    time.sleep(2)
    # app('System Events').keystroke('\r')
    kbrd = PyKeyboard()
    kbrd.press_key('Return')
    time.sleep(2)
コード例 #48
0
	def parse_scancode(self, scancode, action):
		global modkey
		if scancode in scancode_translation_table:
			keyname = scancode_translation_table[scancode]
		elif scancode in mod_key_name_table:
			keyname = mod_key_name_table[scancode]
		k=PyKeyboard()
		if action=="ANPrs":
			if scancode in mod_key_table and modkey == 0:
				modkey=mod_key_table[scancode]
				keycombo.append(scancode)
			elif scancode in scancode_translation_table and modkey !=0:
				keycombo.append(scancode)
			elif scancode in scancode_translation_table and modkey == 0:
				k.press_key(keyname)
			
			print str(scancode) + "_" + str(action) + str(modkey) + "\n"
			sender.put_nowait(str(scancode) + "_" + str(action) + str(modkey) + "\n")
			
		if action=="ANRls" and modkey==0:
			print str(scancode) + "_" + str(action) + "0\n"
			sender.put_nowait(str(scancode) + "_" + str(action) + "0\n")
			k.release_key(keyname)
			
		if action=="ANTRls":
			modkey=0
			print "running list..." + str(keycombo)
			for x in keycombo:
				try:
					if x in scancode_translation_table:
						keyname = scancode_translation_table[x]
						print "AN key..." + str(keyname)
					elif x in mod_key_name_table:
						keyname = mod_key_name_table[x]
						print "ModKey..." + str(keyname)
					print str(x) + "_" + str(action) + "0\n"
					sender.put_nowait(str(x) + "_" + str(action) + "0\n")
					k.release_key(keyname)
				except:
					print "keycombo = " + str(keycombo)
			for x in  keycombo:
				keycombo.remove(x)
コード例 #49
0
ファイル: autotest.py プロジェクト: zy0016/easycopy
def ReadTestCaseFile(testcasefile):
	outputfilename = "test_result.txt"
	m = PyMouse()
	k = PyKeyboard()
	
	resultfile = open(outputfilename,'a+')
	resultfile.write(testcasefile + "\n")
	resultfile.close()
	with open(testcasefile) as f:
		for line in f:
			if len(line) < 3:
				continue
			if line[-1] == '\n':
				line = line[:-1]
			if line[-1] == '\r':
				line = line[:-1]
			
			timedefault = 1
			arr = line.split(",")
			casename = arr[0]
			action = arr[1]
			arrlen = len(arr)
			if arrlen == 3:
				param3 = arr[2]
				if param3.isdigit() == True:
					timedefault = int(param3)
					print("set new timer:",str(timedefault))


			res = doactions(casename,action)
			print(casename," result:",res)
			
			resultfile = open(outputfilename,'a+')
			resultfile.write(casename + " result:" + str(res) + "\n")
			resultfile.close()
			
			time.sleep(timedefault)
			k.press_key(k.right_key)
			k.release_key(k.right_key)
			time.sleep(1)
コード例 #50
0
def runScript(delay, SCRIPT_NAME):
    #screen = wnck.screen_get_default()
    screen = wnck.screen_get(0)

    while gtk.events_pending():
        gtk.main_iteration()

    windowTitle = re.compile('.*Board.*')
    
    for window in screen.get_windows():
        if windowTitle.match(window.get_name()):
            window.activate(int(time.time()))
            window.maximize()
    
    #MOUSE CLICK TO ACTUALLY FOCUS EAGLE BOARD
    m = PyMouse()
    x, y = m.screen_size()
    #m.click(x/4, y/4, 1)
    
    #KEYBOARD INPUT
    k = PyKeyboard()
    
    #BRING UP ALT-FILE MENU
    k.press_key(k.alt_key)
    k.type_string('f')
    k.release_key(k.alt_key)
    
    #PRESS T TO RUN SCRIPT FROM ALT-FILE MENU
    k.type_string('t')
    
    time.sleep(delay)
    
    #TYPE IN SCRIPT NAME TO DIALOG BOX
    k.type_string('/home/anton/Documents/st/st-py/' + SCRIPT_NAME)
    
    time.sleep(delay)
    time.sleep(delay)
    
    k.tap_key(k.enter_key)
コード例 #51
0
ファイル: server.py プロジェクト: iu7-2014/networks
class UserIOControl:
    def __init__(self):
        self.__mouse = PyMouse()
        self.__keyboard = PyKeyboard()
        self.__app = QApplication([])
        self.__screen = self.__app.primaryScreen()

    def click(self, x, y, button=1):
        self.__mouse.click(x, y, button)

    def press_key(self, key):
        self.__keyboard.press_key(key)

    def take_screenshot(self):
        byte_array = QByteArray()
        buffer = QBuffer(byte_array)
        buffer.open(QIODevice.WriteOnly)

        image = self.__screen.grabWindow(QApplication.desktop().winId())
        image.save(buffer, "PNG")

        return str(byte_array.toBase64())[1:]
コード例 #52
0
ファイル: main.py プロジェクト: ckrooss/autoclickerheroes
def buy_timer():
    """Upgrade the current hero and re-schedule self"""
    log.info("buy timer ticking")
    search_hero(LILIN)

    if COORDINATES.get("hero"):
        if button_is_active(*COORDINATES["hero"]):
            target = COORDINATES["hero"]
        else:
            log.debug("Not buying, not enough money")
            target = [0, 0]
    else:
        target = get_best_hero()

    if all(target):
        kbd = PyKeyboard()
        kbd.press_key("q")
        do_buy(target)
        kbd.release_key("q")

    if active():
        timers["buy"] = Timer(BUY_PERIOD, buy_timer)
        timers["buy"].start()
コード例 #53
0
ファイル: assistant.py プロジェクト: bschmuck/build18_2016
def faceManager(threadName, delay):
    global isTalking

    k = PyKeyboard()
    isPressing = False

    #Presses and holds 'B' key to move mouth
    while True:
        for waitInd in range(235):
            if waitInd == 2 and not isTalking:
                # Do random action
                newKey = doRandom()
                k.press_key(newKey)
                time.sleep(.1)
                k.release_key(newKey)
                k.press_key(newKey)
                time.sleep(.1)
                k.release_key(newKey)
                time.sleep(3)
                # start blinking again
                k.press_key('K')
                time.sleep(.1)
                k.release_key('K')
            if isTalking:
                if not isPressing:
                    k.press_key('B')
                isPressing = True
            else:
                if isPressing:
                    k.release_key('B')
                    isPressing = False
                    # start blinking again
                    k.press_key('K')
                    time.sleep(.1)
                    k.release_key('K')
            time.sleep(.1)
コード例 #54
0
ファイル: 13-pLabel.py プロジェクト: hanice/SIBS
def pLabel(pep,spec,gene,row_no):
    m = PyMouse()
    k = PyKeyboard()
    # ALL button
    m.click(1243,204)
    sleep(2)
    m.click(362,762)
    sleep(1)
    m.click(362,762)
    sleep(0.3)
    m.click(362,762)
    sleep(1)
    for n in range(30):
        k.press_key(k.backspace_key)
    sleep(1)

    k.type_string(spec)
    sleep(1)
    k.press_key(k.enter_key)
    sleep(1)
    capture(pep,spec,gene,row_no,0)
    sleep(1)
    m.click(609,182)
    sleep(1)
    # peptide
    m.click(132,728)
    sleep(1)
    m.click(132,728)
    sleep(0.3)
    m.click(132,728)
    sleep(1)
    k.press_key(k.backspace_key)
    sleep(1)
    k.type_string(pep)
    sleep(1)
    k.press_key(k.enter_key)
    sleep(1)
    capture(pep,spec,gene,row_no,1)
    sleep(1)
コード例 #55
0
ファイル: hackerearth.py プロジェクト: bharathbabuyp/Junk
k=PyKeyboard()
m=PyMouse()


browser = webdriver.Firefox()
# Opening Firefox with its Homepage
browser.maximize_window()
browser.get('http://www.fakemailgenerator.com/#/superrito.com/monkeydluffy13/')
# Open the fake mail generator in TAB1


time.sleep(2)


k.press_key(k.control_key)
k.tap_key('t')
k.release_key(k.control_key)
# Getting an element where Keys can be passed


# Opening a NEW TAB

browser.get('http://hck.re/qcKgO4')



m.click(598L,798L,1,1)
k.type_string('*****@*****.**')

k.tap_key(k.return_key)
コード例 #56
0
ファイル: tabwin_fully_python.py プロジェクト: s0la/scripts
from pykeyboard import PyKeyboard
from pymouse import PyMouseEvent
import os

keyboard = PyKeyboard()
keyboard.press_key(keyboard.alt_key)
keyboard.tap_key(keyboard.tab_key)

class Tabwin(PyMouseEvent):

	def __init__(self):
		PyMouseEvent.__init__(self)

	def click(self, x, y, button, press):
		
		if button == 1:
			keyboard.release_key(keyboard.alt_key)
			self.stop()

Tabwin().run()
コード例 #57
0
ファイル: gamer.py プロジェクト: andysheen/Minecraft_Gamer
import tailer
from pyfirmata import Arduino, util
from pymouse import PyMouse
from pykeyboard import PyKeyboard
m = PyMouse()
k = PyKeyboard()
import time
import serial
ser = serial.Serial('/dev/tty.usbmodem1461', 9600, timeout=None)

while 1:
    data = ser.read()
    if data == 'd':  
        print('BUTTON')
        k.press_key('d')
    if data == 'a':  
        print('BUTTON')
        k.press_key('a')
    if data == 'w':  
        print('BUTTON')
        k.press_key('w')
    if data == 's':  
        print('BUTTON')
        k.press_key('s')
    if data == 'z':    
        k.release_key('a')
    if data == 'x':    
        k.release_key('w')
    if data == 'c':    
        k.release_key('d')
    if data == 'v':    
コード例 #58
0
ファイル: server.py プロジェクト: StefanLage/Sockets
	def keyboard(self):
		k = PyKeyboard()
		k.press_key(12)
		k.release_key(12)