Jump to content

Recommended Posts

Posted (edited)

I use this script to enable the "Quick Launch" but i can't find any command for enabling "Auto-hide the taskbar" :)

  Quote

#Include <SendMessage.au3>

Const $WM_USER = 0X400

Const $WMTRAY_TOGGLEQL = ($WM_USER + 237)

If $CmdLine[0] = 1 Then

Select

Case $CmdLine[1] = 0

_SendMessage(WinGetHandle("[CLASS:Shell_TrayWnd]"), $WMTRAY_TOGGLEQL, 0, False)

Case $CmdLine[1] = 1

_SendMessage(WinGetHandle("[CLASS:Shell_TrayWnd]"), $WMTRAY_TOGGLEQL, 0, True)

EndSelect

EndIf

Edited by Outbreaker
  • Moderators
Posted

ControlHide

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

  • Moderators
Posted (edited)

  Outbreaker said:

No that's not working. :idiot:

TOGGLEQL = Ouick Launch

I am searching for the hide taskbar.

Yes that is working. You're just not using it right :P

Use the ClassNameNN of the TaskBar. It's been done a ton of times on here in fact.

Edit:

I may have totally mistaken what you're asking though >_< ... not unusual.

I think you want to just enable, not progmatically do it from your script :)

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

@SmOke_N

Afaik he wants to turn it permanently off which seems to be a bit tricky, using the registry is hard and using ControlCommand() is not very "clean". There should be a proper solution but I don't know it :)

Posted (edited)

I have an other script that i snipped together but the problem is that it's only working on English Windows.

And i don't now how to make it language-independent. I think its works with the "WinGetHandle" command but i am little bit lost how make the script work with that. I tryd but failed. :)

If $CmdLine[0] = 1 Then
    Select
        Case $CmdLine[1] = 0
            Run("Rundll32.exe SHELL32.DLL,Options_RunDLL 1")
            WinWaitActive("Taskbar and Start Menu Properties", "Taskbar", 6)
            ControlFocus("Taskbar and Start Menu Properties", "Taskbar","SysTabControl321")
            If ControlCommand("Taskbar and Start Menu Properties", "Taskbar", "Button5", "IsChecked") = 1 Then
                ControlCommand("Taskbar and Start Menu Properties", "Taskbar", "Button5", "UnCheck")
                ControlClick("Taskbar and Start Menu Properties", "Taskbar", "Button11")
            Else
                WinClose("Taskbar and Start Menu Properties")
            EndIf
        Case $CmdLine[1] = 1
            Run("Rundll32.exe SHELL32.DLL,Options_RunDLL 1")
            WinWaitActive("Taskbar and Start Menu Properties", "Taskbar", 6)
            ControlFocus("Taskbar and Start Menu Properties", "Taskbar","SysTabControl321")
            If ControlCommand("Taskbar and Start Menu Properties", "Taskbar", "Button5", "IsChecked") = 1 Then
                WinClose ("Taskbar and Start Menu Properties")
            Else
                ControlCommand("Taskbar and Start Menu Properties", "Taskbar", "Button5", "Check")
                ControlClick("Taskbar and Start Menu Properties", "Taskbar", "Button11")
            EndIf
    EndSelect
EndIf
Edited by Outbreaker
  • Moderators
Posted (edited)

This is the best I could do before Heros started :) ...

I'm not happy with having to kill explorer, there's a CE dll call to refresh I tried, but it failed (I even though to just put up a gui of the current screen and lock the mouse >_< ). Maybe someone else can pick it up.

The descriptions of what can be done are in the function:

_TaskBar_SetState(2)

Func _TaskBar_SetState($i_set = 2)
    #cs
        1 = Auto Hide and Show Clock 
        2 = Always on Top and Show Clock 
        3 = Always on Top and Auto Hide and Show Clock 
        4 = Show small icons in Start Menu and Show Clock 
        5 = Always on Top and Show small icons in Start Menu 
        6 = Always on Top and Auto Hide and Show small icons in Start Menu 
        7 = Always on Top and Show small icons in Start Menu and Show Clock 
        8 = All Options Enabled 
        9 = Always on Top and Auto Hide 
        10 = Auto Hide and Show small icons in Start Menu
    #ce
    
    Local Const $WM__SETTINGCHANGE = 0x001A
    
    Local $s_set_num
    
    Switch Int($i_set)
        Case 1, 2, 3, 4
            $s_set_num = StringFormat("%02s", Int($i_set))
        Case 5
            $s_set_num = "0E"
        Case 6
            $s_set_num = "0F"
        Case 7
            $s_set_num = "06"
        Case 8
            $s_set_num = "07"
        Case 9
            $s_set_num = "0B"
        Case 10
            $s_set_num = "0D"
        Case Else
            Return SetError(1, 0, 0)
    EndSwitch
    
    Local $s_key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2"
    If @OSType = "WIN32_WINDOWS" Then $s_key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects"
    
    Local $s_current_val = RegRead($s_key, "Settings")
    
    Local $s_compare = StringRegExpReplace($s_current_val, "(.{16})(.{2})(.+?)\z", "\2")
    If $s_compare = $s_set_num Then Return $s_current_val
    
    Local $s_convert = StringReplace(StringRegExpReplace($s_current_val, "(.{16})(.{2})(.+?)\z", "\1 " & $s_set_num  & " \3"), " ", "")
    RegWrite($s_key, "Settings", "REG_BINARY", $s_convert)
    
    ; CE method doesn't work , can't figure out the right values that are used.
    ;DllCall("User32.dll", "int", "SendMessage", "hwnd", WinGetHandle("[CLASS:Shell_TrayWnd]"), "int", $WM__SETTINGCHANGE, "wparam", 0, "lparam", 5000)
    
    Local $i_explorer_pid = ProcessExists("explorer.exe")
    ProcessClose($i_explorer_pid)
    ProcessWait("explorer.exe")
    
    Return $s_current_val
EndFunc

Edit:

http://msdn.microsoft.com/en-us/library/ms725497(VS.85).aspx

Oops, guess I forgot to work with SystemParametersInfo() http://msdn.microsoft.com/en-us/library/ms724947(VS.85).aspx

In my DllCall method I originally tried.

If ya'll figure it before I'm interested again, feel free.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

  • 15 years later...
Posted

Please stop using the registry. Calling SHAppBarMessage is the correct way. (direct change without restarting explorer.exe)

Example (trigger auto-hide when some windows is maximized, note the code under  comment  Hide taskbar and Show taskbar

#NoTrayIcon
Global $ABS_AUTOHIDE = 1
Global $ABS_ALWAYSONTOP = 2
Global $ABM_GETSTATE = 4
Global $ABM_SETSTATE = 10
Global $SW_HIDE = 0
Global $SW_SHOW = 5
Global $HIDDEN = 0

; Create APPBARDATA structure
Global $APPBARDATA = DllStructCreate("dword;hwnd;dword;dword;int[4];dword")
DllStructSetData($APPBARDATA, 1, DllStructGetSize($APPBARDATA))

; Get the current taskbar state
Global $trayState = DllCall("shell32.dll", "int", "SHAppBarMessage", "int", $ABM_GETSTATE, "ptr", DllStructGetPtr($APPBARDATA))[0]

While 1
    ; Get the handle of the active window
    $hActiveWindow = WinGetHandle("[ACTIVE]")

    ; Get the class name of the active window
    $sClassName = WinGetClassList($hActiveWindow)
    ;ConsoleWrite($sClassName&@CRLF)
    ; Skip the whole thing if the active window is the Start Menu
    If $sClassName = "Windows.UI.Core.CoreWindow" Or StringInStr($sClassName, "Internet Explorer_Server") Then
        Sleep(500)
        ContinueLoop
    EndIf

    ; Check if the active window is maximized
    If BitAND(WinGetState($hActiveWindow), 32) Then
        If $HIDDEN = 0 Then
            ; Hide taskbar
            $trayState = DllCall("shell32.dll", "int", "SHAppBarMessage", "int", $ABM_GETSTATE, "ptr", DllStructGetPtr($APPBARDATA))[0]
            DllStructSetData($APPBARDATA, 6, BitOR($trayState, $ABS_AUTOHIDE))
            DllCall("shell32.dll", "int", "SHAppBarMessage", "int", $ABM_SETSTATE, "ptr", DllStructGetPtr($APPBARDATA))
            $HIDDEN = 1
        EndIf


    Else
        If $HIDDEN = 1 Then
            ; Show taskbar
            $trayState = DllCall("shell32.dll", "int", "SHAppBarMessage", "int", $ABM_GETSTATE, "ptr", DllStructGetPtr($APPBARDATA))[0]
            DllStructSetData($APPBARDATA, 6, BitAND($trayState, Not $ABS_AUTOHIDE))
            DllCall("shell32.dll", "int", "SHAppBarMessage", "int", $ABM_SETSTATE, "ptr", DllStructGetPtr($APPBARDATA))
            $HIDDEN = 0
        EndIf

    EndIf

    ; Wait for 0.5 seconds
    Sleep(500)
WEnd

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...