Jump to content

Not working: Checking an item in a tree


tsqrl
 Share

Recommended Posts

Hi,

I want to set a custom appearance to Windows 7 by just running one file. A forum post from 2004 got me started. I almost managed to get a working AutoIt script for that, but I there is one thing which isn't working. _GUICtrlButton_SetCheck function doesn't check the button although the node is found. However, the script tells me the item is checked though it is not. What might be the reason for this?

One minor thing is that I didn't find a way to hide Performance Options window.

#include <GuiTreeView.au3>
#include <GuiButton.au3>

Opt("WinTitleMatchMode", 4)

;Opens the System Properties window and chooses the 3rd tab
;same as right click --> properties from My Computer.
Opt('WinWaitDelay', 10)
RunWait("control sysdm.cpl,,3","")
WinWaitActive("classname=#32770");
WinSetState("classname=#32770","",@SW_HIDE)

;click on the Performance Options "Settings" button
WinWaitActive("classname=#32770")
$handle = WinGetHandle("active")
ControlClick("","","Button2")

;click on "Adjust for best performance"
WinWaitActive("classname=#32770")
ControlClick("","","Button3")

;check desired items

$tree = ControlGetHandle("","","[CLASS:SysTreeView32; INSTANCE:1]")

$node = _GUICtrlTreeView_FindItem($tree, "Show window contents while dragging", True)
_GUICtrlTreeView_SetChecked($tree, $node, True)
If _GUICtrlTreeView_GetChecked($tree, $node) Then
    MsgBox(4160, "Information", "Congratulations!")
Else
    MsgBox(4160, "Information", "I'm sorry")
EndIf

$node = _GUICtrlTreeView_FindItem($tree, "Smooth edges of screen fonts", True)
_GUICtrlTreeView_SetChecked($tree, $node, True)

;click on "OK" button
ControlClick("","","Button5")

;click on "OK" button
WinWaitActive("handle="&$handle)
ControlClick("","","Button9")
Edited by tsqrl
Link to comment
Share on other sites

  • 1 month later...

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...