I use the following script, but unfortunately it doesn't lead to the desired outcome:
#If WinExist("ahk_exe Microsoft.Media.Player.exe")
Send ^m
#Requires AutoHotkey v2.0
Persistent
SetTimer MediaPlayer_MiniMode, 500
MediaPlayer_MiniMode()
{
if not WinExist("ahk_exe Microsoft.Media.Player.exe")
return ; do nothing
; Otherwise:
SetTimer , 0 ; i.e. the timer turns itself off here.
WinActivate "ahk_exe Microsoft.Media.Player.exe"
If WinWaitActive("ahk_exe Microsoft.Media.Player.exe", , 5)
Send "^m"
WinWaitClose "ahk_exe Microsoft.Media.Player.exe"
SetTimer , 500 ; turns the timer on
}
For AHK v1 see here.