Jump to content

Checkbox is not recognized in Windows 7 Internet Properties


jb7
 Share

Recommended Posts

I am trying to make sure a check box is checked in Internet Properties - advanced tab, but ControlTreeView "IsChecked" returns -1:not a checkbox

Run("control inetcpl.cpl,,6")
WinWaitActive("Internet Properties")
$treeview = ControlGetHandle("", "", "[CLASS:SysTreeView32; INSTANCE:1]")
ControlTreeView ("","",$treeview ,"Select", "#1|#1") ; works Ok - it selects an item
MsgBox("","",ControlTreeView ("","",$treeview ,"IsChecked", "#1|#1")) ; shows -1
ControlTreeView ("","",$treeview ,"Check", "#1|#1") ;does not work

Any ideas how at least to get checkbox's state, then I can use Space to check it if needed

thanks

EDIT:

1) the target checkbox is "Enable Browser Extensions", but this is not really important, because they are all the same

2) The user has no admin rights, so he can not change registry

UPDATE: The HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMain does not require admin rights, so the solution is to use RegWrite. Thanks to all!

Edited by jb7
Link to comment
Share on other sites

Hi,

It's not a "raw checkbox", but a "treeview checkbox", take a look at this function which should do the trick : _GUICtrlTreeView_SetChecked

Br, FireFox.

How do I get handle of the checkbox? In the docs they create checkboxes themselves and get handle in the proceess

$hItem[$x]=GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item",$x+1),$hTreeView)

...

_GUICtrlTreeView_SetChecked($hTreeView,$hItem[$hRandomItem])

Link to comment
Share on other sites

These settings can be maintained in the registry.

A quick note from something I've found over the years. When modifying the registry of a program that's currently running, you may need to restart it, as the program didn't make the changes itself, it can't automatically reflect them.

Edited by James
Link to comment
Share on other sites

Yes, in the docs like you said, there is other funcs to get that handle : _GUICtrlTreeView_GetItemByIndex, _GUICtrlTreeView_FindItem, ...

Br, FireFox.

Thanks, it gets the handle but it does not select it or check the checkbox

#include <GuiTreeView.au3>
Run("control inetcpl.cpl,,6")
WinWaitActive("Internet Properties")
$treeview = ControlGetHandle("", "", "[CLASS:SysTreeView32; INSTANCE:1]")
ControlTreeView ("","",$treeview ,"Select", "#1|#1") ;works Ok
ControlTreeView ("","",$treeview ,"Check", "#1|#1") ; no action
$hItemFound = _GUICtrlTreeView_FindItem($treeview, "Play system sounds")
MsgBox("","",$hItemFound ); shows the handle Ok
_GUICtrlTreeView_SetChecked($treeview,$hItemFound ) ; no action
_GUICtrlTreeView_SelectItemByIndex("","",9) ; no action
Link to comment
Share on other sites

  • Moderators

I would agree with scullion; most settings I do I just set it in the registry, rather than trying to manually navigate through the GUI. It will probably save you a lot of frustration.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

jb7, my old eyes may be deceiving me, but I don't see it mentioned exactly which checkbox you're trying to manipulate. Can you explain just what setting(s) you're trying to change?

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

jb7, my old eyes may be deceiving me, but I don't see it mentioned exactly which checkbox you're trying to manipulate. Can you explain just what setting(s) you're trying to change?

Actually I am able to change what I need through registry update, I need to make sure "Enable Browser Extensions" is checked. But as I said in the beginning, the script that is supposed to work doesn't work, so this may be interesting to the Autoit team.

Link to comment
Share on other sites

  • 2 weeks later...

Just realized that I can not use the registry because the user has no admin rights. So back to original issue - Any ideas how to get checkbox's state in Internet Properties - advanced tab

Link to comment
Share on other sites

Where in the registry is the setting? Because if it's in HKCU, then the user can change it even without admin rights.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Where in the registry is the setting? Because if it's in HKCU, then the user can change it even without admin rights.

yes you are right, I used RegWrite and it worked. Question closed, thanks! :ILA:

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