Hi capellan2000,
I made a few small adjustments to the code, and tested it on a multimonitor setup and it seems to be working for me....
(and hopefully if you use the keys 'a' and 'z' to adjust the bar height then these should be stored as separate values for each monitor ....as the 2nd montior isn't always the same resolution as the first)
Let me know if it works for you
thanks
Blocker_check:= 0
Mon1:= 41 ; size of bar (on primary monitor), adjust if required (seems to be larger in firefox than ie!!!)
Mon2:= 41 ; size of bar if secondary monitor used
Sysget, MonNum, MonitorCount
; check status every 1 second (timer needs to be at top of script)
#Persistent
SetTimer, YT_autohide, 1000
return
; check if in flash full screen mode
#IfWinActive ahk_class ShockwaveFlashFullScreen
YT_autohide:
; hide if idle for 5 seconds....
if ( ((a_timeidle > 5000 and Blocker_check = 0) or KeepHid = 1) and (WinExist("YouTube") or WinExist("Leave Alluc")) and WinActive("ahk_class ShockwaveFlashFullScreen"))
{
WinGetPos, Xp, Yp, Wp,Hp , A
if((MonNum > 1) and (Xp > 0) ) ;if theres more than one monitor, and the active window is on the 2nd then...
{
YT1:= Mon2
}else{
YT1:= Mon1
}
YT2:= Hp - YT1
MouseGetPos,, ypos
if (ypos < YT2) ;don't hide if mouse over control bar
{
Progress,B CW000000 ZH0 W%Wp% H%YT1% Y%YT2% X%Xp%
Blocker_check = 1
SystemCursor("off")
}
if (a_timeidle < 5000)
{
KeepHid = 0
}
}else if( a_timeidle < 1000 and Blocker_check = 1 and (WinExist("YouTube") or WinExist("Leave Alluc")) and WinActive("ahk_class ShockwaveFlashFullScreen"))
{
Progress, off
Blocker_check = 0
SystemCursor("on")
}else if( Blocker_check = 1 and WinActive("ahk_class ShockwaveFlashFullScreen") = 0) ; if something steels focus restore everything...
{
Progress, off
Blocker_check = 0
SystemCursor("on")
}
return
Esc::
Progress, Off
Blocker_check = 0
SystemCursor("on")
Send, {Esc}
return
; 'a' and 'z' adjust the height of the bar...
a::
if((MonNum > 1) and (Xp > 0) )
{
Mon2:= Mon2 + 1
YT1:= Mon2
}else{
Mon1:= Mon1 + 1
YT1:= Mon1
}
KeepHid = 1
WinGetPos, X, Y, Wx,Hx , A
YT2:= Hx - YT1
Progress,B CW000030 ZH0 W%Wp% H%YT1% Y%YT2% X%Xp%
return
z::
if((MonNum > 1) and (Xp > 0) )
{
Mon2:= Mon2 - 1
YT1:= Mon2
}else{
Mon1:= Mon1 - 1
YT1:= Mon1
}
KeepHid = 1
WinGetPos, X, Y, Wx,Hx , A
YT2:= Hx - YT1
Progress,B CW000030 ZH0 W%Wp% H%YT1% Y%YT2% X%Xp%
return
; the following send the keyboard shortcuts used in flash v10, without effecting the autohide
left::
if (Blocker_check = 1)
{
Send, {left}
KeepHid = 1
Progress,B CW000000 ZH0 W%Wp% H%YT1% Y%YT2% X%Xp%
}else
Send, {left}
return
right::
if (Blocker_check = 1)
{
Send, {right}
KeepHid = 1
Progress,B CW000000 ZH0 W%Wp% H%YT1% Y%YT2% X%Xp%
}else
Send, {right}
return
up::
if (Blocker_check = 1)
{
Send, {up}
KeepHid = 1
Progress,B CW000000 ZH0 W%Wp% H%YT1% Y%YT2% X%Xp%
}else
Send, {up}
return
down::
if (Blocker_check = 1)
{
Send, {down}
KeepHid = 1
Progress,B CW000000 ZH0 W%Wp% H%YT1% Y%YT2% X%Xp%
}else
Send, {down}
return
Space::
if (Blocker_check = 1)
{
Send, {Space}
KeepHid = 1
Progress,B CW000000 ZH0 W%Wp% H%YT1% Y%YT2% X%Xp%
}else
Send, {Space}
return
;---the following code hides the mouse cursor... taken from the autohotkey help file, via http://www.autohotkey.com/forum/topic6107.html
;SystemCursor("Toggle") ; Win+C hotkey to toggle the cursor on and off.
SystemCursor(OnOff=1) ; INIT = "I","Init"; OFF = 0,"Off"; TOGGLE = -1,"T","Toggle"; ON = others
{
static AndMask, XorMask, $, h_cursor
,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 ; system cursors
, b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13 ; blank cursors
, h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13 ; handles of default cursors
if (OnOff = "Init" or OnOff = "I" or $ = "") ; init when requested or at first call
{
$ = h ; active default cursors
VarSetCapacity( h_cursor,4444, 1 )
VarSetCapacity( AndMask, 32*4, 0xFF )
VarSetCapacity( XorMask, 32*4, 0 )
system_cursors = 32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650
StringSplit c, system_cursors, `,
Loop %c0%
{
h_cursor := DllCall( "LoadCursor", "uint",0, "uint",c%A_Index% )
h%A_Index% := DllCall( "CopyImage", "uint",h_cursor, "uint",2, "int",0, "int",0, "uint",0 )
b%A_Index% := DllCall("CreateCursor","uint",0, "int",0, "int",0
, "int",32, "int",32, "uint",&AndMask, "uint",&XorMask )
}
}
if (OnOff = 0 or OnOff = "Off" or $ = "h" and (OnOff < 0 or OnOff = "Toggle" or OnOff = "T"))
$ = b ; use blank cursors
else
$ = h ; use the saved cursors
Loop %c0%
{
h_cursor := DllCall( "CopyImage", "uint",%$%%A_Index%, "uint",2, "int",0, "int",0, "uint",0 )
DllCall( "SetSystemCursor", "uint",h_cursor, "uint",c%A_Index% )
}
}