예제 #1
0
파일: pywin.py 프로젝트: lxhxwj/EDLP
 def right_click(self, window_name, controller, order):
     self.app[window_name][controller].RightClick()
     for down in range(order):
         SendKeys.SendKeys('{DOWN}')
         time.sleep(0.5)
     SendKeys.SendKeys('{ENTER}')
     time.sleep(1)
예제 #2
0
 def parseInput(self, input):
     if input == "Forward":
         SendKeys.SendKeys("{RIGHT}")
     if input == "Backwards":
         SendKeys.SendKeys("{LEFT}")
     if input == "B":
         SendKeys.SendKeys("B")
예제 #3
0
def Installpyserial():
    #Installation of sendkeys
    if not os.path.exists(HOMEDRIVE + r'\Python27\Removepyserial.exe'):
        pyserial_exe = ReadConfig('EXENAME_' + OS_BIT, 'pyserial_exe')
        try:
            #print_and_write('\nTask 13 : Installing the pyserial modules')
            os.chdir(setupfilepath)
            Popen(pyserial_exe)
            time.sleep(5)
            SendKeys.SendKeys("{ENTER}")
            time.sleep(5)
            SendKeys.SendKeys("{ENTER}")
            time.sleep(5)
            SendKeys.SendKeys("{ENTER}")
            time.sleep(20)
            SendKeys.SendKeys("{ENTER}")
            time.sleep(10)
            ListOfTasks = tskList()
            if "pyserial" in ListOfTasks:
                tskKill(pyserial_exe)
            if os.path.exists(HOMEDRIVE + r'\Python27\Removepyserial.exe'):
                print_and_write('\nPyserial : Installed')
            else:
                print_and_write('\nPyserial : NOT Installed')
        except Exception as excp:
            print_and_write(
                '\nTask 13: Exception came while installing pyserial module: %s'
                % excp)

    else:
        print_and_write('\nPyserial : Installed')
예제 #4
0
def InstallWMI():
    #Installation of sendkeys
    if not os.path.exists(HOMEDRIVE + r'\Python27\RemoveWMI.exe'):
        WMI_exe = ReadConfig('EXENAME_' + OS_BIT, 'WMI_exe')
        try:
            #print_and_write('Task 11 : Installing the WMI modules')
            os.chdir(setupfilepath)
            Popen(WMI_exe)
            time.sleep(5)
            SendKeys.SendKeys("{ENTER}")
            time.sleep(5)
            SendKeys.SendKeys("{ENTER}")
            time.sleep(5)
            SendKeys.SendKeys("{ENTER}")
            time.sleep(20)
            SendKeys.SendKeys("{ENTER}")
            time.sleep(10)
            ListOfTasks = tskList()
            if "WMI" in ListOfTasks:
                tskKill(WMI_exe)
            if os.path.exists(HOMEDRIVE + r'\Python27\RemoveWMI.exe'):
                print_and_write('\nWMI : Installed')
            else:
                print_and_write('\nWMI : NOT Installed')
        except Exception as excp:
            print_and_write('\nWMI : Not Installed due to %s' % excp)

    else:
        print_and_write('\nWMI : Installed')
예제 #5
0
 def upload_repair_picture(self):
     # 打开上传按钮
     self.dr.click('id->browse')
     sleep(10)
     # os.system(r'D:\ziheng\autoitscrite\upload.exe')
     SendKeys.SendKeys('D:\\ziheng\\test\\01.jpg')  #发送图片地址
     SendKeys.SendKeys("{ENTER}")  #发送回车键
예제 #6
0
def binarycheats():
        try:
                global number
                binary = bin(number)
                binary = binary[3:]
                enter = '{ENTER}'

                SendKeys.SendKeys(str(binary))
                time.sleep(1)
                humandelay = random.uniform(0.1, 0.9) + \
                             random.uniform(0.2, 0.7) + \
                             random.uniform(0.2, 0.6) + \
                             random.uniform(0, 0.5)
                time.sleep(int(humandelay))
                SendKeys.SendKeys(enter)


                binarylog.append(number)
                number = number + 1



                print(binarylog)
                binarycheats()
                
        except Exception, e:
                print str("oops")
예제 #7
0
def VLC_Window(video_len):
    'Control of the VLC media player via Key Emulation'
    
    pause = ' '.join(["""{SPACE}{PAUSE""", str(video_len), """}"""])       
    APP.AppActivate("VLC media player")
    sks.SendKeys(pause)
    APP.AppActivate("VLC media player")
    sks.SendKeys("""{SPACE}""")
예제 #8
0
def inquire_position(path):
    app = Application().connect(path=path)
    app[u"网上股票交易系统5.0"]["CVirtualGridCtrl"].click_input()
    SendKeys.SendKeys('W')
    SendKeys.SendKeys('{F5}')
    app[u"网上股票交易系统5.0"]["CVirtualGridCtrl"].TypeKeys('^c')
    data = pd.read_clipboard()
    return data
예제 #9
0
 def do_gesture_recognition(self, gesture_hand, mouse_hand):
     if len(gesture_hand.fingers.extended()
            ) == 5:  #Five open fingers on gesture hand (swipe mode)
         self.gesture_debouncer.signal(
             5)  #Tell the debouncer we've seen this gesture
     elif len(
             gesture_hand.fingers.extended()
     ) == 4 and self.gesture_debouncer.state != 7:  #Three open fingers on gesture hand (scroll mode)
         self.gesture_debouncer.signal(4)
     elif len(gesture_hand.fingers.extended()
              ) == 3:  #Three open fingers on gesture hand (scroll mode)
         self.gesture_debouncer.signal(3)
     elif len(
             gesture_hand.fingers.extended()
     ) == 2 and self.gesture_debouncer.state != 6:  #Two open fingers on gesture hand (right click)
         self.gesture_debouncer.signal(2)
     elif len(gesture_hand.fingers.extended()
              ) == 1:  #One open finger on gesture hand (click down)
         self.gesture_debouncer.signal(1)
     elif len(gesture_hand.fingers.extended()
              ) == 0:  #No open fingers (click up/no action)
         self.gesture_debouncer.signal(0)
     #Now that we've told the debouncer what we *think* the current gesture is, we must act
     #On what the debouncer thinks the gesture is^%{DOWN}
     if self.gesture_debouncer.state == 5:  #Swipe mode
         for gesture in frame.gestures():
             if gesture.type is Leap.Gesture.TYPE_SWIPE:
                 swipe = Leap.SwipeGesture(gesture)
                 if swipe.start_position.x < swipe.position.x:
                     SendKeys.SendKeys("^${RIGHT}")
                 else:
                     SendKeys.SendKeys("^${LEFT}")
     elif self.gesture_debouncer.state == 4:  #Right click
         SendKeys.SendKeys("%{TABS}")
         self.gesture_debouncer.signal(
             7)  #Dummy class so it doesn't right click again
     elif self.gesture_debouncer.state == 3:  #Scroll mode
         y_scroll_amount = self.velocity_to_scroll_amount(
             mouse_hand.palm_velocity.y)  #Mouse hand controls scroll amount
         x_scroll_amount = self.velocity_to_scroll_amount(
             mouse_hand.palm_velocity.x)
         self.cursor.scroll(x_scroll_amount, y_scroll_amount)
     elif self.gesture_debouncer.state == 2:  #Right click
         if self.cursor.left_button_pressed:
             self.cursor.click_up(
             )  #You can't left and right click at the same time
         self.cursor.rightClick()  #Right click
         self.gesture_debouncer.signal(
             6)  #Dummy class so it doesn't right click again
     elif self.gesture_debouncer.state == 1:  #Click/drag mode
         if not self.cursor.left_button_pressed:
             self.cursor.click_down()  #Click down (if needed)
         self.do_mouse_stuff(mouse_hand)  #We may want to click and drag
     elif self.gesture_debouncer.state == 0:  #Move cursor mode
         if self.cursor.left_button_pressed:
             self.cursor.click_up()  #Click up (if needed)
         self.do_mouse_stuff(mouse_hand)
예제 #10
0
def right_click(self, window_name, controller, order):
    window_name = window_name.decode('utf - 8')
    controller = controller.decode('utf - 8')
    self.app[window_name][controller].RightClick()
    for down in range(order):
        SendKeys.SendKeys('{DOWN}')
        time.sleep(0.5)
    SendKeys.SendKeys('{ENTER}')
    time.sleep(self.SLEEP_TIME)
예제 #11
0
def send_keys_to_dialog(title=r".*Upload.*", key_valus=r""):
    win_dialog = WindowFinder()

    win_dialog.find_window_wildcard(title)
    win_dialog.set_foreground()

    time.sleep(2)

    SendKeys.SendKeys(key_valus)
    SendKeys.SendKeys("{ENTER}")
예제 #12
0
def snake_stop():
      x = random.randint(0,5)
      y = random.randint(0,5)
      z = random.randint(0,10)

      if x == y:#and x == z:

            SendKeys.SendKeys(enter)
            time.sleep(random.randint(5,9))
            SendKeys.SendKeys(enter)
예제 #13
0
def InstallSendKey():
    #Installation of SendKeys-0.3.win32-py2.7
    Sendkeys_exe = ReadConfig('EXENAME_' + OS_BIT, 'sendkey_exe')
    if foundfile(Sendkeys_exe, setupfilepath):
        if (OS_BIT == "32"):
            if not os.path.exists(HOMEDRIVE + r'\Python27\RemoveSendKeys.exe'):
                try:
                    os.chdir(setupfilepath)
                    Popen(Sendkeys_exe)
                    time.sleep(5)
                    SendKeys.SendKeys("{ENTER}")
                    time.sleep(5)
                    SendKeys.SendKeys("{ENTER}")
                    time.sleep(5)
                    SendKeys.SendKeys("{ENTER}")
                    time.sleep(20)
                    SendKeys.SendKeys("{ENTER}")
                    time.sleep(10)
                    ListOfTasks = tskList()
                    if "SendKeys" in ListOfTasks:
                        tskKill(Sendkeys_exe)
                    if os.path.exists(HOMEDRIVE +
                                      r'\Python27\RemoveSendKeys.exe'):
                        print_and_write('\nSendKeys : Installed')
                    else:
                        print_and_write('\nSendKeys : NOT Installed')

                except Exception as excp:
                    print_and_write('\nSendKeys : Not Installed due to %s' %
                                    excp)
            else:
                print_and_write('\nSendKeys : Installed')

        else:
            if not os.path.exists(
                    r'C:\Python27\Lib\site-packages\SendKeys.py'):
                try:
                    cmd = PIP_PATH + r'\pip install ' + '"' + setupfilepath + "\\" + Sendkeys_exe + '"'
                    print cmd
                    Popen(cmd)
                    time.sleep(30)
                    if os.path.exists(
                            r'C:\Python27\Lib\site-packages\SendKeys.py'):
                        print_and_write('\nSendKeys : Installed')
                    else:
                        print_and_write('\nSendKeys : NOT Installed')
                except Exception as excp:
                    print_and_write('\nSendKeys : Not Installed due to %s' %
                                    excp)

            else:
                print_and_write('\nSendKeys : Installed')
    else:
        print_and_write('\nSendKeys : %s file not found at %s' %
                        (Sendkeys_exe, setupfilepath))
예제 #14
0
def text():
      text = raw_input("Text to convert:  ")
      time.sleep(3)
      for i in text:
            mid = ord(i)
            converted = bin(mid)
            converted = converted[2:]
            SendKeys.SendKeys(str(converted))
            time.sleep(0.75)
            SendKeys.SendKeys(enter)
            time.sleep(0.75)
예제 #15
0
 def upload_(self,data,position):
     ele = self.get_position(position)
     if ele!=None:
         ele.click()
         time.sleep(2)
         #因为上传文件的字符串一定不能是unicode编码,所以需要先转码才能用
         data = data.encode("utf8")
         SendKeys.SendKeys(data)
         SendKeys.SendKeys("{ENTER}")
     else:
         print "上传的按钮没有找到"
예제 #16
0
	def sso_command(self, data):
		time.sleep(2)
		self.frameElem.from_frame_to_otherFrame("rigthFrame")
		self.ssoElem.select_account(data[2],data[3])
		self.click_sso_icon(data[2])
		if data[4] != "":
			self.ssoElem.select_protocol(data[4])
		time.sleep(5)
		SendKeys.SendKeys(str(data[5]))
		SendKeys.SendKeys('\n', with_newlines=True)
		time.sleep(2)
예제 #17
0
파일: test_send.py 프로젝트: ihtwang/test
    def test_send_mail3(self):
        driver = self.driver
        driver.get(self.base_url)

        #登录
        login.login(self)

        driver.switch_to_default_content()
        #写信
        #driver.find_element_by_css_selector("#_mail_component_47_47 > span.oz0").click()
        time.sleep(10)
        driver.find_element_by_css_selector("#_mail_component_70_70 >\
                                            span.oz0").click()
        time.sleep(10)
        #填写收件人和主题
        driver.find_element_by_xpath("//*[@class='bz0']/div[2]/div[1]/input")\
            .send_keys(self.username + '@126.com;')
        time.sleep(5)
        driver.find_element_by_xpath("//input[@class='nui-ipt-input'\
                                     and @type='text'\
                                     and @maxlength='256']"                                                           ).\
            send_keys(u'给iht的信')
        time.sleep(10)

        #上传附件
        print u"准备上传附件"
        #driver.find_element_by_class_name("O0").send_keys(
        #    r'C:\Python27\python.exe')

        driver.find_element_by_class_name("by0").click()
        time.sleep(2)

        # SendKeys
        SendKeys.SendKeys(r'C:\Python27\python.exe')  # 发送文件地址
        time.sleep(2)
        SendKeys.SendKeys("{ENTER}")  # 发送回车键

        print u"准备发送邮件"

        #发送邮件
        time.sleep(10)
        driver.find_element_by_xpath("/html/body/div[2]/div[1]/div[2]\
                                     /header/div[1]/div[1]/div[1]\
                                     /span[2]").click()

        #断言发送结果
        time.sleep(10)
        text = driver.find_element_by_class_name('tK1').text
        self.assertEqual(text, u'发送成功可用手机接收回复')
        print u"准备退出..."
        login.logout(self)
        print u"退出了..."
예제 #18
0
 def right_click(self, window_name, controller, order):
     """
     鼠标右键点击,下移进行菜单选择
     window_name : 窗口名
     controller:区域名
     order : 数字,第几个命令
     """
     self.app[window_name][controller].RightClick()
     for down in range(order):
         SendKeys.SendKeys('{DOWN}')
         time.sleep(0.5)
     SendKeys.SendKeys('{ENTER}')
     time.sleep(1)
예제 #19
0
def spam():
    print(counter)
    try:
        global counter
        global limit
        message = spammsg + str(counter)
        enter = "{ENTER}"
        time.sleep(1)
        SendKeys.SendKeys(message)
        SendKeys.SendKeys(enter)

        counter += 1

    except Exception:
        print str("oops")
예제 #20
0
def inquire_commit(path):
    app = Application().connect(path=path)
    app[u"网上股票交易系统5.0"]["CVirtualGridCtrl"].click_input()
    SendKeys.SendKeys('R')
    SendKeys.SendKeys('{F5}')
    time_wait.sleep(0.5)
    app[u"网上股票交易系统5.0"]["CVirtualGridCtrl"].TypeKeys('^c')
    try:
        data = pd.read_clipboard()
        day = str(datetime.now().date())
        time = [pd.to_datetime(day + " " + i) for i in data["委托时间"]]
        data.index = time
        return data
    except:
        return None
예제 #21
0
def main():
    try:
        sendMe = 'Hello'
        time.sleep(2)
        SendKeys.SendKeys(sendMe)
    except Exception, e:
        print(str(e))
예제 #22
0
def snail():

    try:
        farmer = "!s{SPACE}race{SPACE}5"
        enter = "{ENTER}"
        ctypes.windll.user32.mouse_event(2, 0, 0, 0, 0)  # left down
        ctypes.windll.user32.mouse_event(4, 0, 0, 0, 0)  # left up
        time.sleep(18)

        SendKeys.SendKeys(farmer)
        SendKeys.SendKeys(enter)

        snail()

    except Exception, e:
        print str("oops")
예제 #23
0
 def testNewlinesWithNewlines(self):
     "Make sure that with spaces option works"
     SendKeys("\t \t \t\n\{ENTER}", pause=.001, with_newlines=True)
     received = raw_input()
     self.assertEquals("", received)
     # there are actally two enter's above - so we need to clear the buffer
     received = raw_input()
예제 #24
0
 def dataReceived(self, data):
     a = data
     #print a
     if a == data:
         #             import SendKeys
         SendKeys.SendKeys(a)
         time.sleep(1)
예제 #25
0
def Create_Char(count):
    mousePos(Cord.l_signUp)
    leftClick(.5)
    mousePos(Cord.l_ok)
    leftClick(15)
    mousePos(Cord.centerClick)
    leftClick(1)
    leftClick(1)
    leftClick(1)
    leftClick(1)
    mousePos(Cord.m_setting)
    leftClick(20)
    mousePos(Cord)
    LoginInfo = """
    {ENTER} {PAUSE 1}
    password{ENTER}{PAUSE 1}
    {ENTER}{PAUSE 1}
    {ENTER}{PAUSE 1}
    """
    SendKeys.SendKeys(NewNames[count] + LoginInfo)
    time.sleep(20)
    mousePos(Cord.centerClick)
    leftClick(1)
    mousePos(Cord.settings_ok)
    leftClick(1)
    mousePos(Cord.settings_exit)
예제 #26
0
def bot():
        n_light = "c"
        l_light = "ac"
        d_light = "sc"
        r_light = "dc"
        moveleft = "a"
        moveright = "d"
        jump = "w"
        dodge = "z"
        n_heavy = "x"
        l_heavy = "ax"
        d_heavy = "sx"
        r_heavy = "dx"
        
        movelist = [n_light , l_light , d_light , r_light , moveleft , moveright , jump , dodge , \
                    n_heavy , l_heavy , d_heavy , r_heavy]  #(163 xp)
        
        siglist = [n_heavy , l_heavy , d_heavy , r_heavy] #(94 xp)

        bruteforce = [n_heavy , dodge , jump ]   #(79 xp)
        
        chosenmove = random.choice(movelist)
        SendKeys.SendKeys(chosenmove)
        #SendKeys.SendKeys(l_heavy)
        #SendKeys.SendKeys(enter)

        time.sleep(1)
        
        bot()
예제 #27
0
파일: app.py 프로젝트: 2892931976/TimBot
    def handle_verify_code(self):
        """ 处理验证码登陆问题"""
        self.login_dm.CaptureJpg(121, 202, 254, 258, 'code.jpg', 100)

        verify_code = super_recognize('your-account', 'your-password',
                                      'code.jpg')
        SendKeys.SendKeys(str(verify_code))
        self.login_dm.KeyPress(13)
예제 #28
0
 def _sendCommandWindows(self, com):
     #This makes the window active and sends keyboard events directly.
     #Windows only.
     import win32gui
     import SendKeys
     #print("Got: %s" % com)
     result = win32gui.SetForegroundWindow(self.hwnd)
     SendKeys.SendKeys(com)   
예제 #29
0
def count():
        try:
                global counter
                global limit
                
                enter = "{ENTER}"
                SendKeys.SendKeys(str(counter))
                time.sleep(0.8)
                humandelay = random.uniform(0.1, 0.9) + \
                             random.uniform(0.2, 0.7) + \
                             random.uniform(0.2, 0.6) + \
                             random.uniform(0, 0.5)
                #time.sleep(int(humandelay))
                SendKeys.SendKeys(enter)
                counter += 1
        except Exception, e:
                print str("oops")
예제 #30
0
 def win_send_key(self, key):  #向系统发送内容
     try:
         SendKeys.SendKeys(key)
         return 0, None
     except Exception, ex:
         if debug:
             print "===api:win_send_key err:%s===" % (str(ex))
         return 1, "api:win_send_key err"
예제 #31
0
	def butpress(c='1'):
		sk.key_down(91)
		SendKeys(c)
		sk.key_up(91)