-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.pyw
More file actions
68 lines (40 loc) · 1.59 KB
/
main.pyw
File metadata and controls
68 lines (40 loc) · 1.59 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
import json
import time
import subprocess
config_path = r"C:\Program Files\Vertigo Arcades\Haze\Haze\config.txt"
def ChangeLoc():
# Terminate the running application by name
subprocess.run(['taskkill', '/IM', 'Haze.exe', '/F'], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
try:
#find config file and load Json
with open(config_path, "r", encoding="utf-8") as file:
txt = json.loads(file.read())
#logic to find which is the Current Play-Spaces Machines in it
loc = -1
other = -1
if len(txt['PlaySpaces'][1]["machineGuids"]) > 0:
loc = 1
other = 0
elif len(txt['PlaySpaces'][0]["machineGuids"]) > 0:
loc = 0
other = 1
array = txt['PlaySpaces'][loc]["machineGuids"]
array2 = txt['PlaySpaces'][loc]["sessions"][0]["participants"]
#Swapping MachineGuids array
txt["PlaySpaces"][other]["machineGuids"] = array
txt["PlaySpaces"][loc]["machineGuids"] = []
#Swapping Participants array
txt["PlaySpaces"][other]["sessions"][0]["participants"] = array2
txt["PlaySpaces"][loc]["sessions"][0]["participants"] = []
#write Json file
with open(config_path, "w", encoding="utf-8") as file:
file.write(json.dumps(txt, indent=4))
except:
pass
# Wait for a few seconds and open file
try:
time.sleep(2)
subprocess.Popen(['C:\\Program Files\\Vertigo Arcades\\Haze\\Haze\\Haze.exe'])
except:
pass
ChangeLoc()