Sign in to follow this  
Followers 0
Langy

Windows 7 Start Menu Config

10 posts in this topic

Hello

Just got a laptop with Windows 7 Pro on it which is going to be the first of a very big batch. These are all OEM machines so manual configuration rather than sysprep and imaging due to no volume licencing.

So to try and get all these the same I am doind a series of various AutoIT Scripts.

Customizing the Start Menu seems to be a real pain. I have read many posts on here but none of these seem to work for me on Windows 7.

Basically I need to check values of a check box in the SysTreeView32 list, I can use the Send() function to change the value if required. Radio buttons are easy as the value does not need to be checked.

If someone has a Windows 7 Pro machine that they can do a simple script to read a checkbox value in the Customize Start Menu options would be most appreciated.

Thanks in advance for any help.

Langy

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

The ControlCommand Function can help you for checkbox ! Posted Image

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

The ControlCommand Function can help you for checkbox ! Posted Image

I've tried that and also someones scripts on the forums for _GUICtrlTreeView_......

It seems that the tree view in the Start Menu properties window does not get picked up with AutoIT as normal.

This si why I asked for the script from someone who has a Windows 7 Pro machine as Win7 may be even worse.

Thanks anyway.

Share this post


Link to post
Share on other sites

Here is a start. This will scroll through the list, but AutoIT cannot read the items' text or determine their state, so it's not much. I have tried _GUICtrlTreeView_GetImageIndex (that always returns a 0) and ControlTreeView "IsChecked" (that always return -1) evidently because it is not a true checkbox to AutoIT (or it really isn't a checkebox to anything). Anyways, if you make any progress please update your findings.

Global $hTreeView, $hItemFound
Global $sTitle = '[REGEXPTITLE:(?i)Taskbar and Start Menu Properties; CLASS:#32770]'
Global $wTitle = '[REGEXPTITLE:(?i)Customize Start Menu; CLASS:#32770]'
ControlSend('[CLASS:Shell_TrayWnd]', '', '', '!{ENTER}')
WinWait($sTitle, '')
WinActivate($sTitle, '')
$Tabhdl = ControlGetHandle($sTitle, '', 'SysTabControl321')
ControlCommand($sTitle, '', $Tabhdl, 'TabRight', '')
Do
    Sleep(10)
Until StringRegExp(ControlGetText($sTitle, '', 'Button1'), '(?i)Customize')
ControlCommand($sTitle, '', 'Button1', 'Check', '')

WinWait($wTitle, '')
If Not WinActive($wTitle, '') Then WinActivate($wTitle, '')
WinWaitActive($wTitle, '')

$hTreeView = ControlGetHandle($wTitle, '', 'SysTreeView321')

$hItem = _GUICtrlTreeView_GetFirstItem($hTreeView)
$Count = ControlTreeView($wTitle, '', $hTreeView, 'GetItemCount', '')

While 1
    _GUICtrlTreeView_SelectItem($hTreeView, $hItem)
    Local $Text = _GUICtrlTreeView_GetText($hTreeView, $hItem)
    Local $Item = ControlTreeView($wTitle, '', $hTreeView, 'GetSelected', 1)
    _Splash($Item & ' of ' & $Count - 1 & ' Text is: ' & $Text)
    
    ;Sample check...on my system it toggles "Default Programs"
    If $Item = '#3' Then
        _GUICtrlTreeView_ClickItem($hTreeView, $hItem)
        MsgBox(32, 'Paused', 'Click OK To Proceed with Loop')
    EndIf
    
    Sleep(100)
    $hItem = _GUICtrlTreeView_GetNext($hTreeView, $hItem)
    If Not $hItem Then ExitLoop
WEnd

Func _Splash($Text) ;Shows a small borderless splash message.
    SplashTextOn('', $Text, @DesktopWidth, 25, -1, 5, 33, '', 14)
EndFunc   ;==>_Splash

Share this post


Link to post
Share on other sites

Just an idea....could what your trying to do be accomplished via a registry key maybe being changed?

I know alot of the customization settings for win7 are stored in the registry, might be worth checking on.

;)


http://twentylinesofcode.blogspot.comLittle apps n crap. can be fun

Share this post


Link to post
Share on other sites

I have found that the script can read the treeview text on Win7 Ultimate x86, but it doesn't read on 2008r2 (x64). Maybe someone with win7 x64 can test it...I'm too lazy to build VM

Share this post


Link to post
Share on other sites

Thanks for the replies.

I did manage to scroll down the list and actually read the text of each line with the ControlTreeView command but like you unable to check the state of any controls.

Well for now then it looks like I will read the controls this way and just send a space bar.

This is for the initial first build but I would rather build something that sets the check boxes to the values I am after so that it can be used at any point.

At the moment all I want to do is switch off....

Default Programs

Enable context menus and dragging and dropping

Highlight newly installed programs

So I will keep monitoring this post incase anyone has anymore replies.

Thanks again.

Share this post


Link to post
Share on other sites

I have had the same issue but could not find any "solution". ;)

Could you let us know your solution please?

Thanks

E

Share this post


Link to post
Share on other sites

This is the code that I currently use to PIN a couple of programs to the Start Menu and then lock it down.

Yes I know there are probably better ways to code it but I still cant find the solution to checking the values of teh listed items.

Func UpdateStartMenu()
    Dim $retItem
    Dim $retMenu
    
    UpdateStatus("Setting Start Menu","0x00FF00") ;Updates status Window
    
    Send("#m") ;Minimize all windows
    Sleep(500)
    
    Send("#r") ;Using run command open all users desktop and pin Outlook
    Sleep(500)
    Send("C:\Users\Public\Desktop{ENTER}")
    WinWaitActive("Desktop")
    Send("microsoft office o")
    Sleep(500)
    Send("!fu")
    Sleep(500)
    Send("!{F4}")

    Send("#r") ;Using run command open IE and Pin IE
    Sleep(500)
    Send("C:\Program Files\Internet Explorer{ENTER}")
    WinWaitActive("Internet Explorer")
    Send("iex")
    Sleep(500)
    Send("!fu")
    Sleep(500)
    Send("!{F4}")

    WinActivate($gui)
    WinActivate($guiStatus)
    
    MouseClick("right",26,748,1) ;Open start menu properties
    Sleep(500)
    Send("r")
    Sleep(500)
    Send("!c")
    WinWaitActive("Customize Start Menu")
    
    ;loop through and set appropiate settings
    $retItem = ControlTreeView("","",1123,"GetSelected")

    Send("{DOWN}")

    While $retItem <> ControlTreeView("","",1123,"GetSelected")
        If StringInStr($retItem,"Display") = 0 And StringInStr($retItem,"Don't") = 0 Then
            $retMenu = $retItem
            ;MsgBox(0,"",$retMenu)
        EndIf
        
        
        $curItem = ControlTreeView("","",1123,"GetSelected")
        Select
            Case $curItem = "Control Panel|Don't display this item"
                Send("{SPACE}")
            Case $curItem = "Music|Don't display this item"
                Send("{SPACE}")
            Case $curItem = "Default Programs"
                Send("{SPACE}")
            Case $curItem = "Enable context menus and dragging and dropping"
                Send("{SPACE}")
            Case $curItem = "Highlight newly installed programs"
                Send("{SPACE}")
        EndSelect
            
        $retItem = ControlTreeView("","",1123,"GetSelected")
        Send("{DOWN}")
    WEnd
    
    Send("{ENTER}")
    Sleep(500)
    Send("!a{TAB 5}{ENTER}")

EndFunc

Share this post


Link to post
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
Sign in to follow this  
Followers 0