pyautogui 응용 프로그램:CiTdxWGuanbi.py(자동 디스크 후 데이터 다운로드 및 데이터 유지보수 및 꺼짐)

# -*- coding: utf-8 -*-

'''
  :
pywin32  :    、    、  、     


'''





#                       pygetwindow    

import pyautogui
import pygetwindow as gw
import time

pyautogui.FAILSAFE=False    #                 point(x,y)=0,0     
pyautogui.PAUSE=1           #             pyautogui            0.5 



# =============================================================================
# #    
# =============================================================================
def shujuxiazai():
    
#      
    pyautogui.click('TdxW    /200.png',duration=1,tween=pyautogui.easeInOutQuad)
    pyautogui.typewrite(['down']*11)
    pyautogui.press('enter')
    
    pyautogui.click('TdxW    /202    .png',duration=1,tween=pyautogui.easeInOutQuad)
    
    pyautogui.click('TdxW    /202         .png',duration=1,tween=pyautogui.easeInOutQuad)
    pyautogui.typewrite(['right','right','enter'])
    #pyautogui.typewrite(['right','right','num0','num1','enter'])
    
    while not(pyautogui.locateOnScreen('TdxW    /202    .png',grayscale=True)):
        time.sleep(0.01)
        if pyautogui.locateOnScreen('TdxW    /202     .png',grayscale=True):
            break
    pyautogui.click('TdxW    /202  .png',duration=1,tween=pyautogui.easeInOutQuad)
    
    
    
    
# =============================================================================
# #    _    
# =============================================================================
def shujuxiazai_caiwushuju():
    
#      
    pyautogui.click('TdxW    /200.png',duration=1,tween=pyautogui.easeInOutQuad)
    pyautogui.typewrite(['down']*12)
    pyautogui.press('enter')
    
    time.sleep(1)
    if len(list(pyautogui.locateAllOnScreen('TdxW    /203          .png',grayscale=True)))==2:
        pyautogui.click('TdxW    /203  .png',duration=1,tween=pyautogui.easeInOutQuad)

    else:     
#      
        jsq203=0
        sTime203=time.time()
        while not pyautogui.locateOnScreen('TdxW    /203    .png',grayscale=True):
            time.sleep(0.01)

            jsq203=time.time()-sTime203
            if jsq203>=60:
                print('error:  203      ...')
    
            
        pyautogui.click('TdxW    /203    .png',duration=1,tween=pyautogui.easeInOutQuad)
        pyautogui.moveRel(0,-100,duration=0.5,tween=pyautogui.easeInOutQuad)
    
#    ,        
        while (len(list(pyautogui.locateAllOnScreen('TdxW    /203    .png'))) != 2):
            time.sleep(0.01)
            while pyautogui.locateOnScreen('TdxW    /203    .png',grayscale=True):
                try:
                    pyautogui.click('TdxW    /203    .png',duration=1,tween=pyautogui.easeInOutQuad)
                    pyautogui.moveRel(0,-100,duration=0.5,tween=pyautogui.easeInOutQuad)
                except:
                    pass
                if (len(list(pyautogui.locateAllOnScreen('TdxW    /203    .png'))) == 2):
                    break
                    
        w203=0
        while w203==0:
            pyautogui.click('TdxW    /203    .png',duration=1,tween=pyautogui.easeInOutQuad)
            pyautogui.moveRel(0,100,duration=0.5,tween=pyautogui.easeInOutQuad)
                
            if (len(list(pyautogui.locateAllOnScreen('TdxW    /203    .png'))) == 2):
                w203=1
    
    
#    
        pyautogui.click('TdxW    /203  .png',duration=1,tween=pyautogui.easeInOutQuad)
    
    
        #                 :
        time.sleep(1)
        while pyautogui.locateOnScreen('TdxW    /203        .png'):
            pyautogui.click('TdxW    /203     .png',duration=1,tween=pyautogui.easeInOutQuad)
    
            #      
    
            while not pyautogui.locateOnScreen('TdxW    /203    _   .png',grayscale=True):
                time.sleep(0.01)
                print('error:     203    ...')
    
            pyautogui.click('TdxW    /203    _   .png',duration=1,tween=pyautogui.easeInOutQuad)
            pyautogui.moveRel(0,-100,duration=0.5,tween=pyautogui.easeInOutQuad)
        
            #    ,        
            while (len(list(pyautogui.locateAllOnScreen('TdxW    /203    .png'))) != 2):
                time.sleep(0.01)
                while pyautogui.locateOnScreen('TdxW    /203    .png',grayscale=True):
                    try:
                        pyautogui.click('TdxW    /203    .png',duration=1,tween=pyautogui.easeInOutQuad)
                        pyautogui.moveRel(0,-100,duration=0.5,tween=pyautogui.easeInOutQuad)
                    except:
                        pass
                    if (len(list(pyautogui.locateAllOnScreen('TdxW    /203    .png'))) == 2):
                        pyautogui.click('TdxW    /203    .png',duration=1,tween=pyautogui.easeInOutQuad)
            #    
            pyautogui.click('TdxW    /203  .png',duration=1,tween=pyautogui.easeInOutQuad)
    
            



    
# =============================================================================
# #    
# =============================================================================
def shujuweihu():
    pyautogui.click('TdxW    /200.png',duration=1,tween=pyautogui.easeInOutQuad)
    pyautogui.typewrite(['down']*14)
    pyautogui.press('enter')
    
    while not pyautogui.locateOnScreen('TdxW    /204    .png',grayscale=True):
        time.sleep(0.01)
    pyautogui.click('TdxW    /204    .png',duration=1,tween=pyautogui.easeInOutQuad)
    pyautogui.click('TdxW    /204  .png',duration=1,tween=pyautogui.easeInOutQuad)

    pyautogui.press(['down']*2)
    pyautogui.press(['right'])
    pyautogui.press(['down','right'])
    pyautogui.press(['down']*9)
    pyautogui.press(['enter'])
    
    pyautogui.press(['tab']*8)
    pyautogui.press(['space','space'])

    while not pyautogui.locateOnScreen('TdxW    /204T0002.png',grayscale=True):
        time.sleep(0.01)
        print('    :       T0002   。')
    pyautogui.click('TdxW    /204    .png',duration=1,tween=pyautogui.easeInOutQuad)
    
    while not pyautogui.locateOnScreen('TdxW    /204    .png',grayscale=True):
        time.sleep(0.01)
    pyautogui.click('TdxW    /204    .png',duration=1,tween=pyautogui.easeInOutQuad)
   
    while not pyautogui.locateOnScreen('TdxW    /204    .png',grayscale=True):
        time.sleep(0.01)
    pyautogui.click('TdxW    /204    .png',duration=1,tween=pyautogui.easeInOutQuad)
    pyautogui.press('enter')

    while not pyautogui.locateOnScreen('TdxW    /204    .png',grayscale=True):
        time.sleep(0.01)
    pyautogui.click('TdxW    /204    .png',duration=1,tween=pyautogui.easeInOutQuad)
    pyautogui.hotkey('alt','f4')
    




# =============================================================================
# #    1
# =============================================================================
def xitongtuichu():
    
    pyautogui.click('TdxW    /200.png',duration=1,tween=pyautogui.easeInOutQuad)
    pyautogui.typewrite(['down']*16)
    pyautogui.press(['enter']*2)
    
    
    #                 :
    if pyautogui.locateOnScreen('TdxW    /203       .png'):
        pyautogui.click('TdxW    /203       .png',duration=1,tween=pyautogui.easeInOutQuad)
        






if __name__ == '__main__':
# =============================================================================
# #                           
# =============================================================================
    screenWidth,screenHight=pyautogui.size()
    #  Box  
    REGION=(-screenWidth,-screenHight*2,screenWidth*3,screenHight*3)
    #pyautogui.screenshot('      /eightScreen.png',region=REGION)
    
    tdxWX,tdxWY=0,screenHight-350
    for tdxW in gw.getWindowsWithTitle('       V7.46'):
#        print(tdxW)
    
        tdxW.maximize()
        tdxW.restore()
        tdxW.moveTo(tdxWX,tdxWY)
        tdxWX+=160
        tdxWY+=-100
        
        shujuxiazai()
        shujuxiazai_caiwushuju()
        shujuweihu()
#        xitongtuichu()
        

    
#    for tdxWXT in pyautogui.locateAllOnScreen('TdxW    /200.png',grayscale=True):
#        #pirnt(tdxWXT)
#        
#        shujuxiazai()
#        xitongtuichu()
        
        
        
    # =============================================================================
    # #          :               
    # =============================================================================
    import os,sys,time
    
    sys.path.append('F:\\SpyderXIANGMUWENJIANJIA\\    \\smtplib    ')
    sys.path.append('F:\\SpyderXIANGMUWENJIANJIA\\    \\twilio        ')
    from stmplibSendMsg import sendMsg
    from twilioSendSMS import sendSMS
    
    
    sendTime=time.strftime('%Y/%m/%d',time.localtime(time.time()))
    djs=180
    
    #        
    sendSMS('{}      ,{}        ...'.format(sendTime,djs))
    
    #      
    sendMsg(toAddr='[email protected]',
            msgSub='{}      ,{}        ...'.format(sendTime,djs),
            msgText='')
    
    #CMD      (CMD    :shutdown -a)
    os.system('shutdown -s -t {}'.format(djs)) 
    
    ###############################################################################

좋은 웹페이지 즐겨찾기