Sign in to follow this  
Followers 0
jb7

Checkbox is not recognized in Windows 7 Internet Properties

16 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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])

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

How do I get handle of the checkbox? In the docs...

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

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

These settings can be maintained in the registry.

Thanks I did it !!!! :guitar:

But checkbox is still not recognized

Edited by jb7

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

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

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

1 person likes this

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

Share this post


Link to post
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:

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