Jump to content

Switch On/off Tick Boxes In Local Area Connection


Recommended Posts

Hi everyone, got an interesting one for you!

In the 'Local Area Connection Properties' dialog box I'd like to disable the Microsoft Client and File and Print Sharing. There are tick boxes for these but using the usual Send("{-}") doesn't switch them off. If I send a space, then it toggles it.

I don't want to toggle these options, I want them OFF, does anyone have any ideas how I can force them off? Or does anyone know the registry enteries for these, maybe I can turn them off that way?

Here's my code to toggle them:

Send("{LWIN}r")
WinWaitActive("Run")
Send("NCPA.CPL{ENTER}") ;open Network Connections window

WinWaitActive("Network Connections")
Send("Local")
Send("!fr")    ;properties

WinWaitActive("Local Area")
Send("client{SPACE}") ;turn off MS client

Sleep(1000) ;wait a sec
Send("file{SPACE}") ;turn off File and Print sharing

Send("{TAB 4}")
Send("{ENTER}")
Michael
Link to comment
Share on other sites

for windows 95,98,ME (((ONLY)))

User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
Network]
System Key: [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\
Network]
Name: NoFileSharing, NoPrintSharing
Type: REG_DWORD (DWORD Value)
Value: (0 = file sharing, 1 = disabled)
Link to comment
Share on other sites

Hi, I think you're right Larry. There doesn't seem to be individual controls for the items in the list, at least AutoIt Spy can't see them.

Thanks Beerman but I'm using Windows XP :whistle:

So does anyone know where I can find the registry enteries for the networking items?

Michael

Michael
Link to comment
Share on other sites

Thanks Larry, Netsh.exe looks like a possibility, although it seems I'll have to do some studying to understand it's odd commands. If I figure it out I'll let you guys know. In the meantime if you hear of anything else, please let me know.

Many thanks to all,

Michael

Michael
Link to comment
Share on other sites

Sorry - I didn't click that it was a check-box style listbox (thanks Larry :whistle: ).

If the listbox doesn't scroll too much and you can count on the position being constant (relative to the active window), then I have a function somewhere that does what you want by checking pixels and executing a mouseclick.

Let me know if you're interested and I'll go and find it.

Link to comment
Share on other sites

Hey I cleverly found it anyway - more organised than I thought? :whistle: - Hope this helps!

Func CheckBox($pX1, $pX2, $pY1, $pY2, $pOnColor, $pState)
;This function scans the pixels in the given range, 
;and if the $pOnColor value is found then it checks with the desired
;state ($pState) .. and sends a mouseclick event to the middle of the range
;if they are different.

;Set coordinates relative to active window  
    AutoItSetOption("MouseCoordMode", 0);0 = relative coords to the active window
    AutoItSetOption("PixelCoordMode", 0);0 = relative coords to the active window

;Temporarily Ignore user's mouse wanderings
    BlockInput(1)

;See if the On-Color can be found
    $aXY = PixelSearch($pX1, $pY1, $pX2, $pY2, $pOnColor)
    If @error = 1 then
       ;pOnColor WAS NOT found
        $ynChecked = 0
    Else
       ;pOnColor WAS found
        $ynChecked = 1
    EndIf

    If $ynChecked = $pState then 
       ;Do nothing, since the required state matches the current status
    Else
       ;Send the mouse to click the topleft coords
        MouseClick( "left" ,$pX1 ,$pY1 ,1 ,0)    
    Endif

;Back to normal
    BlockInput(0)

    Return

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