-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
32 lines (25 loc) · 840 Bytes
/
Copy pathrun.py
File metadata and controls
32 lines (25 loc) · 840 Bytes
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
import os
import subprocess
import sys
from pathlib import Path
from ahkunwrapped import Script
def run():
script_path = os.path.join(Path(__file__).resolve().parent, 'main.py')
yaml_path = Path(sys.argv[1])
os.chdir(yaml_path.parent)
try:
script = subprocess.run([sys.executable, script_path] + [str(yaml_path)], stdout=subprocess.PIPE, check=True, encoding='utf-8', text=True)
print(script.stdout)
restart_rw()
except subprocess.CalledProcessError as e:
exit(e.returncode)
def restart_rw():
Script("""
AutoExec() {
WinClose, ahk_exe RimWorldWin64.exe
WinWaitClose,
Run, C:\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64.exe
}
""")
if __name__ == '__main__':
run()