I am 99% sure that there is no affordable way to access the notification area in the tray. The actual focus element is the overflow button, not the tray icon itself, and the Windows Shell team does not want to guarantee that this button will always be focused or even this button will exist in future versions of Windows. Therefore, the API does not have access to it. This is an extremely hacky way to do this, it may stop working at any time - only for personal use (tested on Windows 7):
import win32gui import win32con taskbar = win32gui.FindWindow("Shell_TrayWnd", None) trayArea = win32gui.FindWindowEx(taskbar, None, "TrayNotifyWnd", None) win32gui.SetForegroundWindow(taskbar) win32gui.SendMessage(trayArea, win32con.WM_SETFOCUS, 0, 0)
Once again, do not use it in an application that other people will use . win32gui is part of Win32 Extensions .
You can use RegisterHotKey for a hotkey, but it should be easier for Explorer to handle this - add a link to your Start script and select a hotkey for it.
source share