Jump to content

Enable Quick Launch Bar with AutoIt script run from GuiRunOnce


Recommended Posts

Hi!

I've been looking for a way to enable the Windows XP (x64) Quick Launch bar when doing the 1st boot after an unattended installation.

Doing that with a .reg-file doesn't work, tried that several times.

Then I read something about a AutoIt script that would be able to enable the Quick Launch bar but I can't find anywhere if that script works before explorer.exe is even started for the 1st time.

Does anyone knows something about this?

With regards,

Bart Grefte

Link to comment
Share on other sites

AFAIK, GuiRunOnce adds the entries into the HKCU RunOnce key in the registry. Even if the entries were put into the HKLM RunOnce key then you just can add a Sleep(10000) into your script so the desktop loads the taskbar and then run your code to enable the taskbar. I run this part of code from the HKCU key at first logon and I use a Sleep to wait for the desktop to fully setup.

_TaskBarProperties()
Func _TaskBarProperties()
    Local $opt_WinWaitDelay, $oShellApp, $title_taskbar
    $opt_WinWaitDelay = Opt('WinWaitDelay', 1)
    $title_taskbar = 'Taskbar and Start Menu Properties'
    $oShellApp = ObjCreate('Shell.Application')
    If Not @error Then
        $oShellApp.TrayProperties
        If WinWait($title_taskbar, '', 5) Then
            WinSetState($title_taskbar, '', @SW_HIDE); Hide the window
            Sleep(250)
            ControlCommand($title_taskbar, '', 'Button1', 'UnCheck'); UnLock the Taskbar
            ControlCommand($title_taskbar, '', 'Button2', 'Check'); Auto-hide the Taskbar
            ControlCommand($title_taskbar, '', 'Button5', 'Check'); Show Quick Launch
            ControlCommand($title_taskbar, '', 'Button1', 'Check'); Lock the Taskbar
            ControlClick($title_taskbar, '', 'Button13'); Apply the settings
            ControlClick($title_taskbar, '', 'Button11'); OK to finish
        EndIf
    EndIf
    Opt('WinWaitDelay', $opt_WinWaitDelay)
EndFunc

PaulIA originally posted the code so thanks go to him.

:)

Link to comment
Share on other sites

  • Moderators

The following example will enable and correctly size the quick launch toolbar.

#include <WinAPI.au3>
#include <GuiReBar.au3>

_QuickLaunch_SetState(True)
_ResizeQuickLaunchBar()
Exit

;===============================================================================
;
; Function Name:    _QuickLaunch_SetState
; Description:      Enable/disable the quick launch toolbar
; Parameter(s):     $fState - Specifies whether to enable or disable the quick launch toolbar.
;                       True (1) = toolbar is enabled
;                       False (0) = toolbar is disabled
; Requirement(s):   Windows 2000 or XP
; Return Value(s):  Success - Return value from _SendMessage
;                   Failure - @error is set
;                   @error  - 1 = Invalid $fState, 2 = Unable to get handle for Shell_TrayWnd
; Author(s):        Bob Anthony (big_daddy)
;
;===============================================================================
;
Func _QuickLaunch_SetState($fState)
    Const $WM_USER = 0X400
    Const $WMTRAY_TOGGLEQL = ($WM_USER + 237)
    
    If $fState <> 0 And $fState <> 1 Then Return SetError(1, 0, 0)
    
    $hTrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]")
    If @error Then Return SetError(2, 0, 0)
    
    Return _SendMessage($hTrayWnd, $WMTRAY_TOGGLEQL, 0, $fState)
EndFunc   ;==>_QuickLaunch_SetState

Func _ResizeQuickLaunchBar()
    Local $iIndex = 0
    Local $hTaskBar = _WinAPI_FindWindow("Shell_TrayWnd", "")
    Local $hRebar = ControlGetHandle($hTaskBar, "", "ReBarWindow321")
    _GUICtrlRebar_MinimizeBand($hRebar, $iIndex)
    _GUICtrlRebar_MaximizeBand($hRebar, $iIndex, True)
EndFunc   ;==>_ResizeQuickLaunchBar
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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