Пример #1
0
 def __init__(self, location):
     # window
     self.location = location
     self.fpp_key = 0
     self.top_key = 0
     self.title = 'drone_simulator'
     self.app = application.Application(backend='win32')
     self.app.connect(title=self.title)[0]
     self.win = self.app.window(title_re=self.title)
     self.coords = (0, 0, 0)
     self.angles = (0, 0, 0)
Пример #2
0
 def __init__(self):
     self.app = application.Application()
     self.keyboard = keyboard
     print("Initializing ICP Automation")
     self.app.start("C:\\Softlog\\IcpWin\\ICP_Win.exe")
     sleep(1)
     self.keyboard.SendKeys("{ENTER}")
     sleep(13)
     self.keyboard.SendKeys("{ENTER}")
     print("Ready for ICP to start converting files")
     self.first_time = True
Пример #3
0
 def connect(self, id_, pwd, pwdcert):
     if not self.connected():
         self.disconnect()
         self.kill_client()
         app = application.Application()
         app.start(
             'C:\DAISHIN\STARTER\\ncStarter.exe /prj:cp /id:{id} /pwd:{pwd} /pwdcert:{pwdcert} /autostart'
             .format(id=id_, pwd=pwd, pwdcert=pwdcert))
     while not self.connected():
         time.sleep(1)
     return True
Пример #4
0
def open_pc_appium2():
    """打开夜神模拟器"""
    file_path = readConfig().get_exe()['appium']
    app = application.Application(backend='uia')
    try:
        app.connect(title_re='Appium', class_name='Chrome_WidgetWin_1')
        sleep(8)
    except ElementNotFoundError:
        app.start(file_path)
        sleep(8)
    log.info('Sucess open appium!')
Пример #5
0
def install_py_mod(s):
    try:
        app=application.Application()
        app.start("cmd.exe")
    except:
        time.sleep(3)
        p.typewrite("pip install "+s)
        p.press("enter")
        p.typewrite("exit()")
        time.sleep(2)
        p.press("enter")
Пример #6
0
def open_pc_yesheng():
    """打开夜神模拟器"""
    file_path = readConfig().get_exe()['yesheng']
    app = application.Application(backend='uia')
    try:
        app.connect(title_re='夜神模拟器', class_name='Qt5QWindowIcon')
        sleep(5)
    except ElementNotFoundError:
        app.start(file_path)
        sleep(40)
    log.info('Sucess open 夜神模拟器!')
Пример #7
0
def conn_creon(pwd):
    os.system('taskkill /IM coStarter* /F /T')
    os.system('taskkill /IM CpStart* /F /T')
    os.system('wmic process where "name like \'%coStarter%\'" call terminate')
    os.system('wmic process where "name like \'%CpStart%\'" call terminate')
    time.sleep(5)

    app = application.Application()
    app.start(
        'C:\DAISHIN\CREON\STARTER\coStarter.exe /prj:cp /id:dpdp /pwd:xxxx /pwdcert:xxxxx /autostart'
    )
    time.sleep(60)
Пример #8
0
 def upload_resImg(self, imgUrl):
     self.click(self.addImg_btn)
     self.sleep(2)
     app = application.Application()
     app.connect(title=u'打开', class_name='#32770')
     window = app.window(title=u'打开', class_name='#32770')
     # 文件所在路径不能含有空格
     window["Edit"].type_keys(imgUrl)
     self.sleep(2)
     window["ScrollBar"].click()
     window[u"打开(O)"].click()
     self.sleep(2)
 def upload(self, filePath):
     self.click(self.upload_btn)
     self.sleep(2)
     app = application.Application()
     app.connect(title=u'打开', class_name='#32770')
     window = app.window(title=u'打开', class_name='#32770')
     # 文件所在路径不能含有空格
     window["Edit"].type_keys(filePath)
     self.sleep(2)
     window["ScrollBar"].click()
     window[u"打开(O)"].click()
     self.sleep(2)
Пример #10
0
def login(user_info):
    print("login(user_info):")
    id = user_info[0]
    pw = user_info[1]
    cert = user_info[2]

    app = application.Application()
    app.start(
        "C:\CREON\STARTER\coStarter.exe //prj:cp /id:%s /pwd:%s /pwdcert:%s /autostart"
        % (id, pw, cert))

    return True
Пример #11
0
 def funcWindow(self):
     #d_handle = application.findwindows.find_windows(title=u'KHOpenAPI')[0]
     try:
         d_handle = application.findwindows.find_windows(
             title=u'\uc548\ub155\ud558\uc138\uc694. '
             u'\ud0a4\uc6c0\uc99d\uad8c \uc785\ub2c8\ub2e4.')[0]
         dlg_app = application.Application().connect(handle=d_handle)
         dlg = dlg_app.window(handle=d_handle)
         dlg.SetFocus()
         ctrl = dlg['확인']
         ctrl.Click()
     except Exception as e:
         print(e)
Пример #12
0
 def __init__(
     self,
     appName="D:\Program Files (x86)\ABBYY FineReader 12\FineReader.exe".
     decode()):
     self.app = application.Application()
     self.app.start_(appName)
     self.findReader = self.app.FineReader12MainWindowClass
     self.index = 0
     self.max()
     time.sleep(2)
     self.cancelDig()
     self.findReader.Minimize()
     self.click = 0
 def startrun(self):
     if not os.path.exists("output\\Reports"):
         os.mkdir("output\\Reports")
     images = glob.glob("output\\*.bmp")
     app = application.Application()
     app.Start(r"C:\Sagar_Agrawal\Projects\ML\MaZda 4.6\MaZda.exe")
     time.sleep(5)
     app.MaZda.MenuSelect("File -> Run macro...")
     app.Runmacro.Edit.TypeKeys(
         r"C:\Sagar_Agrawal\Projects\ML\Codes\macro.txt")
     app.Runmacro.Open.Click()
     time.sleep(300)  # specify time in seconds
     app.Kill_()
Пример #14
0
def kill_ie(ie_path):
    '''
    If there are several IE windows openen, pywinauto cannot connect with proper window correctly
    to save Internet page
    '''

    ie_works = True
    while ie_works:
        try:
            exp = application.Application().connect(path=ie_path)
            exp.kill()
        except application.ProcessNotFoundError:
            ie_works = False
Пример #15
0
 def __init__(self):
     self.app_base = application.Application(backend="uia")
     self.app = self.app_base.start(
         r"D:\明日方舟\emulator\nemu\EmulatorShell\NemuLauncher.exe -p com.hypergryph.arknights"
     )
     self.img_start = r'caiyang\start.png'
     self.img_huanxing = r'caiyang\huanxing.png'
     self.img_huodong = r'caiyang\huodong.png'
     self.img_meiri = r'caiyang\meiri.png'
     self.img_guanggao = r'caiyang\guanggao.png'
     self.img_renwu = r'caiyang\renwu.png'
     self.img_richang = r'caiyang\richang.png'
     self.img_lingqu = r'caiyang\lingqu.png'
     self.img_isrenwu = r'caiyang\isrenwu.png'
     self.img_tuichu = r'caiyang\tuichu.png'
     self.img_zuozhan = r'caiyang\zuozhan.png'
     self.img_xpss = r'caiyang\xpss.png'
     self.img_cklx = r'caiyang\cklx.png'
     self.img_2 = r'caiyang\2.png'
     self.img_isdaili = r'caiyang\isdaili.png'
     self.img_daili = r'caiyang\daili.png'
     self.img_ksxd = r'caiyang\ksxd.png'
     self.img_ksxd2 = r'caiyang\ksxd2.png'
     self.img_xdjs = r'caiyang\xdjs.png'
     self.img_zhuomian = r'caiyang\zhuomian.png'
     self.img_hqwz = r'caiyang\hqwz.png'
     self.img_isgkzm = r'caiyang\isgkzm.png'
     self.img_gkzm = r'caiyang\gkzm.png'
     self.img_skip = r'caiyang\skip.png'
     self.img_iscaigou = r'caiyang\iscaigou.png'
     self.img_caigou = r'caiyang\caigou.png'
     self.img_isxinyong = r'caiyang\isxinyong.png'
     self.img_xinyong = r'caiyang\xinyong.png'
     self.img_sqxy = r'caiyang\sqxy.png'
     self.img_5 = r'caiyang\5.png'
     self.img_mylz = r'caiyang\mylz.png'
     self.img_lizhi = r'caiyang\lizhi.png'
     self.img_hwys = r'caiyang\hwys.png'
     self.img_wzcb = r'caiyang\wzcb.png'
     self.img_keyao = r'caiyang\keyao.png'
     self.img_isjz = r'caiyang\isjz.png'
     self.img_jj1 = r'caiyang\jj1.png'
     self.img_qbsh = r'caiyang\qbsh.png'
     self.img_qbjf = r'caiyang\qbjf.png'
     self.img_end = r'caiyang\end.png'
     self.img_end2 = r'caiyang\end2.png'
     self.img_jjtc = r'caiyang\jjtc.png'
     self.img_sxsz = r'caiyang\sxsz.png'
     self.img_1 = r'caiyang\1.png'
     self.img_isrw = r'caiyang\isrw.png'
     self.img_qdky = r'caiyang\qdky.png'
Пример #16
0
    def connect(self, id_, pwd, pwdcert, trycnt=300):
        if not self.connected():
            app = application.Application()
            app.start(
                'C:\\CREON\\STARTER\\coStarter.exe /prj:cp /id:{id} /pwd:{pwd} /pwdcert:{pwdcert} /autostart'
                .format(id=id_, pwd=pwd, pwdcert=pwdcert))

        cnt = 0
        while not self.connected():
            if cnt > trycnt:
                return False
            time.sleep(1)
            cnt += 1
        return True
Пример #17
0
 def __init__(self):
     self._app = application.Application(backend="uia").connect(
         path="C:\全能行证券交易终端\\xiadan.exe")
     self._dlg = self._app['Dialog']['网上股票交易系统5.0']
     self._top_panel = self._dlg.child_window(auto_id="59648", ctrl_index=0)
     self._side_menu = self._dlg.child_window(auto_id="129",
                                              control_type="Tree")
     self._table_window = self._top_panel.child_window(title="Custom1",
                                                       control_type="Pane")
     self._buy = self._dlg.child_window(title="买入[F1]")
     self._sell = self._dlg.child_window(title="卖出[F2]")
     self._buy_button = self._top_panel.child_window(title="买入[B]")
     self._sell_button = self._top_panel.child_window(title="卖出[S]")
     self._deal_panel = self._dlg.child_window(title="当日委托")
Пример #18
0
def open_pc_appium():
    """打开appium"""
    file_path = readConfig().get_exe()['appium']  # 读取appium.exe文件路径
    app = application.Application(backend='uia')  # 定义application实例
    # app.start(file_path)
    # sleep(2)
    # print(pywinauto.findwindows.find_elements(title='Appium'))
    app.connect(title_re='Appium', class_name='Chrome_WidgetWin_1')
    appium = app.window(title='Appium')  # 指定窗口
    appium.wait("exists ready", timeout=3, retry_interval=3)  # 等待窗口就绪
    # sleep(5)
    appium.print_control_identifiers()
    appium.Button4.click()  # 点击指定按钮(Button4)
    log.info('Sucess start appium!')
def Connction():
    app = application.Application(backend='uia').start(
        'C:\Program Files (x86)\Gateway\SSLVPN\gwclient.exe')
    # app = application.Application().start('C:\Program Files (x86)\Gateway\SSLVPN\gwclient.exe')
    wind_1 = app.actions
    send_keys("{VK_RETURN}")
    time.sleep(10)
    mouse.press(button='left', coords=(940, 450))  # 账号
    send_keys("J0009")
    time.sleep(10)
    mouse.press(button='left', coords=(940, 500))  # 密码
    send_keys("12345678")
    time.sleep(2)
    send_keys("{VK_RETURN}")
    def install_EMS_server(self):
        try:
            if (os.path.isfile(self.progam_path) == False):
                print 'The file %s didn\'t exist!!!'% (self.progam_path)
                return
            app = application.Application.start(self.progam_path)
            time.sleep(5)
            #print "start EMS_server install progam................."
            WINDOW_TITLE = u"CY-EMS-server 安装"
            app=application.Application().connect_(title_re = WINDOW_TITLE )
            Bunton = u'下一步(&N) >'
            app[WINDOW_TITLE][Bunton].Click()
            
            WINDOW_TITLE = u"CY-EMS-server 安装: 软件许可协议"
            #time.sleep(2)
            Bunton = u'我接受“许可证协议”中的条款(&A)'
            app[WINDOW_TITLE][Bunton].DoubleClick()
            Bunton = u'下一步(&N) >'
            app[WINDOW_TITLE][Bunton].Click()
            
            WINDOW_TITLE = u"CY-EMS-server 安装: 选择安装位置"   
            Bunton = u'下一步(&N) >'
            app[WINDOW_TITLE][Bunton].Click()

            WINDOW_TITLE = u"CY-EMS-server 安装: 选择“开始菜单”文件夹"
            Bunton = u'安装(&I)'
            app[WINDOW_TITLE][Bunton].Click()


            #time.sleep(1)
            WINDOW_TITLE = u"CY-EMS-server 安装: 复制文件"
            Button = u'下一步(&N) >'
            Button_Property = HwndWrapper.HwndWrapper(app[WINDOW_TITLE][Button]).GetProperties()
            while(Button_Property['IsEnabled'] == False):
                time.sleep(1)
                Button_Property = HwndWrapper.HwndWrapper(app[WINDOW_TITLE][Button]).GetProperties()
                
            #time.sleep(1)
            WINDOW_TITLE = u"CY-EMS-server 安装: 已完成"
            app[WINDOW_TITLE][Button].Click()
            
            Bunton = u'关闭'
            WINDOW_TITLE = u"CY-EMS-server 安装: 安装完成"
            app[WINDOW_TITLE][u'关闭'].Click()

            return "EMS_server install success"
        except Exception,e:
            print 'Exception:',e
            return "EMS_server install unsuccess!!!!"
def focusWindow(name):
    # Init App object
    app = application.Application()
    try:
        app.connect(title_re=".*%s.*" % name)

        # Access app's window object
        app_dialog = app.top_window()
        app_dialog.set_focus()
    except(WindowNotFoundError):
        print('"%s" not found' % name)
        pass
    except(WindowAmbiguousError):
        print('There are too many "%s" windows found' % name)
        pass
Пример #22
0
    def connect(self, id_, pwd):
        if not self.connected():
            self.disconnect()
            self.kill_client()
            print("########## CYBOS 프로세스 자동 접속")

            app = application.Application()
            # cybos plus를 정보 조회로만 사용했기 때문에 인증서 비밀번호는 입력하지 않았다.
            app.start(
                'C:\Daishin\Starter\\ncStarter.exe /prj:cp /id:{id} /pwd:{pwd} /autostart'
                .format(id=id_, pwd=pwd))

            while not self.connected():
                time.sleep(1)
            return True
Пример #23
0
 def focus_window(self, name):
     """
     Uses pywinauto to focus window that contains 'name' in its name.
     Windows only!
     """
     app = application.Application()
     try:
         app.connect(title_re=".*%s.*" % name)
         app_dialog = app.top_window_()
         app_dialog.Minimize()
         app_dialog.Restore()
         # app_dialog.SetFocus()
         logging.info("Restored {} window".format(name))
     except:
         raise
Пример #24
0
 def start(self):
     self.window_ready = False
     try:
         sleep(1)
         os.popen(r'taskkill /f /t /im Download.exe')
         sleep(1)
     except Exception:
         pass
     self.app = application.Application()
     self.win = None
     self.app.start(self.exepath)
     sleep(1)
     self.win = self.app['Dialog']
     self.win.move_window(0, 0)
     self.window_ready = True
Пример #25
0
    def __init__(self, applicationpath, delay=1.0):
        self.process = self.execApplication(applicationpath)
        self.app = application.Application()

        def connect():
            self.app.connect_(title_re='AF Editor')

        timing.WaitUntilPasses(10, 0.5, connect,
                               pywinauto.findwindows.WindowNotFoundError)
        self.delay = delay
        self.initTimings()
        self.afeditorwin = self.app.window_(process=self.process.pid)

        self.treeview = self.afeditorwin['TreeView']
        self.afeditor = self.afeditorwin.WrapperObject()
Пример #26
0
 def __init__(self):
     self.app = application.Application()
     self.keyboard = keyboard
     print("Initializing ICP Automation")
     self.app.start("C:\\Softlog\\IcpWin\\ICP_Win.exe")
     sleep(1)
     self.keyboard.send_keys("{ENTER}")
     sleep(13)
     # # If an error pop up window happens then just press enter and move on
     if(self.app.top_window().window_text() == "ICP for Windows"):
         self.keyboard.send_keys("{ENTER}", pause=DEBUG_PAUSE)
     if(self.app.top_window().window_text() == "About"):
         self.keyboard.send_keys("{ENTER}", pause=DEBUG_PAUSE)
     print("Ready for ICP to start converting files")
     self.first_time = True
Пример #27
0
 def init_app(self, index=0):
     """实例化app"""
     try:
         app = application.Application().connect(title_re='外贸企业出口退税申报系统2.1版',
                                                 class_name=self.CLASS_NAME[index])  # 实例化
         dlg = app['外贸企业出口退税申报系统2.1版']
         setattr(self, 'app', app)
         setattr(self, 'dlg', dlg)
         setattr(self, 'class_name', self.CLASS_NAME[index])
     except:
         if index >= len(self.CLASS_NAME):
             self.print_error('  ----- 请打开退税系统 !!! -----')
             index = -1
             self.healper()
         index += 1
         self.init_app(index)
Пример #28
0
 def upload(self, filePath):
     """
     上传图片
     :param filePath: 图片路径
     :return:
     """
     self.sleep(1)
     app = application.Application()
     app.connect(title=u'打开', class_name='#32770')
     window = app.window(title=u'打开', class_name='#32770')
     # 文件所在路径不能含有空格
     window["Edit"].type_keys(filePath)
     self.sleep(2)
     window["ScrollBar"].click()
     window[u"打开(O)"].click()
     self.sleep(2)
 def add_queue_job(self):
     subprocess.Popen("cmd /c " + self.get_mzdx_path())
     time.sleep(15)
     self.conn_app = application.Application(backend="uia").connect(title=u'Mozy Restore Manager', found_index=0)
     self.restore_manager = self.conn_app.Window_(title=u'Mozy Restore Manager', found_index=0)
     warning_msg = 'Only one job may be running at a time. This job will be added to the queue.'
     warning_element = self.restore_manager.child_window(title=warning_msg, control_type="Text")
     assert warning_element.is_visible() is True
     LogHelper.info("Verified that the warning message is displayed: " + warning_msg)
     add_to_queue_btn = self.restore_manager.child_window(title="Add to Queue", control_type="Text")
     assert add_to_queue_btn.is_visible() is True
     LogHelper.info("Verified that the 'Add to Queue' button is displayed for user.")
     add_to_queue_btn.click_input()
     job_status = str(self.restore_manager.child_window(title="Queued", control_type="Text").texts()).split("'")[1]
     assert job_status == 'Queued'
     LogHelper.info("Verified that the new added job is in 'Queued' status.")
Пример #30
0
def cf_avoid_idle():
    r = False
    try:
        app = application.Application()
        app.connect(path=r"C:\财富证券独立委托(聚财版)\xiadan.exe")
        dlg = app.window(handle=cf_window_handle)
        time.sleep(1)
        dlg['买入[B]'].click()
        time.sleep(3)
        dlg_spec = app.top_window()
        dlg_spec['确定'].click()
        r = True
    except:
        pass

    return r