Sign in to follow this  
Followers 0
ph777

Unchecking in a SysListView321

5 posts in this topic

Run("RunDll32.exe shell32.dll,Control_RunDLL firewall.cpl")

WinWait("Windows Firewall")

WinWaitActive("Windows Firewall")

Send("^{TAB}")

In the Programs and services field, i want to uncheck certain services. For ex..... files & printer share unchecked, remote desktop checked, and so on....

thanks

Share this post


Link to post
Share on other sites



This works for me, you may or may not have the same controlID for the listview, use the autoit window info tool to find it.

#Include <GuiListView.au3>
#include <Array.au3>
Run("RunDll32.exe shell32.dll,Control_RunDLL firewall.cpl")
WinWait("Windows Firewall")
WinWaitActive("Windows Firewall")
Send("^{TAB}")
Sleep(1000)
$Hwnd = ControlGetHandle("Windows Firewall","",102);change 102 to whatever your ControlID for SysListView32 is
$Count = _GUICtrlListViewGetItemCount($Hwnd)
Dim $Items[$Count+1]
$Items[0] = $Count
For $i = 1 to $Items[0]
    $Items[$i] = _GUICtrlListViewGetItemText($Hwnd, $i-1)
    Switch $Items[$i]
        Case "File and Printer Sharing"
            _GUICtrlListViewSetCheckState($Hwnd, $i-1,0) ;This will Uncheck File and Printer Sharing
        Case "Remote Desktop"
            _GUICtrlListViewSetCheckState($Hwnd, $i-1,1) ;This will Check Remote Desktop
    EndSwitch
Next
_ArrayDisplay($Items)

I hope this helps

Share this post


Link to post
Share on other sites

I tried it and it didn't work ........... hmmm I'm using Win XP pro. My Control ID is the same (102).

Share this post


Link to post
Share on other sites

I tried it and it didn't work ........... hmmm I'm using Win XP pro. My Control ID is the same (102).

Did the arraydisplay on the end at least display the items?

Because this worked for me the first time, however, i just retested it, and it did not check or uncheck anything however it still correctly read all the programs on the list.

Odd...

Different results running the same code twice...

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Yes it did show the list. the ones that i wanted unchecked were NOT on the list.

I could use the Send command way, but it's kinda buggy....

Edited by ph777

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