Sign in to follow this  
Followers 0
kid1232

Need help about Network sharing

6 posts in this topic

Hi

I making a small tool that create wifi Hotspot use netsh cmd

All command is ok 

But only sharing option that i dont know how to control

That list all network for choice one network to share

Then set properties Sharing

post-81501-0-11614700-1420127246_thumb.p

I find any infomation about 2hour but i cant find anything

I thinking about control click but it will not right for all windows version

Please. Help me! Have you some ideas?

Share this post


Link to post
Share on other sites

Hi. Any one can help me please?

Share this post


Link to post
Share on other sites

I'd be willing to bet those settings are stored in the registry.  I'm not at a place where I can test this, but I'd recommend using procmon to see what registry keys are being set and try setting them via your autoit script.  It may take a disable/enable of the network interface for the changes to take effect.

Just my two cents

1 person likes this

Share this post


Link to post
Share on other sites

Calm down. I see a vb6 example and ported to AutoIt. 

#RequireAdmin

Func EnableDisableICS($sPublicConnectionName,$ssPrivateConnectionName,$bEnable)

    Local  $bFound =False
    Dim $oNetSharingManager, $oConnectionCollection, $oItem, $EveryConnection, $objNCProps
    $oNetSharingManager = ObjCreate("HNetCfg.HNetShare.1")
    $oConnectionCollection = $oNetSharingManager.EnumEveryConnection
    For  $oItem In $oConnectionCollection
        $EveryConnection = $oNetSharingManager.INetSharingConfigurationForINetConnection($oItem)
        $objNCProps = $oNetSharingManager.NetConnectionProps($oItem)
        If $objNCProps.name = $ssPrivateConnectionName Then
            $bFound = True
;~             MsgBox(0,"","Starting Internet Sharing For: " & $objNCProps.name)
            If $bEnable Then
                $EveryConnection.EnableSharing(1)
            Else
                $EveryConnection.DisableSharing()
            EndIf
        EndIf
    Next
    $oConnectionCollection = $oNetSharingManager.EnumEveryConnection
    For  $oItem In $oConnectionCollection
        $EveryConnection = $oNetSharingManager.INetSharingConfigurationForINetConnection($oItem)
        $objNCProps = $oNetSharingManager.NetConnectionProps($oItem)
        If $objNCProps.name = $sPublicConnectionName Then
            $bFound = True
;~             MsgBox(0,"","Internet Sharing Success For: " & $objNCProps.name)
            If $bEnable Then
                $EveryConnection.EnableSharing(0)
            Else
                $EveryConnection.DisableSharing()
            EndIf
        EndIf
    Next
    Return $bFound
EndFunc


MsgBox(0,"",EnableDisableICS("YOUR ACTIVE NETWORK", "OUR ADAPTOR TO SHARE", True))
 

Saludos

.

1 person likes this

Share this post


Link to post
Share on other sites

Jaaaaaa

Thx @Danyfirex

Your code work perfect!!!!!

Now i will trying to find how to list all network now my idea is ok

Thanks every body so much

You are the best :D

And. Happy new year, man! xD

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

The code list all network here ($oConnectionCollection)  

You're wellcome. happy new year too.

if the topic is solved. mark as answered.

Saludos

Edited by Danyfirex

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

  • Similar Content

    • Nareshm
      By Nareshm
      Its Possible To auto Login with autoit script ?
    • Pintu
      By Pintu
      Good evening guys,
      i'm having a problem, not about the code (i'm only thinking about it at the moment) but about the way i can do it.
      I have a webpage (photo N.1) it has some elements in it.
      I need only the table (photo N.2), looking at the code and with _IEFunctions i can easy find the table but how i can i "copy" it?
      As i said it's really easy to found with a script but what should i do then? Copy the source? And how can i display it to the user?
      In my head i'd like to display it inside a GUI, is that possible?
       
      Thanks in advance
       
      Edit: Posted 2 times same photo. Now should be OK

       

    • badcoder123
      By badcoder123
      Anyone know how to access the information circled in the photo?
       

    • robcull
      By robcull
      Hello all! I have had some issues reading text from different types of windows, occasionally, specifically with controlgettext. 
      **Before I begin, I know there are better ways to do what I attempt in the example below. That's not the point of this post. The point is my issues with controlgettext. 
      I am about to cite an example with an application you may be familiar with called SpeedFan (v4.52). My problem is not specific to speedfan, it is simply the most recent and easily reproducible example I can think of. 
      So, the goal of the script below is to get a string of text containing the current fan RPMs from the highlighted control in the screenshot below (see "speedfan_control_details.png").

      Now, here's a simple script for grabbing the window handle and reading the text from that control: 
      $wintitle = "SpeedFan 4.52" $controlID = "197934" ;will be reformatted as "[ID:######]" $hwnd = wingethandle($wintitle) if @error<>0 then msgbox(0, "WinGetHandle", "FAILURE. @error="&@error) Exit EndIf $text = ControlGetText($hwnd, "", "[ID:"&$controlID&"]") if @error=1 then msgbox(0, "ControlGetText", "FAILURE. @error="&@error) ;failure returns "" and @error=1 Exit EndIf msgbox (0, "ControlGetText", "SUCCESS. @error="&@error &@CRLF& "$text="&$text) ;success returns string and @error=0 You'll see that the ControlGetText operation runs without error, however it does not capture any text from the control. If you explore the other controls in this one window, you'll find mixed results across the board. Neither the temps nor voltages can be read, while the log field and some other elements can be read. Even when you read the text from the whole window, those elements are not included in the visible nor hidden texts. 
       
      I have run into this issue many times in the past- inconsistencies in the ability of autoit to interact with certain controls. What is it which makes this text different than any other readable texts? Is there an alternate method of reading the text in the window/control which could work? Any and all info to help me solve this mystery and satisfy my curiosity would be greatly appreciated. 
      Thanks  -Rob C
      PS: Running Autoit v3.3.14.2 on Win7 Ultimate x64
    • Nareshm
      By Nareshm
      How can i add sleep command using internet speed.
      If my internet speed is 40-50Kbps then sleep for 5 seconds,
      If my internet speed is 30-40Kbps then sleep for 4 seconds,
      If my internet speed is 20-30Kbps then sleep for 3 seconds.

      *Sleep command used bitween my costom script, Example,
      RunWait("rasdial /disconnect", "", @SW_HIDE) ; Stop connect from start
      Sleep(5000)
      RunWait("rasdial Internet", "", @SW_HIDE) ; Connect again