AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Fade in/out taskbar
Goto page 1, 2  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
channelog



Joined: 17 Sep 2007
Posts: 7

PostPosted: Mon Sep 17, 2007 9:40 pm    Post subject: Fade in/out taskbar Reply with quote

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
View user's profile Send private message
AHKPNH



Joined: 17 Feb 2006
Posts: 37

PostPosted: Tue Sep 18, 2007 9:45 am    Post subject: Reply with quote

very good Very Happy
Back to top
View user's profile Send private message
BoBoĻ
Guest





PostPosted: Tue Sep 18, 2007 9:58 am    Post subject: Reply with quote

Three AHK commands/variables migth be of interest for you.
OnMessage
A_ScreenWidth/A_ScreenHight
SysGet


Get things goin Wink
Back to top
crxvfr



Joined: 10 Mar 2006
Posts: 89

PostPosted: Tue Sep 18, 2007 7:46 pm    Post subject: Reply with quote

Very Cool!
The autohide taskbar often misbehaves. This is a perfect and cool solution.
Back to top
View user's profile Send private message
channelog



Joined: 17 Sep 2007
Posts: 7

PostPosted: Tue Sep 18, 2007 8:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
channelog



Joined: 17 Sep 2007
Posts: 7

PostPosted: Wed Sep 19, 2007 8:38 am    Post subject: AAAAAAAAAARGH Reply with quote

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
View user's profile Send private message
Conquer



Joined: 27 Jun 2006
Posts: 385
Location: Canada

PostPosted: Sun Jun 29, 2008 9:06 pm    Post subject: Reply with quote

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' Wink)

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.

Cool


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. Very Happy



Cool




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 (Sad)
- 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
View user's profile Send private message
sealight
Guest





PostPosted: Sat Dec 06, 2008 1:16 pm    Post subject: Reply with quote

This script is great but on vista the start menu logo (the circle) is always displayed, even when the taskbar is not visible!
Can we fix this behaviour?
Back to top
codybear



Joined: 15 Sep 2009
Posts: 560

PostPosted: Thu Apr 07, 2011 3:49 am    Post subject: Reply with quote

First off, let me apologize for bringing up an old thread, but I was trying to find this script again (I forgot to backup my AHK Script folder when I installed Linux and I just reinstalled Windows to use necessary programs for college that wouldn't run under wine properly and I don't have enough ram to run a virtual machine properly).

Since I have Win7 now I had to modify this script this script to fade the start button with the taskbar (just added the two winset lines for the dv2 control host for the start button).
Since someone else asked for a win7 version, here it is:

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
WinSet, Transparent, %transp%, ahk_class DV2Control_Host

#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
  WinSet, Transparent, %transp%, ahk_class DV2Control_Host
return


Edit: Forgot to add that there is another script somewhere that in my usage didn't fade in and out as smoothly as this one, but it maximized the screen real estate. But I personally need the bottom edge saved for some rainmeter data but still like some of the win7 taskbar functionality (hence not disabling all together).
_________________
Disclaimer: I'm not an expert by any means; I just try to help out where I can.
Back to top
View user's profile Send private message
bruno



Joined: 07 Mar 2011
Posts: 151

PostPosted: Thu Apr 07, 2011 6:42 am    Post subject: Reply with quote

Thanks for reviving this hidden gem!? This COULD be useful to hide all the clutter at the bottom of the screen, which may be distracting at times. Laughing PS: After 5 minutes of use, it promptly froze my XP! Rolling Eyes ... And there is no way to quite this thing! Shocked
Code:
; http://www.autohotkey.com/forum/topic23306.html&sid=18f9fc4abb030b400aa992dd20fbd7cb
; Fade in/out taskbar
; Fade Taskbar

#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 - Tw ; 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
Back to top
View user's profile Send private message
codybear



Joined: 15 Sep 2009
Posts: 560

PostPosted: Thu Apr 07, 2011 7:30 am    Post subject: Reply with quote

bruno wrote:
Thanks for reviving this hidden gem!? This COULD be useful to hide all the clutter at the bottom of the screen, which may be distracting at times. Laughing PS: After 5 minutes of use, it promptly froze my XP! Rolling Eyes ... And there is no way to quite this thing! Shocked

lol, no problem with reviving. Atleast someone found it useful and not a total annoyance.
The only problem I had was when another script was conflicting with it and I have yet to sit try and figure out why (I've been feeling lazy tonight...more so than normal. Very Happy).

I would have added something to end the script in my quick edit, but I never bother ending it since I have stats where the taskbar would be (using Rainmeter).
_________________
Disclaimer: I'm not an expert by any means; I just try to help out where I can.
Back to top
View user's profile Send private message
sal



Joined: 19 Feb 2011
Posts: 33
Location: Tala Jal Mexico

PostPosted: Fri Apr 08, 2011 11:26 pm    Post subject: Fade in/out taskbar Reply with quote

nice work you did.
I added a little script to toggle the timer on and off in case it is needed
here it is

Code:

;add this line in the autoexecute seccion
timer := "on"


#o::    ;  win + o
if timer = on
{
  SetTimer, Transchecker, off
  WinSet, Transparent, off, ahk_class Shell_TrayWnd
  timer = off
}
else
{
   SetTimer, Transchecker, on
   timer = on
}
return
Back to top
View user's profile Send private message Send e-mail
sal



Joined: 19 Feb 2011
Posts: 33
Location: Tala Jal Mexico

PostPosted: Fri Apr 08, 2011 11:28 pm    Post subject: Fade in/out taskbar Reply with quote

nice work you did.
I added a little script to toggle the timer on and off in case it is needed
here it is

Code:

;add this line in the autoexecute seccion
timer := "on"


#o::    ;  win + o
if timer = on
{
  SetTimer, Transchecker, off
  WinSet, Transparent, off, ahk_class Shell_TrayWnd
  timer = off
}
else
{
   SetTimer, Transchecker, on
   timer = on
}
return
Back to top
View user's profile Send private message Send e-mail
bruno



Joined: 07 Mar 2011
Posts: 151

PostPosted: Fri Apr 08, 2011 11:45 pm    Post subject: Reply with quote

Is this new version stable? Can I be sure it does not freeze my XP? Laughing
___________________
Доверяй, но проверяй

Back to top
View user's profile Send private message
sal



Joined: 19 Feb 2011
Posts: 33
Location: Tala Jal Mexico

PostPosted: Sat Apr 09, 2011 12:15 pm    Post subject: Reply with quote

bruno wrote

Quote:
Is this new version stable? Can I be sure it does not freeze my XP?

I tested the script for quite some time without problems may be is your PC or videocard
I have windows XP service pack 3, 1340 mgz, 250 ram
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group