-
Notifications
You must be signed in to change notification settings - Fork 3
/
startup.py
49 lines (34 loc) · 1.22 KB
/
startup.py
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 json
if not os.path.exists("./lang/lang.txt"):
input("Can't find lang.txt file. You have to run config.py(config.exe) to config.\nPress enter to exit...")
exit()
else:
with open("./lang/lang.txt", "r", encoding="utf-8") as f:
lang = f.read()
message = {}
with open(f'./lang/{lang}.json', "r", encoding="utf-8") as f:
message = json.load(f)
if os.name != "nt":
input(message["win_only"])
exit()
import win32com.client
def create_short_cut(path, sc_file_name, icon=None):
if icon is None:
icon = path
shell = win32com.client.Dispatch("WScript.shell")
sh_cut = shell.CreateShortcut(
os.path.join(f"C:/Users/{os.getlogin()}/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup",
f"{sc_file_name}.lnk"))
sh_cut.TargetPath = path
sh_cut.WindowStyle = 1
sh_cut.IconLocation = icon
sh_cut.WorkingDirectory = f"C:/Users/{os.getlogin()}/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
sh_cut.Save()
try:
input(message["confirm_startup"])
except:
print(message["canceled"])
exit()
create_short_cut(f"{os.getcwd()}/start.exe", "GameConsoleActivitytoDiscord")
input(message["startup_done"])