python

murata 途中 要改善 pyautoguiを使ったExcelからテキストファイルへの転記

import pyautogui as pg
import time
import pyperclip


x,y=pg.locateCenterOnScreen('./picture_for_gui/yuubinn.png',confidence=0.1) 
for i in range(10):
    
    if i == 0:
        pg.click(1223,1064,duration=0.5)
        pg.moveTo(x,y,duration=1)
        
        pg.press('down') 

        pg.hotkey('ctrl','c')
        
        time.sleep(1)

        pg.click(1305,1045,duration=0.5)

        pg.click()

        time.sleep(1)

        pg.hotkey('return')

        pg.typewrite('yuubinnbangou;\n')

        pg.hotkey('ctrl','v')

        pg.click(1223,1064,duration=0.5)

        pg.press('tab')
        pg.hotkey('ctrl','c')

        pg.click(1305,1045,duration=0.5)

        pg.hotkey('return')

        pg.typewrite('jyuusyo;\n')
        pg.hotkey('ctrl','v')
        
        continue
        


    pg.click(1223,1064,duration=0.5)

    pg.click()
    
    pg.hotkey('ctrl','left')
    
    pg.press('down') 

    pg.hotkey('ctrl','c')

    time.sleep(1)

    pg.click(1305,1045,duration=0.5)

    pg.click()

    time.sleep(1)

    pg.hotkey('return')

    pg.typewrite('yuubinnbangou;\n')

    pg.hotkey('ctrl','v')

    pg.click(1223,1064,duration=0.5)

    pg.press('tab')
    pg.hotkey('ctrl','c')

    pg.click(1305,1045,duration=0.5)

    pg.hotkey('return')

    pg.typewrite('jyuusyo;\n')
    pg.hotkey('ctrl','v')
Was this helpful?