Created
January 16, 2020 04:17
-
-
Save iwalton3/52ac640bb2249ad6f0f6343eb6194ca8 to your computer and use it in GitHub Desktop.
Raise MPV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Depends on Python 3 and pywin32. | |
# https://www.python.org/downloads/ | |
# pip install pywin32 | |
import win32gui | |
# Mode 5 = Raise to top | |
# Mode 9 = Unminimize and raise to top | |
WINDOW_MODE = 5 | |
def windowEnumerationHandler(hwnd, top_windows): | |
top_windows.append((hwnd, win32gui.GetWindowText(hwnd))) | |
results = [] | |
top_windows = [] | |
win32gui.EnumWindows(windowEnumerationHandler, top_windows) | |
for i in top_windows: | |
if "mpv" in i[1].lower(): | |
win32gui.ShowWindow(i[0],WINDOW_MODE) | |
win32gui.SetForegroundWindow(i[0]) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment