-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
59 lines (39 loc) · 1.38 KB
/
Copy pathmain.py
File metadata and controls
59 lines (39 loc) · 1.38 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
import os
from tkinter import filedialog
from tkinter import *
from ppt import Ex
from pdf import PDF
root = Tk()
root.title = 'Merger'
root.geometry('200x200')
root.withdraw()
def search_for_file_path():
currdir = os.getcwd()
tempdir = filedialog.askdirectory(parent=root, initialdir=currdir, title='Please select a directory')
if len(tempdir) > 0:
print("You chose: %s" % tempdir)
return tempdir
file_path_variable = search_for_file_path()
print("\nfile_path_variable = ", file_path_variable)
# finds path of files
# making an output directory for pdf merged
output_merge = file_path_variable + '/output_merged'
if not os.path.exists(output_merge):
os.mkdir(output_merge)
for subdir, dirs, files in os.walk(file_path_variable):
for filename in files:
filepath = subdir + os.sep + filename
print(filepath)
ppt = Ex()
if filepath.endswith(".ppt"):
folder = filepath.replace('/', '\\')
ppt.ppt_convert(folder)
if filepath.endswith(".pptx"):
folder = filepath.replace('/', '\\')
ppt.ppt_convert(folder)
if filepath.endswith(".pptm"):
folder = filepath.replace('/', '\\')
ppt.ppt_convert(folder)
pdf = PDF()
pdf.p(file_path_variable, output_merge.replace('/', '\\'))
root.mainloop()