Exemplo n.º 1
0
 def startProgram(self, programTitle, programPath):
     try:
         print "Starting application..."
         global mainApp
         mainApp = pywinauto.application.Application()
         mainApp.start_(programPath)
         global updateDialog
         global applicationDialog
         updateDialog = mainApp.window_(title_re=programPath + " Update")
         timings.WaitUntilPasses(60, 2, updateDialog.Exists)
         if updateDialog.Exists():
             if updateDialog['Static'].Texts():
                 dlgText = updateDialog['Static'].Texts()
                 updateDialog['Button2'].Click()
                 applicationDialog = mainApp.window_(title_re=programTitle)
                 timings.WaitUntilPasses(60, 2, applicationDialog.Exists)
                 if applicationDialog.Exists():
                     print programTitle + " Dialog found..."
                     self._application_dialog = True
         else:
             applicationDialog = mainApp.window_(title_re=programTitle)
             timings.WaitUntilPasses(60, 2, applicationDialog.Exists)
             if applicationDialog.Exists():
                 print programTitle + " Dialog found..."
                 self._application_dialog = True
     except Exception as exp:
         print str(exp)
Exemplo n.º 2
0
    def step1(self):
        print 'test cai ji'
        app = application.Application()
        app.start_(config.app_cj_path, timeout=20, retry_interval=.5)
        window = timings.WaitUntilPasses(20, .5, lambda: app.window_(title_re=u'.*用户登录.*'))
        window.Wait('ready', 20, .5)
        window.Edit2.TypeKeys(config.app_user_name)
        window.Edit1.TypeKeys(config.app_password)
        time.sleep(2)
        timings.WaitUntil(30, 0.5, window.Button1.IsEnabled, True)
        window.Button2.Click()

        win1 = timings.WaitUntilPasses(20, .5, lambda: app.window_(title_re=u'.*选取就绪试验编号.*'))
        win1.Wait('ready', 100, .5)
        #print win1.TreeView.Texts()

        #print win1.TreeView.Root()
        node = win1.TreeView2.GetItem(path=u'\ \待做试验项目\20140729151356' )
        rct = node.Rectangle()
        win1.SysTreeView32.ClickInput(coords=(48, 47), wheel_dist=.5)
        print rct.left - 5, rct.top + 5
        win1.SysTreeView32.ClickInput(coords=(rct.left - 5, rct.top + 5), wheel_dist=.5)
        time.sleep(3)
        win1.Button.Click()
        mainform = timings.WaitUntilPasses(30, .5, lambda: app.window_(title_re=u'.*铁路试验实时采集系统.*'))
        mainform.Wait('ready', 20, 1)
        time.sleep(2)
        try:
            mainform.Button1.Click()
        except:
            print "error get "
        print 'start wait ' + time.strftime("%Y%m%d%H%M%S", time.localtime())

        timings.WaitUntil(20, 0.5, mainform.Button1.IsEnabled, True)
        print 'end wait ' + time.strftime("%Y%m%d%H%M%S", time.localtime())
Exemplo n.º 3
0
    def step3(self, case):
        """
        采集系统开始。。。

        """

        if case['type'] == 'WN':
            self.app.start_(config.app_cjWN_path, timeout=20, retry_interval=.5)
        else:
            self.app.start_(config.app_cjYL_path, timeout=20, retry_interval=.5)
        window = timings.WaitUntilPasses(20, .5, lambda: self.app.window_(title_re=u'.*用户登录.*'))
        # window.print_control_identifiers()
        window.Wait('ready', 20, .5)
        window.Edit2.TypeKeys(config.teddy_user_name)
        window.Edit1.TypeKeys(config.teddy_password)
        time.sleep(.6)
        timings.WaitUntil(30, 0.5, window.Button1.IsEnabled, True)
        window.Button1.Click()

        self.win1 = timings.WaitUntilPasses(20, .5, lambda: self.app.window_(title_re=u'.*选取就绪试验编号.*'))
        self.win1.Wait('ready', 100, .5)
        self.win1.TreeView.Wait('30', .5)
        nodepath = u'\\待做试验项目\\' + unicode(self.wtbh, "ascii")
        node = self.win1.TreeView2.GetItem(nodepath)
        self.win1.TreeView2.Select(nodepath)
        rct = node.Rectangle()
        self.win1.SysTreeView32.ClickInput(coords=(rct.left - 5, rct.top + 5), wheel_dist=.5)
        self.win1.Button.Click()
        self.mainform = timings.WaitUntilPasses(30, .5, lambda: self.app.window_(title_re=u'.*铁路试验实时采集系统.*'))
        self.mainform.Wait('ready', 20, 1)
        time.sleep(1)
        self.mainform.Button1.Click()
        time.sleep(1)
Exemplo n.º 4
0
def automatic_statup():
    SECU_BASE_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)),"security_file")

    app = application.Application()
    app.start("C:/KiwoomFlash3/Bin/NKMiniStarter.exe")

    title = "번개3 Login"
    dlg = timings.WaitUntilPasses(20, 0.5, lambda: app.window_(title=title))

    with open(os.path.join(SECU_BASE_DIR, "super.txt"), 'r+', encoding='utf-8') as f_read:
        service_key = f_read.readline().split(',')

    print(service_key)
    password = service_key[0]
    super_password = service_key[1]



    pass_ctrl = dlg.Edit2
    pass_ctrl.SetFocus()
    pass_ctrl.TypeKeys(password)

    cert_ctrl = dlg.Edit3
    cert_ctrl.SetFocus()
    cert_ctrl.TypeKeys(super_password)

    btn_ctrl = dlg.Button0
    btn_ctrl.Click()

    time.sleep(300)
    os.system("taskkill /im NKMini.exe")
Exemplo n.º 5
0
def cp_restart():
    os.system("taskkill /im DibServer.exe")
    os.system("taskkill /im CpStart.exe")
    os.system("taskkill /im ncStarter.exe")
    time.sleep(3)

    app = application.Application()
    app.start("C:/DAISHIN/STARTER/ncStarter.exe /prj:cp")

    time.sleep(1)
    # security warn popup
    dlg = app.top_window_()
    btn_ctrl = dlg.Button0
    btn_ctrl.Click()
    time.sleep(1)

    title = "CYBOS Starter"
    dlg = timings.WaitUntilPasses(20, 0.5, lambda: app.window_(title=title))

    pw1, pw2, pw3 = get_password()

    pass_ctrl = dlg.Edit2
    pass_ctrl.SetFocus()
    pass_ctrl.TypeKeys(pw1)
    time.sleep(1)
    cert_ctrl = dlg.Edit3
    cert_ctrl.SetFocus()
    cert_ctrl.TypeKeys(pw2)
    time.sleep(1)

    btn_ctrl = dlg.Button0
    btn_ctrl.Click()
Exemplo n.º 6
0
 def run(self):
     print("Auto Login Start")
     time.sleep(3)
     #C:\Users\Administrator\git\haedong\Haedong\Haedong\module\
     PROCNAME = "kfopcomms.exe"
     haedongPid = 0
     
     for proc in psutil.process_iter():
         if proc.name() == PROCNAME:
             print(proc.pid)
             haedongPid = proc.pid 
     
     
     app = Application().connect(process = haedongPid)
     
     title = "영웅문W Login"
     dlg = timings.WaitUntilPasses(20, 0.5, lambda: app.window_(title=title))
     
     pass_ctrl = dlg.Edit2
     pass_ctrl.SetFocus()
     pass_ctrl.TypeKeys('khj1342')
     
     pass_ctrl = dlg.Edit3
     pass_ctrl.SetFocus()
     pass_ctrl.TypeKeys('godqhr134@')
     
     btn_ctrl = dlg.Button0
     btn_ctrl.Click()
     
     self._stop()
Exemplo n.º 7
0
    def step1(self):
        self.app.start_(config.app_gl_path, timeout=20, retry_interval=.5)
        login_window = timings.WaitUntilPasses(120, .5, lambda: self.app.window_(title_re=u'.*用户登录.*'))
        login_window.Wait('ready', 20, 1)

        login_window.Edit1.TypeKeys(config.app_user_name)
        login_window.Edit2.TypeKeys(config.app_password)
        timings.WaitUntil(20, 0.5, login_window.Button1.IsEnabled, True)
        time.sleep(1)
        login_window.Button1.Click()

        self.main_form = timings.WaitUntilPasses(30, .5, lambda: self.app.window_(title_re=u'.*铁路试验信息管理系统.*'))
        time.sleep(2)
        self.main_form.Wait('ready', 120, 1)
        time.sleep(3)
        self.main_form.GetFocus()
        BringWindowToTop(self.main_form.handle)
Exemplo n.º 8
0
    def test_new_document(self):
        self.main_form.PressMouseInput(coords=(11, 115))
        self.main_form.MoveMouse(coords=(11, 117))
        self.main_form.Main_TabControl.ClickInput(coords=(100, 45), double=True, wheel_dist=.5)

        win1 = timings.WaitUntilPasses(20, .5, lambda: self.app.window_(title_re=u'.*待做事项列表.*'))
        win1.Wait('ready', 60, 1)
        BringWindowToTop(win1.handle)
        win1.Close()
        self.main_form.PressMouseInput(coords=(544, 16))
        self.main_form.ReleaseMouseInput(coords=(544, 16))
        self.main_form.TreeView2.Wait('ready', 20, 1)
        node = self.main_form.TreeView2.GetItem(u"\工程列表\Demo\SG-1标\中铁七局\中心实验室\钢筋试验报告")
        node.Click()
        node.Click(button='right')
        time.sleep(1)
        self.main_form.ClickInput(coords=(250, 210), wheel_dist=.5)

        editor = timings.WaitUntilPasses(20, .5, lambda: self.app.window_(title_re=u'.*资料编辑器.*'))
        editor.Wait('ready', 120, 1)
        time.sleep(3)
        editor.GetFocus()
        BringWindowToTop(editor.handle)
        editor.ClickInput(coords=(0,0), button='right',wheel_dist=.5)
        self.wtbh = time.strftime("%Y%m%d%H%M%S", time.localtime())
        # 设置委托编号
        editor.toolStrip2.ClickInput(coords=(544, 120), double='True', wheel_dist=.5)
        editor.TypeKeys(self.wtbh)
        #混动条拉到最下方
        editor.PressMouseInput(coords=(1347, 209))
        editor.MoveMouse(coords=(1347, 809))
        editor.ReleaseMouseInput(coords=(1347, 809))
        #输入制件日期
        editor.ClickInput(coords=(328, 398), double='True', wheel_dist=.5)
        editor.TypeKeys(time.strftime("%Y%m%d", time.localtime()))
        #切换到报告页面,并输入报告日期
        editor.ClickInput(coords=(345, 670), double='True', wheel_dist=.5)
        editor.ClickInput(coords=(523, 325), double='True', wheel_dist=.5)
        editor.TypeKeys(time.strftime("%Y%m%d", time.localtime()))
        #点击保存按钮
        editor.toolStrip12.ClickInput(coords=(57, 16), wheel_dist=.5)
        time.sleep(3)
        self.app[u'提示'].Button.Click()
        time.sleep(5)
        editor.Close()
Exemplo n.º 9
0
    def test_login(self):
        print 'test login'
        app = application.Application()
        app.start_(self.app_path, timeout=20, retry_interval=.5)
        login_window = timings.WaitUntilPasses(120, .5, lambda: app.window_(title_re=u'.*用户登录.*'))
        login_window.Wait('ready', 20, 1)
        self.assertEqual(login_window.ProcessID(), app.process)

        login_window.Edit1.TypeKeys(self.user_name)
        login_window.Edit2.TypeKeys(self.password)
        timings.WaitUntil(10, 0.5, login_window.Button1.IsEnabled, True)
        login_window.Button1.Click()

        main_form = timings.WaitUntilPasses(30, .5, lambda: app.window_(title_re=u'.*铁路试验信息管理系统.*'))
        main_form.Wait('ready', 30, 1)
        main_form.GetFocus()
        time.sleep(1)
        self.assertEqual(main_form.GetShowState(), 3)
        app.kill_()
Exemplo n.º 10
0
    def test_login_fail(self):
        print 'test login fail'
        app = application.Application()
        app.start_(self.app_path, timeout=20, retry_interval=.5)
        login_window = timings.WaitUntilPasses(120, .5, lambda: app.window_(title_re=u'.*用户登录.*'))
        login_window.Wait('ready', 20, 1)
        self.assertEqual(login_window.ProcessID(), app.process)

        login_window.Edit1.TypeKeys('aaa')
        login_window.Edit2.TypeKeys(self.password)
        timings.WaitUntil(10, 0.5, login_window.Button1.IsEnabled, True)
        login_window.Button1.Click()
        time.sleep(.5)
        app[u'提示'].Button.Click()

        login_window = timings.WaitUntilPasses(120, .5, lambda: app.window_(title_re=u'.*用户登录.*'))
        login_window.Wait('ready', 20, 1)
        self.assertEqual(login_window.ProcessID(), app.process)
        app.kill_()
Exemplo n.º 11
0
    def setUp(self):
        self.app = application.Application()
        self.app_path = "G:\客户端\客户端(新架构-Demo)\\铁路试验信息管理系统.exe".decode('GBK')
        self.user_name = u'刘晓明'
        self.password = '******'
        self.app.start_(self.app_path, timeout=20, retry_interval=.5)
        login_window = timings.WaitUntilPasses(120, .5, lambda: self.app.window_(title_re=u'.*用户登录.*'))
        login_window.Wait('ready', 20, 1)

        login_window.Edit1.TypeKeys(self.user_name)
        login_window.Edit2.TypeKeys(self.password)
        timings.WaitUntil(10, 0.5, login_window.Button1.IsEnabled, True)
        login_window.Button1.Click()

        self.main_form = timings.WaitUntilPasses(30, .5, lambda: self.app.window_(title_re=u'.*铁路试验信息管理系统.*'))
        time.sleep(2)
        self.main_form.Wait('ready', 40, 1)
        time.sleep(3)
        self.main_form.GetFocus()
        BringWindowToTop(self.main_form.handle)
def ControlHztl(login_title):
    timings.WaitUntilPasses(10, 0.5, lambda: app.window_(title=login_title))
    app[login_title].TypeKeys(
        '~')  # Press enter on login box to get to main window
    app[u'HORIZONTAL.LOG - [not saved]'].Wait('ready')
    app[u'HORIZONTAL.LOG - [not saved]'].MenuSelect("File -> Open")
    app[u'Open Log File'].Wait('ready')
    app[u'Open Log File'].TypeKeys(hztl_template_path + "{ENTER}",
                                   with_spaces=True)
    app[u'HORIZONTAL.LOG - Lateral Template.hlg'].Wait(
        'ready')  # Not sure if this is working
    app[u'HORIZONTAL.LOG - Lateral Template.hlg'].MenuSelect(
        "Edit->Headers")  # 'Edit' same as above, figure this out
    app[u'TMainHeaderForm'].Wait('ready')
    app[u'TMainHeaderForm'].TypeKeys(
        wellInfo[0] + " {(}Lateral{)}" + "{TAB}" + wellInfo[4] + "{TAB}" +
        wellInfo[1] + "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}" + wellInfo[5] +
        "{TAB}" + wellInfo[6] + "%i",
        with_spaces=True)
    app[u'Other Information'].Wait('ready')
    # Add 'rig' to the below screen. Two tabs then one down arrow. Need code for down arrow in sendkeys
    app[u'Other Information'].TypeKeys(
        "{TAB}Supervision:{SPACE}" + user_profile.companyman +
        "{ENTER}Rig:{SPACE}" + user_profile.rig + "{TAB}{TAB}" +
        user_profile.directional + "{ENTER}DD: " + user_profile.dd1 +
        "{ENTER}DD: " + user_profile.dd2 + "{ENTER}MWD: " + user_profile.mwd1 +
        "{ENTER}MWD: " + user_profile.mwd2 + "{TAB}{TAB}AFE:{SPACE}" +
        wellInfo[3] + "{ENTER}UWI:{SPACE}" + wellInfo[2] + "{TAB}" + "{ENTER}",
        with_spaces=True)
    app[u'TMainHeaderForm'].Wait('ready')
    app[u'TMainHeaderForm'].TypeKeys("%o")
    app[u'Operator'].Wait('ready')
    app[u'Operator'].TypeKeys(
        "Crescent Point Energy Corp. {(}Prepared for{SPACE}" +
        user_profile.reporting_to + "{)}" + "{ENTER}",
        with_spaces=True)
    app[u'TMainHeaderForm'].Wait('ready')
    app[u'TMainHeaderForm'].TypeKeys("%g")
    app[u'Geologist'].Wait('ready')
    app[u'Geologist'].TypeKeys(username_striplog + ",{SPACE}" + geo2_striplog +
                               "{ENTER}",
                               with_spaces=True)
    app[u'TMainHeaderForm'].Wait('ready')
    app[u'TMainHeaderForm'].TypeKeys("%c")
    app[u'HORIZONTAL.LOG - Lateral Template.hlg'].MenuSelect("File -> Save As")
    app[u'Save Log File AsDialog'].TypeKeys(save_dir + wellInfo[0] +
                                            " - Lateral.hlg{ENTER}",
                                            with_spaces=True)
    return
Exemplo n.º 13
0
    def run(self):
        global app
        #app = application.Application()
        title = "CybosPlus 주문확인 설정"
        dlg = timings.WaitUntilPasses(20, 0.5,
                                      lambda: app.window_(title=title))
        #dlg = app.top_window_()
        pw1, pw2, pw3 = get_password()

        pass_ctrl = dlg.Edit1
        pass_ctrl.SetFocus()
        pass_ctrl.TypeKeys(pw3)

        btn_ctrl = dlg.Button0
        btn_ctrl.Click()
Exemplo n.º 14
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()
Exemplo n.º 15
0
def ControlVert(login_title, window_name, template_path, log_type):
  timings.WaitUntilPasses(10, 0.5, lambda: app.window_(title=login_title))
  app[login_title].TypeKeys('~')
  app['STRIP.LOG - [not saved]'].Wait('ready')
  app['STRIP.LOG - [not saved]'].MenuSelect("File -> Open")
  app[u'Open Log File'].Wait('active ready')
  app[u'Open Log File'].TypeKeys(template_path + "{ENTER}", with_spaces=True)
  app[window_name].Wait('ready')
  app[window_name].MenuSelect("Edit->Headers")
  app[u'TMainHeaderForm'].Wait('ready')
  # Enter info into main header form and go into Alt+i
  app[u'TMainHeaderForm'].TypeKeys(wellInfo[0] + " {(}" + log_type + "{)}" + "{TAB}" + wellInfo[4] + "{TAB}" + wellInfo[1] + 
  "{TAB}" + wellInfo[8] + "{TAB}{TAB}{TAB}{TAB}{TAB}" + wellInfo[5] + "{TAB}" + wellInfo[6] + "{TAB}{TAB}{TAB}{TAB}" 
  + wellInfo[7] +"%i", with_spaces=True)
  app[u'Other Information'].Wait('ready')
  app[u'Other Information'].TypeKeys("{TAB}Supervision:{SPACE}" + user_profile.companyman + "{ENTER}Rig:{SPACE}" 
  + user_profile.rig + "{TAB}{TAB}" + user_profile.directional + "{ENTER}DD: " + user_profile.dd1 + "{ENTER}DD: " 
  + user_profile.dd2 + "{ENTER}MWD: " + user_profile.mwd1 + "{ENTER}MWD: " + user_profile.mwd2 + "{TAB}{TAB}License:{SPACE}"
  + wellInfo[1] + "{ENTER}AFE:{SPACE}" + wellInfo[3] + "{ENTER}UWI:{SPACE}" + wellInfo[2] + "{ENTER}{ENTER}{TAB}" + "{ENTER}", with_spaces=True)
  app[u'TMainHeaderForm'].Wait('ready')
  app[u'TMainHeaderForm'].TypeKeys("%o")
  app[u'Operator'].Wait('ready')
  app[u'Operator'].TypeKeys("Crescent Point Energy Corp. {(}Prepared for{SPACE}" + user_profile.reporting_to + "{)}" 
  + "{ENTER}", with_spaces=True)
  app[u'TMainHeaderForm'].Wait('ready')
  app[u'TMainHeaderForm'].TypeKeys("%g")
  app[u'Geologist'].Wait('ready')
  app[u'Geologist'].TypeKeys(username_striplog + ",{SPACE}" + geo2_striplog + "{ENTER}", with_spaces=True)
  app[u'TMainHeaderForm'].Wait('ready')
  app[u'TMainHeaderForm'].TypeKeys("%c")
  # Add Well name to top of logs
  app[window_name].TypeKeys('{HOME}')
  app[window_name].ClickInput(coords=(500,49), double=True)
  app[window_name].TypeKeys(wellInfo[0] + '^{ENTER}' + nameTag + '{ESC}', with_spaces=True)
  # Add Spud, GL, and KB info underneath
  app[window_name].RightClickInput(coords=(500,140))
  app[window_name].TypeKeys('n')
  app[window_name].ClickInput(coords=(500,140), double=True)
  app[window_name].TypeKeys('G.L: ' + wellInfo[5] + ' m' + '^{ENTER}' + 'K.B.: ' + wellInfo[6] + ' m^{ENTER}^{ENTER}'
  + 'Spud: Month xxth, 2016 at xx hrs' + '^{ENTER}Surface Casing set at xx m MD' + '^{ENTER}Sample Point {(}xx m MD{)}: '
  + 'Month xxth, 2016 at xx hrs' + '^{ENTER}KOP {(}xx m MD{)}: Month xxth, 2016 at xx hrs'
  + '^{ENTER}Mud Up {(}xx m MD{)}: Month xxth, 2016 at xx hrs{ESC}', with_spaces=True)
  app[window_name].Wait('ready')
  app[window_name].MenuSelect("File -> Save As")
  app[u'Save Log File AsDialog'].TypeKeys(save_dir + wellInfo[0] + " - " + log_type + ".slg{ENTER}", with_spaces=True)
  return
Exemplo n.º 16
0
 def chkNewVersionDialog(programPath):
     print "Starting application..."
     mainApp = pywinauto.application.Application()
     mainApp.start_(programPath)
     global updateDialog
     updateDialog = mainApp.window_(title_re="GetSusp Update")
     timings.WaitUntilPasses(30, 2, updateDialog.Exists)
     if updateDialog.Exists():
         if updateDialog['Static'].Texts():
             dlgText = updateDialog['Static'].Texts()
             updateDialog['Button2'].Click()
             return dlgText
         else:
             return None
     else:
         print "Update Dialog not found"
         return None
    def wait_windows_ready(self, **kwargs):

        if self._window:
            self.window.set_focus()
        # self.title = self.oem + " - Status"
        # self._app = Application().start(Windows_Controller(self.oem).statusapp)
        self._app = Application().connect(title_re=self.title)

        # self._app = Application().connect(title=self.oem + " - Status")

        def checkwindow():
            self._handle = find_windows(**kwargs)[0]
            return self._handle

        timings.WaitUntilPasses(self.element_wait_time, 1, checkwindow)
        self._window = self.app.window_(handle=self._handle)
        return self._window
Exemplo n.º 18
0
def ControlHztl(login_title):
  timings.WaitUntilPasses(10, 0.5, lambda: app.window_(title=login_title))
  app[login_title].TypeKeys('~') # Press enter on login box to get to main window
  app[u'HORIZONTAL.LOG - [not saved]'].Wait('ready')
  app[u'HORIZONTAL.LOG - [not saved]'].MenuSelect("File -> Open")
  app[u'Open Log File'].Wait('ready')
  app[u'Open Log File'].TypeKeys(hztl_template_path + "{ENTER}", with_spaces=True)
  app[u'HORIZONTAL.LOG - Lateral Template.hlg'].Wait('ready') # Not sure if this is working
  app[u'HORIZONTAL.LOG - Lateral Template.hlg'].MenuSelect("Edit->Headers") # 'Edit' same as above, figure this out
  app[u'TMainHeaderForm'].Wait('ready')
  # Enter info into main header form and go into Alt+i
  app[u'TMainHeaderForm'].TypeKeys(wellInfo[0] + " {(}Lateral{)}" + "{TAB}" + wellInfo[4] + "{TAB}" + wellInfo[1] + 
  "{TAB}" + wellInfo[8] + "{TAB}{TAB}{TAB}{TAB}{TAB}" + wellInfo[5] + "{TAB}" + wellInfo[6] + "{TAB}{TAB}{TAB}{TAB}" 
  + wellInfo[7] +"%i", with_spaces=True)
  app[u'Other Information'].Wait('ready')
  # Add 'rig' to the below screen. Two tabs then one down arrow. Need code for down arrow in sendkeys
  app[u'Other Information'].TypeKeys("{TAB}Supervision:{SPACE}" + user_profile.companyman + "{ENTER}Rig:{SPACE}"
  + user_profile.rig + "{TAB}{TAB}" + user_profile.directional + "{ENTER}DD: " + user_profile.dd1 + "{ENTER}DD: " 
  + user_profile.dd2 + "{ENTER}MWD: " + user_profile.mwd1 + "{ENTER}MWD: " + user_profile.mwd2 + "{TAB}{TAB}License:{SPACE}"
  + wellInfo[1] + "{ENTER}AFE:{SPACE}" + wellInfo[3] + "{ENTER}UWI:{SPACE}" + wellInfo[2] + "{ENTER}{ENTER}{TAB}" + "{ENTER}", with_spaces=True)
  app[u'TMainHeaderForm'].Wait('ready')
  app[u'TMainHeaderForm'].TypeKeys("%o")
  app[u'Operator'].Wait('ready')
  app[u'Operator'].TypeKeys("Crescent Point Energy Corp. {(}Prepared for{SPACE}" + user_profile.reporting_to + "{)}" 
  + "{ENTER}", with_spaces=True)
  app[u'TMainHeaderForm'].Wait('ready')
  app[u'TMainHeaderForm'].TypeKeys("%g")
  app[u'Geologist'].Wait('ready')
  app[u'Geologist'].TypeKeys(username_striplog + ",{SPACE}" + geo2_striplog + "{ENTER}", with_spaces=True)
  app[u'TMainHeaderForm'].Wait('ready')
  app[u'TMainHeaderForm'].TypeKeys("%c")
  # Add Well name to top of logs
  app[u'TDiagramForm'].TypeKeys('{HOME}')
  app[u'TDiagramForm'].ClickInput(coords=(4,550), double=True)
  app[u'TDiagramForm'].TypeKeys(wellInfo[0] + '{ESC}', with_spaces=True)
  # Add Spud, GL, and KB info underneath
  app[u'TDiagramForm'].RightClickInput(coords=(4,650))
  app[u'TDiagramForm'].TypeKeys('n')
  app[u'TDiagramForm'].ClickInput(coords=(4,650), double=True)
  app[u'TDiagramForm'].TypeKeys('G.L: ' + wellInfo[5] + ' m' + '^{ENTER}' + 'K.B.: ' + wellInfo[6] + ' m'
  + '^{ENTER}' + '^{ENTER}Spud: Month xxth, 2016 at xx hrs{ESC}', with_spaces=True)
  app[u'TDiagramForm'].Wait('ready')
  app[u'HORIZONTAL.LOG - Lateral Template.hlg'].MenuSelect("File -> Save As")
  app[u'Save Log File AsDialog'].TypeKeys(save_dir + wellInfo[0] + " - Lateral.hlg{ENTER}", with_spaces=True)
  return
Exemplo n.º 19
0
def run_creon_plus(username: str, password: str, certification_password: str, starter_path: str):
    app = Application().start('%s /prj:cp' % starter_path)
    sleep(1)
    typewrite('\n', interval=0.1)

    dialog = timings.WaitUntilPasses(
        30, 1, lambda: app.window(handle=find_window(title='CREON Starter'))
    )
    username_input = getattr(dialog, '1')
    username_input.Click()
    username_input.TypeKeys(username)
    password_input = getattr(dialog, '2')
    password_input.Click()
    password_input.TypeKeys(password)
    certification_password_input = getattr(dialog, '3')
    certification_password_input.Click()
    certification_password_input.TypeKeys(certification_password)
    press('enter')
Exemplo n.º 20
0
 def waitForScanComplete():
     status = mainApp.applicationDialog["statu bar"].GetPartText(0)
     while (True):
         if status == 'Ready':
             break
         else:
             warningDialog = mainApp.window_(title_re="Warning")
             timings.WaitUntilPasses(30, 2, warningDialog.Exists)
             if warningDialog.Exists():
                 if warningDialog['Cancel']:
                     warningDialog['Cancel'].Click()
                 elif warningDialog['OK']:
                     warningDialog['OK'].Click()
             else:
                 status = mainApp.applicationDialog[
                     "statu bar"].GetPartText(0)
                 continue
     print "Scan completed"
def ControlVert(login_title, window_name, template_path, log_type):
    timings.WaitUntilPasses(10, 0.5, lambda: app.window_(title=login_title))
    app[login_title].TypeKeys('~')
    app['STRIP.LOG - [not saved]'].Wait('ready')
    app['STRIP.LOG - [not saved]'].MenuSelect("File -> Open")
    app[u'Open Log File'].Wait('active ready')
    app[u'Open Log File'].TypeKeys(template_path + "{ENTER}", with_spaces=True)
    app[window_name].Wait('ready')
    app[window_name].MenuSelect("Edit->Headers")
    app[u'TMainHeaderForm'].Wait('ready')
    app[u'TMainHeaderForm'].TypeKeys(
        wellInfo[0] + " {(}" + log_type + "{)}" + "{TAB}" + wellInfo[4] +
        "{TAB}" + wellInfo[1] + "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}" +
        wellInfo[5] + "{TAB}" + wellInfo[6] + "%i",
        with_spaces=True)
    app[u'Other Information'].Wait('ready')
    app[u'Other Information'].TypeKeys(
        "{TAB}Supervision:{SPACE}" + user_profile.companyman +
        "{ENTER}Rig:{SPACE}" + user_profile.rig + "{TAB}{TAB}" +
        user_profile.directional + "{ENTER}DD: " + user_profile.dd1 +
        "{ENTER}DD: " + user_profile.dd2 + "{ENTER}MWD: " + user_profile.mwd1 +
        "{ENTER}MWD: " + user_profile.mwd2 + "{TAB}{TAB}AFE:{SPACE}" +
        wellInfo[3] + "{ENTER}UWI:{SPACE}" + wellInfo[2] + "{TAB}" + "{ENTER}",
        with_spaces=True)
    app[u'TMainHeaderForm'].Wait('ready')
    app[u'TMainHeaderForm'].TypeKeys("%o")
    app[u'Operator'].Wait('ready')
    app[u'Operator'].TypeKeys(
        "Crescent Point Energy Corp. {(}Prepared for{SPACE}" +
        user_profile.reporting_to + "{)}" + "{ENTER}",
        with_spaces=True)
    app[u'TMainHeaderForm'].Wait('ready')
    app[u'TMainHeaderForm'].TypeKeys("%g")
    app[u'Geologist'].Wait('ready')
    app[u'Geologist'].TypeKeys(username_striplog + ",{SPACE}" + geo2_striplog +
                               "{ENTER}",
                               with_spaces=True)
    app[u'TMainHeaderForm'].Wait('ready')
    app[u'TMainHeaderForm'].TypeKeys("%c")
    app[window_name].MenuSelect("File -> Save As")
    app[u'Save Log File AsDialog'].TypeKeys(save_dir + wellInfo[0] + " - " +
                                            log_type + ".slg{ENTER}",
                                            with_spaces=True)
    return
Exemplo n.º 22
0
from pywinauto import application
from pywinauto import timings
import time
import os

# Account
with open("private_info.txt", 'r') as f:
    pinfo = f.readlines()
app = application.Application()
app.start("C:/KiwoomFlash3/bin/nkministarter.exe")

title = "번개3 Login"
dlg = timings.WaitUntilPasses(20, 0.5, lambda: app.window_(title=title))

idForm = dlg.Edit0
idForm.SetFocus()
idForm.TypeKeys(pinfo[0])

passForm = dlg.Edit2
passForm.SetFocus()
passForm.TypeKeys(pinfo[1])

certForm = dlg.Edit3
certForm.SetFocus()
certForm.TypeKeys(pinfo[2])

loginBtn = dlg.Button0
loginBtn.Click()

# 업데이트가 완료될 때 까지 대기
while True:
Exemplo n.º 23
0
from pywinauto.application import Application
from pywinauto import timings

app = Application().start(
    "C:\\projects\\foo-rpc\\portable_test\\foobar2000.exe /config")
quick_config = timings.WaitUntilPasses(
    3, 0.5, lambda: app.window_(title='Quick Appearance Setup'))
quick_config.Close()

window = app.top_window_()['Tree2']
playback = window.GetItem('\\Playback')
playback.Expand()
output = playback.GetChild('Output')
output.Select()
output_page = app.top_window_()
output_page['ComboBox'].Select('Null Output')
output_page['OK'].Click()
Exemplo n.º 24
0
import os
import json
import sys

with open('C:/Users/user/Projects/kw.crd') as f:
    data = json.load(f)

ff = open('C:/Users/user/Projects/autotrading/log/autoupdate_log.txt', 'a')
ff.write("Autoupdate running at: " + time.ctime(time.time()) + "\n")

try:
    app = application.Application()
    app.start("C:/KiwoomFlash3/Bin/NKMiniStarter.exe")

    title = "번개3 Login"
    dlg = timings.WaitUntilPasses(20, 0.5, lambda: app.window_(title=title))

    pass_ctrl = dlg.Edit2
    pass_ctrl.SetFocus()
    pass_ctrl.TypeKeys(data['kw'])

    cert_ctrl = dlg.Edit3
    cert_ctrl.SetFocus()
    cert_ctrl.TypeKeys('')

    btn_ctrl = dlg.Button0
    btn_ctrl.Click()
except Exception as e:
    ff.write("    ERROR in Location 1\n")
    ff.write(e)
    ff.close()
Exemplo n.º 25
0
    def step2(self, case):
        self.main_form.PressMouseInput(coords=(11, 115))
        self.main_form.MoveMouse(coords=(11, 117))
        self.main_form.Main_TabControl.ClickInput(coords=(100, 45), double=True, wheel_dist=.5)

        win1 = timings.WaitUntilPasses(20, .5, lambda: self.app.window_(title_re=u'.*待做事项列表.*'))
        win1.Wait('ready', 60, 1)
        BringWindowToTop(win1.handle)
        win1.Close()
        self.main_form.PressMouseInput(coords=(703, 334))
        time.sleep(1)
        self.main_form.ReleaseMouseInput(coords=(703, 334))
        self.main_form.TreeView32.Wait('ready', 30, .5)
        if case['type'] == 'WN':
            node = self.main_form.TreeView2.GetItem(u"\工程列表\Demo\SG-1标\中铁七局\中心实验室\钢筋试验报告")
            node.Click()
            node.Click(button='right')
            time.sleep(1)
            self.main_form.ClickInput(coords=(250, 210), wheel_dist=.5)
            editor = timings.WaitUntilPasses(20, .5, lambda: self.app.window_(title_re=u'.*资料编辑器.*'))
            editor.Wait('ready', 30, 1)
            time.sleep(3)
            editor.GetFocus()
            BringWindowToTop(editor.handle)
            editor.ClickInput(coords=(0, 0), button='right', wheel_dist=.5)
            self.wtbh = time.strftime("%Y%m%d%H%M%S", time.localtime())
            # 设置委托编号
            editor.toolStrip2.ClickInput(coords=(544, 120), double='True', wheel_dist=.5)
            editor.TypeKeys(self.wtbh)
            # 设置钢筋直径
            editor.toolStrip2.ClickInput(coords=(574, 303), double='True', wheel_dist=.5)
            editor.TypeKeys(case['zj'])
            # 混动条拉到最下方
            editor.PressMouseInput(coords=(1347, 209))
            editor.MoveMouse(coords=(1347, 609))
            editor.ReleaseMouseInput(coords=(1347, 809))
            # 输入制件日期
            editor.ClickInput(coords=(328, 398), wheel_dist=.5)
            editor.TypeKeys(time.strftime("%Y%m%d", time.localtime()))

            # 切换到报告页面,并输入报告日期
            editor.ClickInput(coords=(345, 670), double='True', wheel_dist=.5)
            editor.ClickInput(coords=(523, 325), double='True', wheel_dist=.5)
            editor.TypeKeys(time.strftime("%Y%m%d", time.localtime()))
        else:
            node = self.main_form.TreeView2.GetItem(u"\工程列表\Demo\SG-1标\中铁七局\中心实验室\混凝土检查试件抗压强度试验报告三级配")
            node.Click()
            self.main_form.ClickInput(coords=(51, 64), wheel_dist=.5)
            editor = timings.WaitUntilPasses(20, .5, lambda: self.app.window_(title_re=u'.*资料编辑器.*'))
            editor.Wait('ready', 30, 1)
            time.sleep(1)
            editor.GetFocus()
            BringWindowToTop(editor.handle)
            editor.ClickInput(coords=(0, 0), button='right', wheel_dist=.5)
            self.wtbh = time.strftime("%Y%m%d%H%M%S", time.localtime())

            # 设置委托编号
            editor.toolStrip2.ClickInput(coords=(184, 153), double='True', wheel_dist=.5)
            editor.TypeKeys(self.wtbh)

	    #输入强度等级
            editor.toolStrip2.ClickInput(coords=(116, 290), double='True', wheel_dist=.5)
            editor.TypeKeys(case['qddj'])

            #设置试块尺寸
            editor.toolStrip2.ClickInput(coords=(210, 207), double='True')
            time.sleep(.2)
            editor.ClickInput(coords=(210, 321), double='True', wheel_dist=.5)

	   


            #输入制件日期
            editor.toolStrip2.ClickInput(coords=(678, 207), double='True', wheel_dist=.5)
            d3 = datetime.datetime.now() + datetime.timedelta(days=-28)
            editor.TypeKeys(d3.strftime("%Y%m%d"))

            #切换到委托单页面,将 混动条拉到最下方
            editor.ClickInput(coords=(332, 665), wheel_dist=.5)
            editor.toolStrip2.ClickInput(coords=(488, 280), double='True', wheel_dist=.5)
            time.sleep(1)
            editor.ClickInput(coords=(487, 395), double='True', wheel_dist=.5)

            #切换到报告页面,并输入报告日期
            editor.ClickInput(coords=(670, 665), double='True', wheel_dist=.5)
            editor.ClickInput(coords=(551, 260), double='True', wheel_dist=.5)
            editor.TypeKeys(time.strftime("%Y%m%d", time.localtime()))
        # 点击保存按钮
        editor.toolStrip12.ClickInput(coords=(57, 16), wheel_dist=.5)
        self.app[u'提示'].Wait('ready', 10, .5)
        self.app[u'提示'].Button.Click()
        time.sleep(3)
        # editor.CloseClick()
        self.app.kill_()
def repeated_check_generic(dlg, name, callback):
    return timings.WaitUntilPasses(
        10, 0.5, callback, (pywinauto.findwindows.WindowNotFoundError,
                            pywinauto.findbestmatch.MatchError,
                            pywinauto.controls.HwndWrapper.ControlNotEnabled),
        dlg, name)
Exemplo n.º 27
0
 def setPreferences():
     global prefDialog
     if applicationDialog.Exists():
         mainApp.applicationDialog["tool bar"].Button(3).Click()
         prefDialog = mainApp.window_(title_re="Preferences")
         timings.WaitUntilPasses(60, 2, prefDialog.Exists)