 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
channelog
Joined: 17 Sep 2007 Posts: 7
|
Posted: Mon Sep 17, 2007 10:40 pm Post subject: Fade in/out taskbar |
|
|
Hi there
I'm new to this programming thing, so this may be a very complicated method of doing this.
How to use the extra real estate though? And I find there's a problem with
the start menu for me, If I open it and close it again a stripe appears on the left of the taskbar. This for you?
| Code: |
; Fading in and out taskbar, to work on any screen resolution
;
; G.
;
WinGetPos,,, maxX, maxY, Program Manager,
CoordMode, Mouse, Screen
Setformat, Float, 0.0
FadeUnit := maxY/256 ; we devide the max y into 250 units - the fade in/out increments
Startpoint := MaxY/8
Endpoint := MaxY/32
fdregionmin := MaxY - Startpoint ; our fade starts here
fdregionmax := MaxY - Endpoint ; and ends at this point
transincrement := (255/ ((Startpoint - Endpoint)/ fadeunit)) ; the transparency increment relative to the fade unit
transp := 0
WinSet, Transparent, %transp%, ahk_class Shell_TrayWnd ;start off tranparent
#Persistent
SetTimer, Transchecker, 20
return
Transchecker:
MouseGetPos, MouseX, MouseY,
If (MouseY <= fdregionmin) ; If it's above our fade line, we keep it transparent
{
transp := 0
GoSub, update
return
}
else if (MouseY >= fdregionmax) ; If the mouse is below, we keep it solid
{
transp := 255
Gosub, update
return
}
else ; if it's neither, it's in our fade region
{
ChkRel := fdregionmin
testvar := fdregionmin
MultiplicationUnit := 1
loop, 24
{
testvar := ChkRel + FadeUnit
if (MouseY >= ChkRel) and (MouseY <= testvar) ; check in which increment the mouse is at
{
transp := transincrement*MultiplicationUnit
if transp > 255
{
transp := 255
return
}
GoSub update
break
}
else
{
ChkRel := ChkRel + FadeUnit
MultiplicationUnit := MultiplicationUnit + 1 ; we need this to determine the relative fade increment
}
}
}
return
update:
WinSet, Transparent, %transp%, ahk_class Shell_TrayWnd
return
| (alt+c)
be interested in your comments, and the easier ways of doing it |
|
| Back to top |
|
 |
AHKPNH
Joined: 17 Feb 2006 Posts: 35
|
Posted: Tue Sep 18, 2007 10:45 am Post subject: |
|
|
very good  |
|
| Back to top |
|
 |
BoBoĻ Guest
|
Posted: Tue Sep 18, 2007 10:58 am Post subject: |
|
|
Three AHK commands/variables migth be of interest for you.
OnMessage
A_ScreenWidth/A_ScreenHight
SysGet
Get things goin  |
|
| Back to top |
|
 |
crxvfr
Joined: 10 Mar 2006 Posts: 55
|
Posted: Tue Sep 18, 2007 8:46 pm Post subject: |
|
|
Very Cool!
The autohide taskbar often misbehaves. This is a perfect and cool solution. |
|
| Back to top |
|
 |
channelog
Joined: 17 Sep 2007 Posts: 7
|
Posted: Tue Sep 18, 2007 9:16 pm Post subject: |
|
|
Thanks bobo,
Here's a reworked and simplified version, seperating the rate of fade from the mouse:
| Code: | ;
; Tweakable fading taskbar
;
; G.
;
CoordMode, Mouse, Screen
Twk = 190 ; tweak
Twks = 25 ; these
trans := 0
Winset, Transparent, %trans%, ahk_class Shell_TrayWnd
Loop,
{
MouseGetPos, MsX, MsY,
;WinGetPos,,TBarY,,,ahk_class Shell_TrayWnd
Deficit := A_ScreenHeight - Twk ;TBarY - Twk
If (MsY < Deficit) and (trans = 0)
{
sleep, 30 ; this to give the comp less work
continue
}
else if (MsY > Deficit) and (trans = 255)
{
sleep, 30
continue
}
else if (MsY > Deficit) and (trans <> 255)
{
unit := 5
GoSub ChngTrans
}
else if (MsY < Deficit) and (trans <> 0)
{
unit := -5
GoSub ChngTrans
}
}
ChngTrans:
trans := trans + unit
sleep, %Twks%
Winset, Transparent, %Trans%, ahk_class Shell_TrayWnd
return
|
|
|
| Back to top |
|
 |
channelog
Joined: 17 Sep 2007 Posts: 7
|
Posted: Wed Sep 19, 2007 9:38 am Post subject: AAAAAAAAAARGH |
|
|
Is there ANY way around the redrawing problems with the start menu???
I think this whole thing is against how windows functions. It feels wrong. |
|
| Back to top |
|
 |
Conquer
Joined: 27 Jun 2006 Posts: 383 Location: Canada
|
Posted: Sun Jun 29, 2008 10:06 pm Post subject: |
|
|
| Quote: | | How to use the extra real estate though? |
I know this is kind of a grave dig, but..
channelog: Great script, thanks for sharing.
this is my version of the script: (Allows you to use the extra 'real estate' )
| Code: | #SingleInstance,Force
#NoTrayIcon
#NoEnv
OnExit,ExitSub
;
; Tweakable fading taskbar
;
CoordMode, Mouse, Screen
Twk = 03 ; Area of the taskbar (If mouse goes inside this height the taskbar will fade in)
Twk2 = 35 ; Area of taskbar (until fading out) after it's already visible (should be larger than above)
Twks = 25 ; Speed of animating (higher number = smoother fading but more cpu resources used, & vice versa)
WinSet, AlwaysOnTop, On, ahk_class Shell_TrayWnd
FadeInSpeed = 50 ;Speed to use when showing the taskbar (Mouse in range of taskbar)
FadeOutSpeed = -20 ;(Must be negative) speed for hiding the taskbar (Mouse away from range)
trans := 0
Winset, Transparent, %trans%, ahk_class Shell_TrayWnd
Loop,
{
MouseGetPos, MsX, MsY
Deficit := A_ScreenHeight - Twk ;TBarY - Twk
Deficit2 := A_ScreenHeight - Twk2
If (MsY < Deficit2) and (trans = 0)
{
sleep, 30
continue
}
else if (MsY > Deficit) and (trans = 255)
{
sleep, 30
continue
}
else if (MsY > Deficit) and (trans <> 255)
{
unit := FadeInSpeed
GoSub ChngTrans
}
else if (MsY < Deficit2) and (trans <> 0)
{
unit := FadeOutSpeed
GoSub ChngTrans
}
}
ChngTrans:
if trans < 5
WinSet, AlwaysOnTop, Off, ahk_class Shell_TrayWnd
If trans > 4
WinSet, AlwaysOnTop, On, ahk_class Shell_TrayWnd
trans := trans + unit
if trans > 255
trans = 255
if trans < 0
trans = 0
sleep, %Twks%
Winset, Transparent, %Trans%, ahk_class Shell_TrayWnd
return
ExitSub:
Trans = 255
Winset, Transparent, %Trans%, ahk_class Shell_TrayWnd
ExitApp
return |
In order to use it you must first change your taskbar's settings (Right click>Properties) and uncheck "Keep the taskbar on top of other windows.
This allows you to have the whole screen as a work area when the taskbar is hidden, just like Windows's AutoHide, but with a nice transparent fading in/out effect, and it seems a lot more reliable than the built in AutoHide feature.
Also, you can now tweak both the "Fade In" area's range, and the "Fade Out" area's range.
| Quote: | | Is there ANY way around the redrawing problems with the start menu??? |
I know what line you're talking about now, and I don't find it much of a problem. I don't see why you'd be opening and closing the start menu like that, and even if you did; the line gets erased when the taskbar fades out then back in.
Any who, I found if you lock your taskbar, the line will not appear.
Edit: It seems since this post I've noticed sometimes the script fails to pickup the mouse getting close to the taskbar. Not sure how it happens or what causes it. Seems to behave just like good old Windows's AutoHide ( )
- Changed around a couple of lines and it seems to behave (slightly) better now. Not sure why the lines I moved helped it though.
- Turns out that last update was only helping temporarily. I don't think theres any way to get it to seamlessly show (I experience problems with other AlwaysOnTop windows with the last update) and I also experience problems with maximized windows rarely. I rolled back the script and changed a couple lines again. I don't think I can improve it's random reliability. _________________
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|