I don’t know exactly how to explain this. Alienware command center sits in the application folder, the secure folder in Windows that has massive restrictions to it. That’s where the shortcut sits. It is part of Windows 11 start menu interface. The shortcuts in the applications folder don’t directly point to an executable. You can’t even change the target path in the properties of the shortcut.
The Alienware command center sits running in the background. When you double click on the shortcut to launch Alienware command center it just moves it from the background to the foreground. Alienware command center also has services that have to be loaded for the program to run.
What I’ve done with my code is set it up to launch Alienware command center when my computer starts. I’ve had complications with executing awcc.exe from python. I was forced to use the shortcut from the windows 11 start menu with os.startfile instead of using os.startfile to load the awcc.exe file.
I have no idea what Alienware command center is doing in the background but for some reason launching the executable itself sometimes doesn’t work but the shortcut works every single time.
from datetime import datetime
from os import startfile
from time import sleep
from typing import Optional
from psutil import Process
from pyvda import AppView, VirtualDesktop
from win32con import HWND_TOP
from win32gui import GetWindowRect, SetWindowPos
from dependencies import get_object, LoadingWindow, Monitor
Monitor = Monitor()
class AlienwareCommandCenter:
def __init__(self):
self._awcc: Optional[AppView] = self()
def __call__(self) -> Optional[AppView]:
try:
getattr(self._awcc, 'hwnd')
except: # noqa
self._awcc = None
while self._awcc is None:
if 'timestamp' not in locals() or datetime.now().timestamp() >= timestamp: # noqa
timestamp = datetime.now().timestamp() + 1
startfile(r'dependencies\AlienwareCommandCenter.lnk')
self._awcc = get_object(object_name = 'Alienware Command Center', object_type = AppView, current_desktop = False)
sleep(1)
sleep(1)
return self._awcc
# window = LoadingWindow()
# window.read(timeout = 60000)
# window.close()
# exit()
def main():
window: LoadingWindow | None = None
if get_object(object_name = 'AWCC.Service.exe', parent_name = 'services.exe', object_type = Process) is None:
window = LoadingWindow()
while (get_object(object_name = 'AWCC.Service.exe', parent_name = 'services.exe', object_type = Process) is None or
get_object(object_name = 'AWCC.Background.Server.exe', parent_name = 'AWCC.Service.exe', object_type = Process) is None or
get_object(object_name = 'OCControl.Service.exe', parent_name = 'AWCC.Service.exe', object_type = Process) is None or
get_object(object_name = 'AWCC.exe', parent_name = 'svchost.exe', object_type = Process) is None):
window.read(timeout = 1000)
sleep(10)
if window is not None:
window.close()
awcc = AlienwareCommandCenter()
Desktop: Optional[VirtualDesktop] = get_object(object_name = 'Alienware Command Center', parent_name = 'svchost.exe', object_type = VirtualDesktop)
if Desktop is not None and VirtualDesktop.current().id != Desktop.id:
Desktop.go()
if awcc() is not None and Desktop is not None:
if awcc().desktop.name != Desktop.name:
awcc().move(Desktop)
if 3840 in Monitor:
if GetWindowRect(awcc().hwnd) != (530, 20, 3310, 1580):
SetWindowPos(awcc().hwnd, HWND_TOP, 530, 20, 2780, 1560, 0)
else:
if 1080 not in Monitor.WorkingArea:
SetWindowPos(awcc().hwnd, HWND_TOP, int((Monitor.WorkingArea.Width - 1745) / 2), 10, 1745, Monitor.WorkingArea.Height - 20, 0)
else:
SetWindowPos(awcc().hwnd, HWND_TOP, 10, 10, Monitor.Width - 20, Monitor.Height - 20, 0)
if __name__ == '__main__':
main()