-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdsd-html-converter-auditReport
More file actions
92 lines (71 loc) · 2.58 KB
/
dsd-html-converter-auditReport
File metadata and controls
92 lines (71 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 13 15:19:08 2020
감사보고서 DSD를 HTML로 변환하는 코드. XML에 포함된 정보를 분류 정보로 사용함.
@author: user
https://wotres.tistory.com/entry/python-%EC%97%90%EC%84%9C-SyntaxError-unicode-error-unicodeescape-codec-cant-decode-bytes-in-position-2-3-truncated-UXXXXXXXX-escape-%EC%97%90%EB%9F%AC-%ED%95%B4%EA%B2%B0%EB%B2%95
"""
import os
import glob
import pyautogui
import time
import xml.etree.ElementTree as ET
def mouse_click(x, y):
pyautogui.moveTo(x, y)
pyautogui.click()
time.sleep(0.5)
# 1. 작업 폴더로 변경
os.chdir("C:\\Users\\yoont\\Desktop\\업무\\1. 제도\\2. 설계\\11. 중요성과 외부감사실시내용 정보 입수 (21-01)\\1. 감사보고서 입수\\2019\\") # 작업 폴더로 변경
# 2. 타겟 폴더에 있는 필요 문서 경로 리스트업
pathList = glob.glob('**/*.xml')
pathSubfolder = glob.glob('./*/')
pathInfo = []
for path in pathList:
tree = ET.parse(path)
root = tree.getroot()
filer = root.find("CIK").get("registrant")
amend = root.find("REPORT").get("submit_type")
info = path.split('\\')[0] + '_' + filer + '_' + amend
pathInfo.append(info)
resultPath = "C:\\Users\\yoont\\Desktop\\result\\"
pathSubfolderCount = len(pathSubfolder)
for subFolder in range(pathSubfolderCount):
folderList = os.listdir(pathSubfolder[subFolder])
pairs = []
for file in folderList:
location = os.path.join(pathSubfolder[subFolder], file)
size = os.path.getsize(location)
pairs.append((size, file))
pairs.sort(key=lambda s: s[0])
path = pathSubfolder[subFolder] + pairs[len(pairs)-1][1]
os.startfile(path)
time.sleep(5)
mouse_click(1690, 890)
# break
# pyautogui.press('esc', presses=3)
# time.sleep(1)
pyautogui.press('n')
time.sleep(1)
pyautogui.press('o')
time.sleep(1)
mouse_click(700, 20)
pyautogui.press('c')
time.sleep(1)
pyautogui.press('alt')
time.sleep(1)
pyautogui.press('hangul')
time.sleep(1)
pyautogui.press('f')
time.sleep(1)
pyautogui.press('h')
time.sleep(1)
# mouse_click(50, 50) # 파일
# mouse_click(200, 600) # HTML로 저장 선택식
pyautogui.write(pathInfo[subFolder])
mouse_click(1270, 270) # PATH 선택
pyautogui.write(resultPath) # 지정된 경로 입력
pyautogui.press('enter') # Enter키 입력
mouse_click(1560, 1060) # 저장 버튼
# mouse_click(2510, 15) # 다트 편집기 종료
mouse_click(50, 50)
pyautogui.press('x')