Repository navigation
Expand file tree
/
Copy pathfront.pyw
More file actions
73 lines (59 loc) · 2.62 KB
/
Copy pathfront.pyw
File metadata and controls
73 lines (59 loc) · 2.62 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
import tkinter as tk
from tkinter import filedialog, messagebox
import subprocess
def RotatePDF():
# ask for a single file using the file dialog
file_path = filedialog.askopenfilename()
# Check if a file was selected
if file_path:
# Start the executable with the file path as the first argument
try:
result = subprocess.run(["./back","-R", file_path])
except Exception as e:
result = subprocess.run(["./back.exe","-R", file_path])
if result.returncode != 0:
# Open tkinter and display an error message
tk.messagebox.showinfo("Error", "This File Contains an encrypted PDF or no PDFs")
def CombinePDF():
# Ask for a folder using the file dialog
folder_path = filedialog.askdirectory()
# Check if a folder was selected
if folder_path:
result = subprocess.CompletedProcess.returncode = 9
# Start the executable with the folder path as the first argument
try:
result = subprocess.run(["./back", folder_path])
except Exception as e:
try:
result = subprocess.run(["./back.exe", folder_path])
except Exception as e:
pass
if result.returncode != 0:
# Open tkinter and display an error message
tk.messagebox.showinfo("Error", "This Folder Contains an encrypted PDF or no PDFs")
def RotateAndCombine():
folder_path = filedialog.askdirectory()
# Check if a folder was selected
if folder_path:
result = subprocess.CompletedProcess.returncode = 9
# Start the executable with the folder path as the first argument
try:
result = subprocess.run(["./back", "-CR", folder_path])
except Exception as e:
try:
result = subprocess.run(["./back.exe", "-CR", folder_path])
except Exception as e:
pass
if result.returncode != 0:
# Open tkinter and display an error message
tk.messagebox.showinfo("Error", "This Folder Contains an encrypted PDF or no PDFs")
# Create the Tkinter root window
root = tk.Tk()
frm = tk.Frame(root)
frm.grid()
tk.Button(frm, text="Click here to combine PDFs", command=CombinePDF).grid(row=1, column=0)
tk.Button(frm, text="Click here to rotate PDF", command=RotatePDF).grid(row=2, column=0)
tk.Button(frm, text="Click here to rotate and combine PDFs", command=RotateAndCombine).grid(row=3, column=0)
tk.Button(frm, text="Click here to exit", command=root.destroy).grid(row=4, column=0)
tk.mainloop() # Start the Tkinter event loop
root.destroy() # Close the Tkinter window