 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
nick
Joined: 24 Aug 2005 Posts: 501 Location: Berlin / Germany
|
Posted: Mon Nov 30, 2009 2:35 pm Post subject: |
|
|
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
denick @ http://de.autohotkey.com/forum/ |
|
| Back to top |
|
 |
blehmeco
Joined: 17 Nov 2009 Posts: 24
|
Posted: Tue Dec 01, 2009 3:29 am Post subject: |
|
|
| i'm using Windows Vista Home Premium SP2... |
|
| Back to top |
|
 |
a_h_k
Joined: 02 Feb 2008 Posts: 414
|
Posted: Tue Dec 01, 2009 4:01 am Post subject: |
|
|
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 |
|
|
| Back to top |
|
 |
blehmeco
Joined: 17 Nov 2009 Posts: 24
|
Posted: Tue Dec 01, 2009 4:29 am Post subject: |
|
|
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! |
|
| Back to top |
|
 |
a_h_k
Joined: 02 Feb 2008 Posts: 414
|
Posted: Tue Dec 01, 2009 9:00 am Post subject: |
|
|
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)
| 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 (?) |
|
| Back to top |
|
 |
blehmeco
Joined: 17 Nov 2009 Posts: 24
|
Posted: Tue Dec 01, 2009 6:39 pm Post subject: |
|
|
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! |
|
| Back to top |
|
 |
a_h_k
Joined: 02 Feb 2008 Posts: 414
|
Posted: Wed Dec 02, 2009 3:40 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
blehmeco
Joined: 17 Nov 2009 Posts: 24
|
Posted: Wed Dec 02, 2009 3:12 pm Post subject: |
|
|
| That is 100% correct! |
|
| Back to top |
|
 |
a_h_k
Joined: 02 Feb 2008 Posts: 414
|
Posted: Thu Dec 03, 2009 4:40 am Post subject: |
|
|
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  |
|
| Back to top |
|
 |
blehmeco
Joined: 17 Nov 2009 Posts: 24
|
Posted: Fri Dec 04, 2009 2:45 am Post subject: |
|
|
LOL! i did cross my fingers!
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! |
|
| Back to top |
|
 |
a_h_k
Joined: 02 Feb 2008 Posts: 414
|
Posted: Fri Dec 04, 2009 4:54 am Post subject: |
|
|
That's GREAT!!!
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 |
|
| Back to top |
|
 |
blehmeco
Joined: 17 Nov 2009 Posts: 24
|
Posted: Sat Dec 05, 2009 7:08 pm Post subject: |
|
|
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! |
|
| Back to top |
|
 |
lewrex Guest
|
Posted: Thu Dec 24, 2009 12:36 am Post subject: Using this with a dock |
|
|
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 |
|
| 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
|