-
Notifications
You must be signed in to change notification settings - Fork 0
/
league.py
40 lines (31 loc) · 1.08 KB
/
league.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
"""
Handles the detecting and closing of the League client.
Copyright (c) 2023, Giantpizzahead
"""
from . import computer
from . import sikuli
import os
def is_league_running():
"""Returns whether the League client is running."""
return computer.is_process_running("LeagueClientUx.exe")
def close_league():
"""Closes the League client. Assumes that League is running.
Returns:
bool: Whether the League client was closed.
"""
# Try to focus the League window
try:
computer.focus_window("League of Legends")
except Exception as e:
print("Unable to focus the League window... just wait until it opens :)")
return False
# Run the SikuliX script
script_path = os.path.join(os.path.dirname(__file__), "data", "close_league.sikuli")
exit_code = sikuli.run_sikuli_script(script_path)
if exit_code != 0:
print("SikuliX script failed to run... good luck queuing though :)")
return False
return True
def open_league():
"""Opens League (for testing purposes)."""
computer.open_app("League of Legends")