반응형
파이썬 할줄 모르는 사람이 짠 파이썬 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(False, False)
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은 언제 만들지 알수 없는게 함정...
반응형
'QA Engineering > Tool & Automation' 카테고리의 다른 글
파이썬을 이용한 좌표 출력기 v.0.1 (0) | 2023.08.31 |
---|---|
파이썬 스크립트, 젠킨스로 스케줄링 실행 하기 (0) | 2023.08.30 |
Macro Editor -2탄- (0) | 2021.07.13 |
Macro Editor - 1탄 - (0) | 2021.07.13 |
regular expression / regex 정규식 확인 하기 (0) | 2020.08.31 |