Jump to content

Help with enabling optional settings


Recommended Posts

Hello all,

I'm having a bit of an issue with one of my scripts on Windows 7. I want to verify that a sub option is enabled and if not enable it.

However the script works fine if the setting is "not configured" or "disabled", but if the option is already enabled it disables it.

As you can see from the script I've tried both ControlCommand(IsChecked, IsEnabled) and ControlEnable without any luck.

Oh and the setting is under:

Local Computer Policy\Computer Configuration\Administrative Templates\Classic Administrative Templates (ADM)\Microsoft Office 2007 system (machine)\Security Settings\IE Security\Block Popups

Thanks in advance!

#RequireAdmin
WinWaitActive("Block popups", "")
Send("!e")
sleep(1000)
;IF  ControlEnable("", "", "winword.exe") Then
IF ControlCommand("", "", "winword.exe", "IsChecked") Then
    ControlCommand("", "", "OK", "Check")
    MsgBox(0, "", "It's already enabled")
Else
    ControlCommand("", "", "winword.exe", "Check")
    ControlCommand("", "", "OK", "Check")
    MsgBox(0, "", "This setting has been enabled")
EndIf
Edited by armyman
Link to comment
Share on other sites

Hello all,

I'm having a bit of an issue with one of my scripts on Windows 7. I want to verify that a sub option is enabled and if not enable it.

However the script works fine if the setting is "not configured" or "disabled", but if the option is already enabled it disables it.

As you can see from the script I've tried both ControlCommand(IsChecked, IsEnabled) and ControlEnable without any luck.

Oh and the setting is under:

Local Computer Policy\Computer Configuration\Administrative Templates\Classic Administrative Templates (ADM)\Microsoft Office 2007 system (machine)\Security Settings\IE Security\Block Popups

Thanks in advance!

#RequireAdmin
WinWaitActive("Block popups", "")
Send("!e")
sleep(1000)
;IF  ControlEnable("", "", "winword.exe") Then
IF ControlCommand("", "", "winword.exe", "IsChecked") Then
    ControlCommand("", "", "OK", "Check")
    MsgBox(0, "", "It's already enabled")
Else
    ControlCommand("", "", "winword.exe", "Check")
    ControlCommand("", "", "OK", "Check")
    MsgBox(0, "", "This setting has been enabled")
EndIf

Wouldn't this be easier to do in the registry? This is a REG_DWORD value at "HKLM\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_WEBOC_POPUPMANAGEMENT", and the value name is "iexplore.exe" If this is set to 1, the pop-up blocker is enabled, if set to 0, it's disabled.

Why not just use a RegRead to determine if the data = 0, and if it does, change it to 1, if not, leave it alone? Fewer lines of code, and seems like a far simpler approach. To me, at least.

Link to comment
Share on other sites

  • 2 weeks later...

Wouldn't this be easier to do in the registry? This is a REG_DWORD value at "HKLM\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_WEBOC_POPUPMANAGEMENT", and the value name is "iexplore.exe" If this is set to 1, the pop-up blocker is enabled, if set to 0, it's disabled.

Why not just use a RegRead to determine if the data = 0, and if it does, change it to 1, if not, leave it alone? Fewer lines of code, and seems like a far simpler approach. To me, at least.

Sorry for the late reply, I was out of town for a while. I'll give this a try, but will this setting then be reflected in Group Policy? Thanks for the suggestion.

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