AutoHotkey Community

It is currently May 27th, 2012, 12:19 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: November 30th, 2009, 2:35 pm 
Offline

Joined: August 24th, 2005, 5:29 pm
Posts: 549
Location: Berlin / Germany
Moin a_h_k,

you know the difference between hidden and autohidden, don't you?
Code:
#NoEnv
ABM_GETSTATE := 0x00000004
ABS_AUTOHIDE := 0x1
ABS_ALWAYSONTOP := 0x2
NumPut(VarSetCapacity(ABD, 36, 0), ABD)
ABS := DllCall("Shell32.dll\SHAppBarMessage", UInt, ABM_GETSTATE, UInt, &ABD)
MsgBox, % "The Taskbar is " . (ABS & ABS_AUTOHIDE ? "" : "not ") . "auto-hidden!"
ExitApp

_________________
nick :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 1st, 2009, 3:29 am 
Offline

Joined: November 17th, 2009, 1:49 am
Posts: 25
i'm using Windows Vista Home Premium SP2...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 1st, 2009, 4:01 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
Hi nick, i've FINALLY found sth that works for me! (who knows why the other methods don't work? Maybe my os?)
Code:
; Toggle taskbar  (& fetch current hidden/showing status)
SW_HIDE = 0
WinGet, TaskBar_hWnd, ID, ahk_class Shell_TrayWnd
retValue := DllCall("user32.dll\ShowWindow", Int, TaskBar_hWnd, Int, SW_HIDE)

;Return Value
;If the window was previously visible, the return value is non-zero
;If the window was previously hidden, the return value is zero


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 1st, 2009, 4:29 am 
Offline

Joined: November 17th, 2009, 1:49 am
Posts: 25
I see the stuff you posted do work 4 me 2! (the other way of getting the state of the taskbar)

With your help i got the script hiding the taskbar the 1st time it was executed, but not the next times; however, it worked fine using the hotkey.

Here's what i found: everytime i executed the script 4 the 2nd, or 3rd, etc. times it would re-load the script 2 the the tray causing the taskbar to temporarily come back (i'm talking miliseconds here), so, the "IfWinExists" command wouldn't work then!...obviously, when i suspected that was the problem, i just added the "#NoTrayIcon" and now IT'S WORKING!!!
(wonder if that might be the reason 4 this command 2 not work with you a_h_k...care 2 check?)

here's the code (again, credit 2 a_h_k!thanks man!):


Code:
#NoTrayIcon
#SingleInstance force

; Fetch current hidden/showing status of taskbar
IfWinExist, ahk_class Shell_TrayWnd

   x = 1

IfWinNotExist, ahk_class Shell_TrayWnd   
{
        x = 0
}

Gosub +z

Exit

+z::
x := Func(x)
Return


Func(x)
{
   If x=0
   {
      NumPut( ( ABS_ALWAYSONTOP := 0x2 ), APPBARDATA, 32, "UInt" )
      DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
      WinShow ahk_class Shell_TrayWnd
      Return 1
   }
   
   If x=1
   {
      DetectHiddenWindows, On
      VarSetCapacity( APPBARDATA, 36, 0 )
      NumPut( ( ABS_ALWAYSONTOP := 0x2 )|( ABS_AUTOHIDE := 0x1 ), APPBARDATA, 32, "UInt" )
      DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
      WinHide ahk_class Shell_TrayWnd
      WinHide ahk_class Shell_TrayWnd
      Return 0
   }
}



A little (very) intermittent bug: when coming back from the hidden taskbar, that is, when i restore the taskbar, the option 2 "Keep taskbar over other windows" gets toggled off...dunno why...

Again, thanks a lot!


Cheers!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 1st, 2009, 9:00 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
Hi blehmeco
blehmeco wrote:
...got the script hiding the taskbar the 1st time it was executed, but not the next times; however, it worked fine using the hotkey
So the hotkey works perfectly, but not clicking the icon to run it?

blehmeco wrote:
Here's what i found: everytime i executed the script 4 the 2nd, or 3rd, etc. times it would re-load the script 2 the the tray causing the taskbar to temporarily come back (i'm talking miliseconds here), so, the "IfWinExists" command wouldn't work then!...obviously, when i suspected that was the problem, i just added the "#NoTrayIcon" and now IT'S WORKING!!! (wonder if that might be the reason 4 this command 2 not work with you a_h_k...care 2 check?)
I have checked, but my script (= different than yours) works whether #NoIcon is used or not

blehmeco wrote:
A little (very) intermittent bug: when coming back from the hidden taskbar, that is, when i restore the taskbar, the option 2 "Keep taskbar over other windows" gets toggled off...dunno why...

The following will leave "Always On Top" setting to what is currently is... (plus a couple of minor performance tweaks) :wink:
Code:
#NoTrayIcon
#SingleInstance force
DetectHiddenWindows, On

VarSetCapacity( APPBARDATA, 36, 0 )

; Fetch current hidden/showing status of taskbar
IfWinExist, ahk_class Shell_TrayWnd
  x = 1
Else
  x = 0

Gosub +z

Exit

+z::
  x := Func(x)
Return

Func(x)
{
   If x=0
   {
      NumPut( 0x0, APPBARDATA, 32, "UInt")
      DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
      WinShow ahk_class Shell_TrayWnd
      Return 1
   }
   
   If x=1
   {
      NumPut( ( ABS_AUTOHIDE := 0x1 ), APPBARDATA, 32, "UInt" )
      DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
      WinHide ahk_class Shell_TrayWnd
      WinHide ahk_class Shell_TrayWnd
      Return 0
   }
}

Edit: Moved "DetectHiddenWindows, On" to top (above 1st "IfWinExist". Realized that as it is, it will on the first run always return "x = 0" (ie whether taskbar showing or hidden). So the first run would have never hidden the taskbar (?)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 1st, 2009, 6:39 pm 
Offline

Joined: November 17th, 2009, 1:49 am
Posts: 25
Tried your code but it does not hide the start button, and it does not work after executing the file once...

this works:

Code:
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

#NoTrayIcon
#SingleInstance force

IfWinExist, ahk_class Shell_TrayWnd

   y = 1

IfWinNotExist, ahk_class Shell_TrayWnd   
{
        y = 0
}

Gosub +z

Exit

+z::
y := Func(y)
Return


Func(y)
{
   If y=0
   {
      NumPut( ( ABS_ALWAYSONTOP := 0x2 ), APPBARDATA, 32, "UInt" )
      DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
      WinShow ahk_class Shell_TrayWnd
      Return 1
   }
   
   If y=1
   {
      DetectHiddenWindows, On
      VarSetCapacity( APPBARDATA, 36, 0 )
      NumPut( ( ABS_ALWAYSONTOP := 0x2 )|( ABS_AUTOHIDE := 0x1 ), APPBARDATA, 32, "UInt" )
      DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
      WinHide ahk_class Shell_TrayWnd
      WinHide ahk_class Shell_TrayWnd
      Return 0
   }
}


However, after playing with this script it a bit i noticed it works perfectly using the Hotkey, but, when using it by executing the file, it hides and shows the taskbar&start button BUT turns the "Taskbar always on top" option off.
What is intended is that the "Taskbar always on top" is off (obviously) when the taskbar is hidden 2 (so that the extra screen space can b occupied by the maximized windows), and when the taskbar is showing the "Taskbar always on top" option should b on (so that maximized windows don't overlap the taskbar).
As i explained b4, using the hotkey successfully works out the correct state of "Taskbar always on top" option, however the execution of the file doesn't.

Hope that was not 2 confusing...


thanks!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 2nd, 2009, 3:40 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
So is this correct?
(you'll have to bear with me, as i've always used an auto-hidden taskbar!)

Showing:
Showing/hidden status (done via DllCall) = showing
"Taskbar always on top" setting = on (so that maximized windows don't overlap the taskbar)
"Auto-hide the taskbar" setting = off (so stays up permanently)

Hidden:
Showing/hidden status (done via DllCall) = hidden
"Taskbar always on top" setting = off (so that the extra screen space can b occupied by the maximized windows)
"Auto-hide the taskbar" setting = off


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 2nd, 2009, 3:12 pm 
Offline

Joined: November 17th, 2009, 1:49 am
Posts: 25
That is 100% correct!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 3rd, 2009, 4:40 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
So with that in mind, we get...
Code:
#NoEnv
#NoTrayIcon
#SingleInstance force
DetectHiddenWindows, Off   ;for IfWinExist

VarSetCapacity( APPBARDATA, 36, 0 )
;------------------------------------------------------------
; Fetch current hidden/showing status

IfWinNotExist, ahk_class Shell_TrayWnd
  TaskbarAndStartToggleState = 0     ;Currently not showing
Else
  TaskbarAndStartToggleState = 1     ;Currently showing
;------------------------------------------------------------
Gosub +z   ;Toggle the taskbar/SM state
;------------------------------------------------------------
Exit
;------------------------------------------------------------
+z::
 TaskbarAndStartToggleState := Func(TaskbarAndStartToggleState)
Return

Func(TaskbarAndStartToggleState)
{
   Global APPBARDATA

   If TaskbarAndStartToggleState = 0
   {
      NumPut( (ABS_ALWAYSONTOP := 0x2), APPBARDATA, 32, "UInt" )   ;Re-enable "Always on top"
      DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )

      WinShow ahk_class Shell_TrayWnd
      Return 1            ;Now showing
   }
   
   If TaskbarAndStartToggleState = 1
   {
      NumPut( 0x0, APPBARDATA, 32, "UInt" )            ;Disable "Always on top" (& auto-hide if was enabled)
      DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )

      WinHide ahk_class Shell_TrayWnd
      WinHide ahk_class Shell_TrayWnd
      Return 0            ;Now hidden
   }
}

Cross your fingers :lol:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 4th, 2009, 2:45 am 
Offline

Joined: November 17th, 2009, 1:49 am
Posts: 25
LOL! i did cross my fingers!:wink:

your code addressed the "Always on top" problem very well, but it wouldn't hide the start button.
However by adding the following simplest of changes 2 it (in red):

Code:
#NoEnv
#NoTrayIcon
#SingleInstance force
DetectHiddenWindows, Off   ;for IfWinExist

VarSetCapacity( APPBARDATA, 36, 0 )
;------------------------------------------------------------
; Fetch current hidden/showing status

IfWinNotExist, ahk_class Shell_TrayWnd
  TaskbarAndStartToggleState = 0     ;Currently not showing
Else
  TaskbarAndStartToggleState = 1     ;Currently showing
;------------------------------------------------------------
Gosub +z   ;Toggle the taskbar/SM state
;------------------------------------------------------------
Exit
;------------------------------------------------------------
+z::
 TaskbarAndStartToggleState := Func(TaskbarAndStartToggleState)
Return

Func(TaskbarAndStartToggleState)
{
   Global APPBARDATA

   If TaskbarAndStartToggleState = 0
   {
      NumPut( (ABS_ALWAYSONTOP := 0x2), APPBARDATA, 32, "UInt" )   ;Re-enable "Always on top"
      DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )

      WinShow ahk_class Shell_TrayWnd
      Return 1            ;Now showing
   }
   
   If TaskbarAndStartToggleState = 1
   {
      NumPut( ( ABS_ALWAYSONTOP := 0x0 )|( ABS_AUTOHIDE := 0x1 ), APPBARDATA, 32, "UInt" )            ;Disable "Always on top" (& auto-hide if was enabled)
      DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )

      WinHide ahk_class Shell_TrayWnd
      WinHide ahk_class Shell_TrayWnd
      Return 0            ;Now hidden
   }
}


it worked! just fine!!! which is great! thanks a lot a_h_k !!!REALLY!

it is now doing exactly what it's supposed 2 do!
Thanks 4 your time!..and patience!really helped me out!


Cheers!:D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 4th, 2009, 4:54 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
That's GREAT!!! :D

I have made another little tweak (in red)
Code:
#NoEnv
#NoTrayIcon
#SingleInstance force
DetectHiddenWindows, Off   ;for IfWinExist

VarSetCapacity( APPBARDATA, 36, 0 )
;------------------------------------------------------------
; Fetch current hidden/showing status

IfWinNotExist, ahk_class Shell_TrayWnd
  TaskbarAndStartToggleState = 0     ;Currently hidden (not showing)
Else
  TaskbarAndStartToggleState = 1     ;Currently non-hidden (showing)
;------------------------------------------------------------
Gosub +z   ;Toggle the taskbar/SM state
;------------------------------------------------------------
Exit
;------------------------------------------------------------
+z::
 TaskbarAndStartToggleState := Func(TaskbarAndStartToggleState)
Return

Func(TaskbarAndStartToggleState)
{
   Global APPBARDATA

   If TaskbarAndStartToggleState = 0
   {
      NumPut( (ABS_ALWAYSONTOP := 0x2), APPBARDATA, 32, "UInt" )           ;Enable "Always on top" (& disable auto-hide)
      DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )

      WinShow ahk_class Shell_TrayWnd
      Return 1            ;Now showing
   }
   
   If TaskbarAndStartToggleState = 1
   {
      NumPut( ( ABS_AUTOHIDE := 0x1 ), APPBARDATA, 32, "UInt" )            ;Disable "Always on top" (& enable auto-hide to hide Start button)
      DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )

      WinHide ahk_class Shell_TrayWnd
      ;WinHide ahk_class Shell_TrayWnd   ;don't need this 2nd one?
      Return 0            ;Now hidden
   }
}


It hides the Start button fine on my pc (WinXP), without needing "auto-hidden" to be on
Maybe Vista has things a bit different in this regard to XP?

Also, was the 2nd "WinHide ahk_class Shell_TrayWnd" so as to (try) hide the Start button? If so, then it might now work without it? Try it and see


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2009, 7:08 pm 
Offline

Joined: November 17th, 2009, 1:49 am
Posts: 25
Well, don't ask me why, but if i don't add that 2nd "WinHide" it fails 2 hide the taskbar&Start Button on 1st execution, it just "auto-hides" both instead... if i execute it 4 a 2nd time, it then hides them completely! :?

when i add that 2nd "WinHide" it manages 2 hide it well on 1st execution and the following ones 2!

That tweak you made with the "( ABS_AUTOHIDE := 0x1 )" also worked very well!


Thanks again a_h_k!


Cheers!:wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Using this with a dock
PostPosted: December 24th, 2009, 12:36 am 
This is great!

I have put up an implementation for dock users.

And it's also great when triggered by Hot Corners 2. I simply make the corner where the Start Orb is into a hot corner to trigger F12.

http://rocketdock.com/addon/docklets/26779


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Leef_me, Pulover, rjgatito, XstatyK and 23 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