AutoHotkey Community

It is currently May 27th, 2012, 6:37 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Fade in/out taskbar
PostPosted: September 17th, 2007, 10:40 pm 
Offline

Joined: September 17th, 2007, 10:01 pm
Posts: 7
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 18th, 2007, 10:45 am 
Offline

Joined: February 17th, 2006, 2:29 pm
Posts: 37
very good :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 18th, 2007, 10:58 am 
Three AHK commands/variables migth be of interest for you.
OnMessage
A_ScreenWidth/A_ScreenHight
SysGet


Get things goin :wink:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 18th, 2007, 8:46 pm 
Offline

Joined: March 10th, 2006, 7:41 pm
Posts: 89
Very Cool!
The autohide taskbar often misbehaves. This is a perfect and cool solution.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 18th, 2007, 9:16 pm 
Offline

Joined: September 17th, 2007, 10:01 pm
Posts: 7
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



Report this post
Top
 Profile  
Reply with quote  
 Post subject: AAAAAAAAAARGH
PostPosted: September 19th, 2007, 9:38 am 
Offline

Joined: September 17th, 2007, 10:01 pm
Posts: 7
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 29th, 2008, 10:06 pm 
Offline

Joined: June 27th, 2006, 2:38 pm
Posts: 385
Location: Canada
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.

8)


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. :D



8)




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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2008, 2:16 pm 
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?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2011, 4:49 am 
Online

Joined: September 15th, 2009, 1:14 am
Posts: 562
Location: Tempe, Arizona
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2011, 7:42 am 
Offline

Joined: March 7th, 2011, 2:59 am
Posts: 151
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. :lol: PS: After 5 minutes of use, it promptly froze my XP! :roll: ... And there is no way to quite this thing! :shock:
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2011, 8:30 am 
Online

Joined: September 15th, 2009, 1:14 am
Posts: 562
Location: Tempe, Arizona
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. :lol: PS: After 5 minutes of use, it promptly froze my XP! :roll: ... And there is no way to quite this thing! :shock:

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. :D).

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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Fade in/out taskbar
PostPosted: April 9th, 2011, 12:26 am 
Offline

Joined: February 20th, 2011, 12:07 am
Posts: 35
Location: Tala Jal Mexico
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Fade in/out taskbar
PostPosted: April 9th, 2011, 12:28 am 
Offline

Joined: February 20th, 2011, 12:07 am
Posts: 35
Location: Tala Jal Mexico
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2011, 12:45 am 
Offline

Joined: March 7th, 2011, 2:59 am
Posts: 151
Is this new version stable? Can I be sure it does not freeze my XP? :lol:
___________________
Доверяй, но проверяй

Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2011, 1:15 pm 
Offline

Joined: February 20th, 2011, 12:07 am
Posts: 35
Location: Tala Jal Mexico
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group