예제 #1
0
 def startcs_login(self):
     ison = reg.ison()
     if ison:
         self.app.start(onhpath, 3)
         w_login = self.app.top_window_()
         print(dir(w_login))
         w_login.print_control_identifiers()
         w_login[u"Edit1"].SetEditText("adjustor")
         w_login["ComboBox2"].click_input("left", (5, 5))
         time.sleep(0.5)
         w_login["ComboBox2"].click_input("left", (15, 55))
         time.sleep(0.5)
         w_login[u"Edit2"].SetEditText("ncschina")
         #time.sleep(5)
         w_login[u"登陆Button"].SetFocus()
         #time.sleep(5)
         w_login[u"登陆Button"].ClickInput()
         time.sleep(1.5)
     else:
         self.app.start(cspath, 3)
         time.sleep(2)
         w_login = self.app.top_window_()
         print(dir(w_login))
         w_login.print_control_identifiers()
         w_login[u"Edit1"].SetEditText("adjustor")
         w_login["ComboBox2"].click_input("left", (5, 5))
         time.sleep(0.5)
         w_login["ComboBox2"].click_input("left", (15, 35))
         time.sleep(0.5)
         w_login[u"Edit2"].SetEditText("ncschina")
         #time.sleep(5)
         w_login[u"登陆Button"].SetFocus()
         #time.sleep(5)
         w_login[u"登陆Button"].ClickInput()
         time.sleep(1.5)
예제 #2
0
def main():
    if is_user_an_admin():
        os.system(r'start explorer.exe')
        h=findExp()
        if h==None:
            return 
        d=pywinauto.controls.hwndwrapper.DialogWrapper(h)
        d.maximize()
        cs=d.children()
        i=0
        for c in cs:
            if "Address" in c.class_name():
                edit=c
            if "Search" in c.class_name():
                search=c
            print(c.class_name(),":",c.window_text())
            # img=c.CaptureAsImage()
            # if img!=None:
            #     img.save(str(i)+c.class_name()+".png")
            i+=1
        edit.set_focus() 
        edit.click_input()
        isonh=reg.ison()
        if isonh:
            edit.type_keys("C:\\Program{SPACE}Files\\NCS\\ONH3000{ENTER}")
        else:
            edit.type_keys("C:\\Program{SPACE}Files\\NCS\\CS3000{ENTER}")
        search.set_focus()
        #屏幕分辨率=1366*768
        time.sleep(1)
        d.click_input(button='right', pressed='', coords=(217,472), double=False, absolute=False)
        time.sleep(1)
        #属性
        d.click_input(button='left', pressed='', coords=(217+20,472-20), double=False, absolute=False)
        time.sleep(1)
        h=findNCSexe()
        d2=pywinauto.controls.hwndwrapper.DialogWrapper(h)
        #兼容
        d2.click_input(button='left', pressed='', coords=(89,47), double=False, absolute=False)
        time.sleep(1)
        #管理员身份
        d2.click_input(button='left', pressed='', coords=(52,368), double=False, absolute=False)
        time.sleep(1)
        #确定
        d2.click_input(button='left', pressed='', coords=(167,455), double=False, absolute=False)
        time.sleep(1)
        #open ncs.exe
        d.click_input(button='left', pressed='', coords=(217,472), double=True, absolute=False)
    else:
        print('\nYou are not an administrator')
예제 #3
0
# -*- coding: utf-8 -*-
import traceback
import os
import reg
import copyfile
import re
import getpath
destdrive = "C:"
bakdrive = "C:"
isonh = reg.ison()


def mylistdir(p, f):
    a = os.listdir(p)
    fs = myfind(a, f)
    return (fs)


def myfind(l, p):
    lr = []
    #print p
    p1 = p.replace(".", r"\.")
    p2 = p1.replace("*", ".*")
    p2 = p2 + "$"
    p2 = "^" + p2
    for a in l:
        #print a
        if re.search(p2, a, re.IGNORECASE) == None:
            pass
            #print "pass"
        else:
예제 #4
0
def main():
    isonh=reg.ison()
    if isonh:
        installonh.main()
    else:
        installcs.main()
예제 #5
0
    if ison:
        #copy 9111
        cmd = "xcopy /s %s\\..\\..\\刻盘\\9111 %s\\9111\\" % (curpath, dest)
        print(cmd)
        if os.path.exists(dest + "\\9111"):
            pass
        else:
            os.system(cmd)
        #
        cmd = 'xcopy /s "%s\\..\\..\\刻盘\\ONH3000v2.1.33" %s\\ONH3000v2.1.33\\' % (
            curpath, dest)
        print(cmd)
        if os.path.exists(dest + "\\ONH3000v2.1.33"):
            pass
        else:
            os.system(cmd)
    else:
        cmd = 'xcopy /s "%s\\..\\..\\刻盘\\CS3000备份" %s\\CS3000备份\\' % (curpath,
                                                                      dest)
        print(cmd)
        if os.path.exists(dest + "\\CS3000备份"):
            pass
        else:
            os.system(cmd)


if __name__ == "__main__":
    import reg
    ison = reg.ison()
    main(ison)