2013-11-06, 22:29
Hi,
I've working on my HTPC via RDP and have been frustrated if I left XBMC in Fullscreen mode after watching in my living room, so I wrote this little AutoHotKey script to edit the guisettings.xml file to change it back to windowed mode if it detects that a remote session is in progress. I am just posting the relevant part of the script, but it could be used as a hotkey or to launch XBMC after the script runs.
-Ken
I've working on my HTPC via RDP and have been frustrated if I left XBMC in Fullscreen mode after watching in my living room, so I wrote this little AutoHotKey script to edit the guisettings.xml file to change it back to windowed mode if it detects that a remote session is in progress. I am just posting the relevant part of the script, but it could be used as a hotkey or to launch XBMC after the script runs.
-Ken
Code:
#SingleInstance, Force
RS = False
fname = guisettings.xml
XBMCDir = %A_AppData%\XBMC\userdata\%fname%
SysGet, SessionRS, 4096 ; Check if it is a remote session
If SessionRS <> 0
RS = True
If RS = True
{
FileRead fcont, %XBMCDir%
StringReplace fnew, fcont, <screenmode>DESKTOP</screenmode>, <screenmode>WINDOW</screenmode>, UseErrorLevel
If ErrorLevel <> 0
{
FileDelete %XBMCDir%
FileAppend %fnew%, %XBMCDir%
}
fnew =
fcont =
}
;Place whatever code you use to launch XBMC here if desired