QA Engineering/Tool & Automation

Macro Editor -3탄-

일해라폴폴 2021. 7. 13. 18:30
반응형

파이썬 할줄 모르는 사람이 짠 파이썬 FULL 코드

import glob
import os
import tkinter.messagebox
from tkinter import *
import logging
logging.basicConfig(level=logging.INFO)
 
window = Tk()
window.title('Log Mask Creator v.1.0')
window.geometry('300x200+100+100')
window.resizable(FalseFalse)
 
def createSendln():
    try:
        exec(open(addLine()).read())
        tkinter.messagebox.showinfo('Create Result''Success :D \n')
    except:
        return exec
 
def addLine():
    for i in (0,1):
 
        def scriptSavor(i):
                f = open(r'script.txt', encoding='UTF8')
                lines = f.readlines()
 
                for line in lines:
                    line = line.strip()    # print for each lines
                    addline = 'sendln \''+line+'\''+'\n'+'pause 2'+'\n'   # added 'sendln '' + pause2
                    logging.info('Log: sendln added')
 
                    print(addline)      #checked whole lines after adding
                    logging.info('Log: ... ing ...')
                f.close()
                logging.info('Log: The result print was done')
 
        sys.stdout = open('script_new.ttl''w', encoding='UTF8')    #new file create function
        for i in range(0,1):
            scriptSavor(i)
 
    logging.info('Log: completed of the *.ttl file')
    tkinter.messagebox.showinfo('Create Result''Success :D \n')
 
def exitBox():
    tkinter.messagebox.showinfo('Thank you''Do you want exit? \n')
    window.destroy()
 
label1 = Label(window, text=' ')
label1.grid(row=0, column=0)
 
label1 = Label(window, text='Should have file \n "script.txt" ')
label1.grid(row=1, column=0)
 
label1 = Label(window, text='   ')
label1.grid(row=2, column=1)
 
btn1 = Button(window, text='Add a Sendline', command=createSendln) #createSendln
btn1.grid(row=3, column=1, sticky=W+E+N+S) # button size makes resizing via sticky
 
btn9 = Button(window, text='EXIT', command=exitBox)
btn9.grid(row=9, column=1, sticky=W+E+N+S)
 
window.mainloop()
cs

v.2.0은 언제 만들지 알수 없는게 함정...

executionFile.py.zip
0.00MB

반응형