-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell_lib.py
More file actions
77 lines (64 loc) · 2.28 KB
/
Copy pathshell_lib.py
File metadata and controls
77 lines (64 loc) · 2.28 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
def makeConfig():
import configparser
config_file = configparser.ConfigParser()
config_file.add_section("SteamWindowsShell")
config_file.set("SteamWindowsShell", "ClientDir", "C:/Program Files (x86)/Steam")
config_file.set("SteamWindowsShell", "ClientExe", "steam.exe")
config_file.set("SteamWindowsShell", "ClientExeArg", "-noverifyfiles -gamepadui")
config_file.set("SteamWindowsShell", "waitforpro", "steamwebhelper.exe")
with open(r"SteamWinShellconfig.ini", 'w') as configfileObj:
config_file.write(configfileObj)
configfileObj.flush()
configfileObj.close()
print("Config file 'SteamWinShellconfig.ini' created")
def maincode():
import configparser
import os
import configHelper
import subprocess
import time
import pathlib
import sys
import setshellkey
import processchecklib
import ctypes
explorerexe = "explorer.exe"
setshellkey.SetAsShell(explorerexe)
isSteamWinShellConfigEx = os.path.isfile("SteamWinShellconfig.ini")
if isSteamWinShellConfigEx == False:
makeConfig()
config = configHelper.read_SteamWinShellconfig()
ClientDir = config['SteamWindowsShell']['ClientDir']
ClientExe = config['SteamWindowsShell']['ClientExe']
ClientExeArg = config['SteamWindowsShell']['ClientExeArg']
waitforpro = config['SteamWindowsShell']['waitforpro']
steamfiledir = f"{ClientDir}/{ClientExe}"
isSteamInstall = os.path.isfile(steamfiledir)
maindir = os.path.dirname(os.path.realpath(__file__))
file_extension = pathlib.Path(__file__).suffix
filenamemain = sys.executable
print(filenamemain)
if ClientExeArg == "False":
runcmd = f"start {ClientExe}"
else:
runcmd = f"start {ClientExe} {ClientExeArg}"
endtask = f"taskkill /f /im {ClientExe}"
if isSteamInstall == True:
print(endtask)
print(runcmd)
subprocess.run(endtask)
os.chdir(ClientDir)
os.system(runcmd)
processloop = 0
while (processloop < 1):
if processchecklib.process_check(waitforpro) == True:
processloop = 1
else:
time.sleep(3)
time.sleep(3)
subprocess.run(explorerexe)
time.sleep(5)
setshellkey.SetAsShell(filenamemain)
else:
print("No Launcher")
subprocess.run(explorerexe)