COMPATIBILITY: AutoHotkey 1.0.48.05 (AHK Basic)
As the title says. This has been a longstanding annoying issue for me.
Having a dual-view setup (2 x 15" CRT monitors) and watching a fullscreen movie on my second monitor, the primary one was always staring at me, almost screaming: "I'm useless, shut me down!" But couldn't do that since at times I needed to pause video and run some app (subtitle sync, etc).
I thought about sending a blank message to that monitor, but it wouldn't work; both monitors would blank out at the same time. So yesterday I finally gathered my guts and put up this ugly but working code. What it does is simple: detect the monitor with fullscreen video and blank the other one by showing a fullscreen black GUI.
It will immediately disable the blank when the player is not in fullscreen anymore or is not the active window (say, we clicked the blank screen).
The script was initially created for GOMPlayer but later on I put the relevant info into variables so they can easily be changed to the player of your choice. I believe it can even work for fullscreen games, but I haven't tested under those circumstances.
Please test the script and provide feedback. Enjoy!
Code:
PClass = ahk_class GomPlayer1.x ; replace with your player's class
PText = GomVideo ; replace with your player window's text
; *****************************************
Gui, -0xC00000 +0x8000000
Gui, Color, Black
start:
WinWaitActive, %PClass%, %PText%
Gui, +AlwaysOnTop
WinGetPos, plX, plY, plW, plH, %PClass%,,,
SysGet, mon, 80 ; get monitor count
Loop, %mon%
{
SysGet, scr%A_Index%, Monitor, %A_Index%
coordX := scr%A_Index%Left - plX
coordY := scr%A_Index%Top - plY
coordW := plX + plW - scr%A_Index%Right
coordH := plH - plY - scr%A_Index%Bottom
if (coordX = coordY = coordW = coordH) && coordX >= 0
{
Loop, %mon%
{
scL := scr%A_Index%Left
scW := scr%A_Index%Right - scr%A_Index%Left
scH := scr%A_Index%Bottom - scr%A_Index%Top
if scL - plX < 0
Gui, Show, x%scL% y0 w%scW% h%scH%
}
break
}
}
WinActivate, %PClass%
Sleep, 1
WinWaitNotActive, %PClass%, %PText%
Gui, -AlwaysOnTop
Gui, Hide
goto start
P.S. I know that
start: <-> goto start can be replaced with a loop, thus offering the possibility to exit the script through a hotkey, but I didn't fiddle much with the script once I got it working, especially being ill at the moment. However, any improvement ideas are welcome.
P.P.S. It's only been tested under Win98SE since I got no other multi-monitor environment at hand. I'd love to hear from Win2000/XP/Vista/7 users.