 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Gav_Oracle Guest
|
Posted: Thu Feb 07, 2008 8:08 pm Post subject: Trying to toggle autohide taskbar with keystroke in vista |
|
|
Hi all!
Hope somebody can help, I've been trying to get this to work for hours.
I want to be able to press win-alt-t and have the auto hide taskbar property be toggled.
Here is what I think should work:
| Code: |
;Open Taskbar properties, toggle autohide taskbar, apply and close window
;------------------------------------------------------------------------
#!t::Run, RunDLL32.EXE shell32.dll`,Options_RunDLL 1
WinWait, Taskbar and Start Menu Properties
Send, ua{ESC}
|
Problem is it doesn't. It gets as far as opening the taskbar properties but then nothing else happens. Even if you comment out the send line and try to open a webpage it doesn't do that either.
I can get it to work by splitting the work between two key combos, one to open the window one to do the sending. Does this suggest something wrong with the WinWait?
I've tried countless other workarounds and stuff to try and get it to work but to no avail. Anybody have any ideas?
Thanks in advance. |
|
| Back to top |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1521 Location: Denmark
|
Posted: Thu Feb 07, 2008 8:13 pm Post subject: |
|
|
This is what i use (note different hotkey): | Code: | +esc::
if toggle := !toggle
WinHide ahk_class Shell_TrayWnd
else
WinShow ahk_class Shell_TrayWnd
return |
Edit: Credits goes to jonny for this!
Also note that for multi-line scripts the code have to start on the line below the hotkey label. _________________ there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face
- Kashmir
Last edited by tonne on Thu Feb 07, 2008 8:23 pm; edited 2 times in total |
|
| Back to top |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1521 Location: Denmark
|
Posted: Thu Feb 07, 2008 8:19 pm Post subject: |
|
|
Sorry, my script doesn't toggle autohide, it merely hides or unhides the taskbar. But it works for me  _________________ there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face
- Kashmir |
|
| Back to top |
|
 |
Gav_Oracle Guest
|
Posted: Thu Feb 07, 2008 8:37 pm Post subject: |
|
|
Thanks for your reply Tonne.
As you said it only hides the taskbar by sort of making it completely transparent it doesn't give me the extra little bit of screen space that I'm after. I'm trying to make oneNote's full screen, more full screen if you know what I mean.
Any other ideas, anyone? |
|
| Back to top |
|
 |
Gav_Oracle Guest
|
Posted: Thu Feb 07, 2008 8:41 pm Post subject: |
|
|
Forget the above post, I've fixed it!
Re-read Tonne's post and noticed the comment about starting on the line below, moved it down so it now looks like this:
| Code: |
;Open Taskbar properties, toggle autohide taskbar, apply and close window
;------------------------------------------------------------------------
#!t::
Run, RunDLL32.EXE shell32.dll`,Options_RunDLL 1
WinWait, Taskbar and Start Menu Properties
Send, ua{ESC}
|
Can't believe that's all that was wrong!
Thanks again Tonne! |
|
| Back to top |
|
 |
neo_in Guest
|
Posted: Tue Sep 09, 2008 7:33 pm Post subject: Can use Taskbar space.. |
|
|
| Gav_Oracle wrote: | Thanks for your reply Tonne.
As you said it only hides the taskbar by sort of making it completely transparent it doesn't give me the extra little bit of screen space that I'm after. I'm trying to make oneNote's full screen, more full screen if you know what I mean.
Any other ideas, anyone? |
Hi Gav,
SKAN's script is perfect.
I am using Vista with the task bar on my screens right edge. With SKAN's script, the taskbar becomes invisible except for the start button and then I can move windows to the space previously for taskbar. If I toggle back the task bar, it simply overlays the windows in it position.
Perfect!! |
|
| Back to top |
|
 |
neo_in
Joined: 09 Sep 2008 Posts: 1
|
Posted: Tue Sep 09, 2008 7:48 pm Post subject: Re: Can use Taskbar space.. |
|
|
| neo_in wrote: | | Gav_Oracle wrote: | Thanks for your reply Tonne.
As you said it only hides the taskbar by sort of making it completely transparent it doesn't give me the extra little bit of screen space that I'm after. I'm trying to make oneNote's full screen, more full screen if you know what I mean.
Any other ideas, anyone? |
Hi Gav,
SKAN's script is perfect.
I am using Vista with the task bar on my screens right edge. With SKAN's script, the taskbar becomes invisible except for the start button and then I can move windows to the space previously for taskbar. If I toggle back the task bar, it simply overlays the windows in it position.
Perfect!! |
Apologies..
doesnt work for full screen.. |
|
| Back to top |
|
 |
Mustang
Joined: 17 May 2007 Posts: 420 Location: England
|
Posted: Wed Sep 10, 2008 2:43 am Post subject: |
|
|
Does this work for you:
| Code: | #SingleInstance, Force
#Persistent
#NoEnv
SetBatchLines, -1
Return
F12::
{
If( TaskbarToggle = "" )
{
VarSetCapacity( APPBARDATA, 36, 0 )
NumPut( 36, APPBARDATA, 0, "UInt" ) ; cbSize
NumPut( WinExist( "ahk_class Shell_TrayWnd" ), APPBARDATA, 4, "UInt" ) ; hWnd
TaskbarToggle := 0
}
If( TaskbarToggle = 0 )
{
NumPut( ( ABS_ALWAYSONTOP := 0x2 )|( ABS_AUTOHIDE := 0x1 ), APPBARDATA, 32, "UInt" ) ; lParam
TaskbarToggle := 1
}
Else
{
NumPut( ( ABS_ALWAYSONTOP := 0x2 ), APPBARDATA, 32, "UInt" ) ; lParam
TaskbarToggle := 0
}
DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
Return
} |
|
|
| Back to top |
|
 |
EricCartman
Joined: 13 Oct 2008 Posts: 60 Location: South Park, Colorado
|
Posted: Mon Oct 13, 2008 4:23 pm Post subject: |
|
|
I've borrowed heavily from the code shown above and added a loop to re-hide the taskbar when Windows shows it again before I'm ready to see it. F12 is hotkey'd to show/hide the task bar.
I'm sure that my code can be written more elegantly, but this is working excellently for me on 64-bit Vista.
| Code: | x:=1 ; set x to 0 to start script with taskbar enabled
{
DetectHiddenWindows, On
VarSetCapacity( APPBARDATA, 36, 0 )
NumPut( 36, APPBARDATA, 0, "UInt" ) ; cbSize
NumPut( WinExist( "ahk_class Shell_TrayWnd" ), APPBARDATA, 4, "UInt" ) ; hWnd
IfWinExist, ahk_class Shell_TrayWnd
NumPut( ( ABS_ALWAYSONTOP := 0x2 )|( ABS_AUTOHIDE := 0x1 ), APPBARDATA, 32, "UInt" ) ; lParam
WinHide ahk_class Shell_TrayWnd
DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
}
part1:
{
Loop
{
If (x=1)
{
WinHide ahk_class Shell_TrayWnd
IfWinExist, ahk_class Shell_TrayWnd
NumPut( ( ABS_ALWAYSONTOP := 0x2 )|( ABS_AUTOHIDE := 0x1 ), APPBARDATA, 32, "UInt" ) ; lParam
DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
}
If (x=0)
{
goto part2
}
Continue
}
}
part2:
{
NumPut( ( ABS_ALWAYSONTOP := 0x2 ), APPBARDATA, 32, "UInt" ) ; lParam
DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
WinShow ahk_class Shell_TrayWnd
x:=2
goto part1
}
f12::
{
if toggle := !toggle
x:=0
else
x:=1
return
}
|
|
|
| Back to top |
|
 |
SylviaK Guest
|
Posted: Wed Oct 29, 2008 3:37 am Post subject: Trying to toggle autohide taskbar with keystroke in vista |
|
|
Hi all... I have UMPC and I need the screen space. I want to find a hotkey that will allow me to toggle the task bar on & off or off & auto-hide. I am impressed with this running post, but I have NO idea where one writes this code. Can you tell me (Or do I just need to hire someone to do this for me?)
Sylvia |
|
| Back to top |
|
 |
JoshWinter Guest
|
Posted: Sat Jan 24, 2009 7:13 pm Post subject: |
|
|
Hello,
can anybody tell me how I use these scripts?
Because I am using the Software "ObjectDock" which creates me a new taskbar. There I checked to hide the original taskbar.
But sometimes I would like the original one to show, too...
Can I use these scripts for that, too?
If yes, how do I have to save this code? In what kind of file?
Would be great if anyone could help me!
greetings,
Josh
P.s: using Win Vista 32 Bit |
|
| Back to top |
|
 |
zvuk
Joined: 13 Apr 2009 Posts: 1
|
|
| Back to top |
|
 |
indiglo Guest
|
Posted: Mon Apr 20, 2009 11:40 pm Post subject: Better Script |
|
|
I was looking for something like this for a while, and this thread helped me finally make something that works, so I figured I would let people know how to do it.
Thanks very much to EricCartman for the function calls, really all I did was fix the structure of the code.
Eric's code was working perfectly until I realized it was using 25% processor when the taskbar was showing.
This code uses no looping mechanisms, so it doesn't do anything except when you want it to.
| Code: | {
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 )
Sleep 10 ;Sometimes the bar doesn't get hidden 'all of the way' this prevents that.
WinHide ahk_class Shell_TrayWnd
} ;If you want the taskbar to start visible, delete this block.
x=1
f12:: ;The key used to toggle the taskbar. Change it as you like.
{
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
x=1
return
}
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 )
Sleep 10
WinHide ahk_class Shell_TrayWnd
x=0
return
}
}
|
For people wondering how to 'install'/ 'where' to write this (as I did at first): 1-Download and install autohotkey. 2-Simply copy the above code and paste it into notepad. 3-save this file as a .ahk file. 4-open the file to run the script.
I'm not sure how to get this to happen automatically when you log in, but I don't know that much about autohotkey. I'm sure there is some way to do it if you look
Hope this helps. |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1390 Location: The Interwebs
|
Posted: Tue Apr 21, 2009 1:33 am Post subject: Re: Better Script |
|
|
| indiglo wrote: | | I'm not sure how to get this to happen automatically when you log in, |
Put it in your startup directory:
C:\Users\USERNAMEFORCOMPUTERHERE\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
That is a directory specific to the user logged on... There's one for all users as well but I don't recall what it is at the moment. I'm sure you could find it with some quick searching. |
|
| Back to top |
|
 |
indiglo
Joined: 20 Apr 2009 Posts: 5
|
Posted: Tue Apr 28, 2009 6:11 pm Post subject: Re: Better Script |
|
|
| Krogdor wrote: | | Put it in your startup directory |
I tried doing that with both the .ahk file, and after converting it into an exe. Does it take windows a long time to execute the file or something? Or is there just something else on my computer preventing it from running? Thanks. |
|
| 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
|