Hi, Was wondering if .....
Prob: There is an interesting bug with some HTPC connected to an AVReceiver using HDMI where the graphics card resets to its default (eg 800 x 600 instead of 1080p) when the AVR is switched to another input and back again. The problem is the HTPC's graphics card detects that the Monitor is "lost".
Background: I got great support from this fourm making a script that would auto change refresh rates for Blu-ray / HD-DVD Playback when PowerDVD started (
http://www.autohotkey.com/forum/viewtop ... highlight= & see code block below) .
Soln: Instead of "#IfWinExist CyberLink PowerDVD" to kick of a action Is it possible to detect either when the monitor is reconnected, a particular resolution, or some other way to auto-reset the graphics properties back to a particular setting using AutoHotKey?
Thanks
Nathan
Code:
========================================================
; JR Media Center 12 TheaterView Integration Script for PowerDVD BluRay / HD-DVD playback
; --------------------------------------------------------
; The following script will detect if PowerDVD starts up
; --------------------------------------------------------
#NoTrayIcon
#Persistent
#SingleInstance, Force
TargetWindow = CyberLink PowerDVD ;- you can change to suit your requirments
Gui,+LastFound
hWnd := WinExist()
DllCall( "RegisterShellHookWindow", UInt,hWnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessages" )
return
ShellMessages( wParam,lParam )
{
;Local k
global
If (wParam = 1)
{
NewID := lParam
WinGetTitle, Title, ahk_id %NewID%
WinGetClass, Class, ahk_id %NewID%
If Title =
{
sleep 2000
WinGetTitle, Title, ahk_id %NewID%
WinGetClass, Class, ahk_id %NewID%
}
If Title = %TargetWindow%
gosub ActionLabel
return 1
}
}
; --------------------------------------------------------
; The following script will run when PowerDVD Starts up and then will close MC12, Set Freq to 24hz and "Hides" the mouse
; --------------------------------------------------------
ActionLabel:
cD = 32 ; bits (quality) - you can change to suit your requirments
sW = 1920 ; pixels - you can change to suit your requirments
sH = 1080 ; pixels - you can change to suit your requirments
rR = 24 ; Hz (frequency) - you can change to suit your requirments
ChangeDisplaySettings( cD, sW, sH, rR )
Run MC12.exe /close
Mousemove 4000,0
return
; --------------------------------------------------------
; The following script will (if PowerDVD is running) Close PowerDVD, Set Freq back to 50hz, Run MC12 when the MCE "Stop" button is pressed
; --------------------------------------------------------
#IfWinExist CyberLink PowerDVD
Media_Stop:: ; This is the STOP button (Media_Stop) - you can change to suit your requirments
WinActivate
WinClose
cD = 32 ; bits (quality) - you can change to suit your requirments
sW = 1920 ; pixels - you can change to suit your requirments
sH = 1080 ; pixels - you can change to suit your requirments
rR = 50 ; Hz (frequency) - you can change to suit your requirments
ChangeDisplaySettings( cD, sW, sH, rR )
Run C:\Program Files\J River\Media Center 12\Media Center 12.exe
return
; --------------------------------------------------------
; The script that makes the DLL Call to change the resolution - Don't Change
; --------------------------------------------------------
ChangeDisplaySettings( cD, sW, sH, rR ) {
VarSetCapacity(dM,156,0), NumPut(156,2,&dM,36)
DllCall( "EnumDisplaySettings", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40)
NumPut(cD,dM,104), NumPut(sW,dM,108), NumPut(sH,dM,112), NumPut(rR,dM,120)
Return DllCall( "ChangeDisplaySettings", UInt,&dM, UInt,0 )
}
; --------------------------------------------------------
; Credit to shimanov and Skan for the ChangeDisplaySetting script - see http://www.autohotkey.com/forum/viewtopic.php?t=8355
; Credit to Conquer for the script to monitor for PowerDVD's startup - see http://www.autohotkey.com/forum/viewtopic.php?t=26429
; --------------------------------------------------------