O.O Posted September 9, 2005 Share Posted September 9, 2005 This is so simple problem, that it is hard to find help for it by searching "by hand". Truly tried I need to select nic from list and disable it, wait, then enable. This is what I got so far: reset-ip.au3 _____________________________________________________ ;Disable and enable nic to force ip-change in PPPoE -connection Run ("c:\Windows\System32\ncpa.cpl") ;metacode: ; ;Select nic ;Open File-menu or RightClick nic ;Click Disable ;Wait 3 seconds ;Open File-menu or RightClick nic ;Click Enable ;Wait 10 seconds ;Exit _____________________________________________________ Link to comment Share on other sites More sharing options...
BigDod Posted September 9, 2005 Share Posted September 9, 2005 (edited) See this threadEDITAlternatively you could use DOS commands "ipconfig /release" and "ipconfig /renew" with a sleep command between them. Edited September 9, 2005 by BigDod Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
O.O Posted September 9, 2005 Author Share Posted September 9, 2005 Thanks BigDod, exactly what I was looking for But I tried those, ipconfig did not work for me. And the script gives me: $oShell = ObjCreate("Shell.Application") $oShell = ^ERROR Error: Unknown function name. I made a script based on mousepositions I works, but the script by SumTingWong seemed like a thing that would work regardless of windowpositions. How could I modify to make the script from SumTingWong work for me? Please remember I am newbie about AutoIt. I am computerskilled tho Link to comment Share on other sites More sharing options...
Sunblood Posted September 9, 2005 Share Posted September 9, 2005 Download the latest beta. Look in the Developers board, topic "3.1.1++" Link to comment Share on other sites More sharing options...
O.O Posted September 10, 2005 Author Share Posted September 10, 2005 Thanks Sunblood, I downloaded the 3.1.1.75-beta. But I get the same error. That script seems to be only one function, not a whole autoit-script. Shouldn't I call that _ToggleConnection -function somehow somewhere? Don't I need something more before I can compile the final exe -file? Please dont rip your hair off because of my total lack of knowledge, my most sophisticated script is this Run ("c:\Windows\System32\Control.exe ncpa.cpl") Sleep(500) MouseClick("right", 753, 208) Sleep(500) MouseClick("left", 775, 211) Sleep(3000) MouseClick("right", 753, 208) Sleep(500) MouseClick("left", 775, 211) Link to comment Share on other sites More sharing options...
GaryFrost Posted September 10, 2005 Share Posted September 10, 2005 Thanks BigDod, exactly what I was looking for But I tried those, ipconfig did not work for me. And the script gives me:$oShell = ObjCreate("Shell.Application")$oShell = ^ERRORError: Unknown function name.I made a script based on mousepositions I works, but the script by SumTingWong seemed like a thing that would work regardless of windowpositions.How could I modify to make the script from SumTingWong work for me? Please remember I am newbie about AutoIt. I am computerskilled tho <{POST_SNAPBACK}>Make sure you running the beta and not the release versionMsgBox(0,"AutoIt Version", @AutoItVersion) SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference.  Link to comment Share on other sites More sharing options...
O.O Posted September 10, 2005 Author Share Posted September 10, 2005 I am making progress, no errors.Also I find the languagebarrier, because my ethernet connection is named"Ethernet-sovitin NVIDIA ulos"in XP sp2 finnish.I believe the part "Ethernet-sovitin" translates as "Local Area Connection". "NVIDIA ulos" is the name given to nic by me.Should I use"Ethernet-sovitin NVIDIA ulos" OR"Ethernet-sovitin"or is "Local Area Connection" internal name used by XP? And therefore I should not change it?There is also the line If $oFolderItem.Name = "Network Connections" Then For me, that is "Verkkoyhteydet"Here is modified script I try now without success, script is beta-converted and ran, also tried beta-running the script. Gives no feedback at all, not even in command prompt. Does not disconnect/disable nic.What else could I try?This seems to be quite a bit more difficult than I anticipated ___________________Orig. by SumTingWong ___________________AutoItSetOption("MustDeclareVars", 1)Dim $sEnableVerb = "En&able" Dim $sDisableVerb = "Disa&ble" ; Usage example_ToggleConnection("Ethernet-sovitin", $sDisableVerb)Func _ToggleConnection($sConnectionName, $sVerb) Local $oShell Local $oControlPanel Local $oFolderItem Local $oNetConnections Local $oConnectionItem Local $oLanConnection Local $oVerbItem Local $oVerb $oShell = ObjCreate("Shell.Application") $oControlPanel = $oShell.Namespace(3) For $oFolderItem In $oControlPanel.Items ; ConsoleWrite($oFolderItem.Name & @LF) ; Look up network connection folder name in control panel If $oFolderItem.Name = "Verkkoyhteydet" Then $oNetConnections = $oFolderItem.GetFolder ExitLoop EndIf Next If Not IsObj($oNetConnections) Then Return 0 For $oConnectionItem In $oNetConnections.Items ; ConsoleWrite($oConnectionItem.Name & @LF) If $oConnectionItem.Name = $sConnectionName Then $oLanConnection = $oConnectionItem ExitLoop EndIf Next If Not IsObj($oLanConnection) Then Return 0 For $oVerbItem In $oLanConnection.Verbs ; ConsoleWrite($oVerbItem.Name & @LF) If $oVerbItem.Name = $sVerb Then $oVerb = $oVerbItem ExitLoop EndIf Next If Not IsObj($oVerb) Then Return 0 $oVerb.DoIt(); Needs delay to allow action to complete Sleep(1000) Return 1EndFunc___________________Orig. by SumTingWong ___________________ Link to comment Share on other sites More sharing options...
jefhal Posted September 10, 2005 Share Posted September 10, 2005 But I tried those, ipconfig did not work for me. And the script gives me:Are you saying that ipconfig ran, but it did not reset the ip address, or are you saying that ipconfig failed to run?I use this code:runwait(@comspec & ' /k ' & "ipconfig /all","")You should be able to replace the word "all" with the word "release" and then "renew" (or variations of that for Win98, etc.)If that works you can replace the letter "k" with the letter "c" to make the dos window close, and you can add @sw_hide to make the dos window not pop up:runwait(@comspec & ' /c ' & "ipconfig /release","",@SW_HIDE) runwait(@comspec & ' /c ' & "ipconfig /renew","",@SW_HIDE) ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
O.O Posted September 10, 2005 Author Share Posted September 10, 2005 Are you saying that ipconfig ran, but it did not reset the ip address, or are you saying that ipconfig failed to run?This is my object:;Disable and enable nic to force ip-change in PPPoE -connectionI am saying, that release -> renew does not force new ip for PPPoE connection. ipconfig does function, it nullifies all ip addresses for my lan nic. But in the end, it doesn't reset PPPoE ip Link to comment Share on other sites More sharing options...
BigDod Posted September 10, 2005 Share Posted September 10, 2005 This is my object:;Disable and enable nic to force ip-change in PPPoE -connectionI am saying, that release -> renew does not force new ip for PPPoE connection. ipconfig does function, it nullifies all ip addresses for my lan nic. But in the end, it doesn't reset PPPoE ip <{POST_SNAPBACK}>Bing up a command prompt and enter ipconfig /all. If the adaptor that you wish to renew the ipaddress on shows up then ipconfig will work for you. Type in ipconfig /all and you will see the command line options. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
O.O Posted September 10, 2005 Author Share Posted September 10, 2005 Bing up a command prompt and enter ipconfig /all. If the adaptor that you wish to renew the ipaddress on shows up then ipconfig will work for you. Type in ipconfig /all and you will see the command line options.<{POST_SNAPBACK}>Yup, tried that. >ipconfig/release (PPPoE adapter)It said "DHCP is not in use for (PPPoE adapter)"If I do similar thing manually in Network Connections -window, it releases PPPoE ip, but after renewing the exact same ip comes back. I get a different ip only when I disable-enable physical nic. Or remove-attach cable ( <- AutoIt that!). Link to comment Share on other sites More sharing options...
BigDod Posted September 10, 2005 Share Posted September 10, 2005 Yup, tried that. >ipconfig/release (PPPoE adapter)It said "DHCP is not in use for (PPPoE adapter)"If I do similar thing manually in Network Connections -window, it releases PPPoE ip, but after renewing the exact same ip comes back. I get a different ip only when I disable-enable physical nic. Or remove-attach cable ( <- AutoIt that!).<{POST_SNAPBACK}>You could study up on netsh Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
jefhal Posted September 10, 2005 Share Posted September 10, 2005 Yup, tried that.One more thought on ipconfig, then I'll stop harping on it. That is, if you are using WinXP there are more ipconfig commands available to you. Some combination MIGHT work:From the ipconfig /? command:expandcollapse popupUSAGE: ipconfig [/? | /all | /renew [adapter] | /release [adapter] | /flushdns | /displaydns | /registerdns | /showclassid adapter | /setclassid adapter [classid] ] where adapter Connection name (wildcard characters * and ? allowed, see examples) Options: /? Display this help message /all Display full configuration information. /release Release the IP address for the specified adapter. /renew Renew the IP address for the specified adapter. /flushdns Purges the DNS Resolver cache. /registerdns Refreshes all DHCP leases and re-registers DNS names /displaydns Display the contents of the DNS Resolver Cache. /showclassid Displays all the dhcp class IDs allowed for adapter. /setclassid Modifies the dhcp class id. The default is to display only the IP address, subnet mask and default gateway for each adapter bound to TCP/IP. For Release and Renew, if no adapter name is specified, then the IP address leases for all adapters bound to TCP/IP will be released or renewed. For Setclassid, if no ClassId is specified, then the ClassId is removed. Examples: > ipconfig ... Show information. > ipconfig /all ... Show detailed information > ipconfig /renew ... renew all adapters > ipconfig /renew EL* ... renew any connection that has its name starting with EL > ipconfig /release *Con* ... release all matching connections, eg. "Local Area Connection 1" or "Local Area Connection 2" ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
jefhal Posted September 10, 2005 Share Posted September 10, 2005 If I do similar thing manually in Network Connections -window, it releases PPPoE ip, but after renewing the exact same ip comes back.JOOC, why do you expect a new IP address? Do you have two providers or are you just trying to lose the old ip and grab a new one? I thought an isp (or a router) would create a lease for you, and as long as your card had the same mac ID for the length of the lease, you'd always get the same ip address back. Conversely, I wonder why the ip address IS renewed by just disabling the card? You aren't changing the mac id also, are you? ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
BigDod Posted September 10, 2005 Share Posted September 10, 2005 JOOC, why do you expect a new IP address? Do you have two providers or are you just trying to lose the old ip and grab a new one? I thought an isp (or a router) would create a lease for you, and as long as your card had the same mac ID for the length of the lease, you'd always get the same ip address back. Conversely, I wonder why the ip address IS renewed by just disabling the card? You aren't changing the mac id also, are you?<{POST_SNAPBACK}>I am still trying to figure out the need for a new ip address, I just wish my provider would give me a static one. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
jefhal Posted September 10, 2005 Share Posted September 10, 2005 I am still trying to figure out the need for a new ip address, I just wish my provider would give me a static one.<{POST_SNAPBACK}>IP addresses are a limited commodity for which an ISP pays dearly. Therefore, unless you want to pay a higher monthly fee for a fixed IP address you have to live with shared ones. When your ISP thinks you are done with yours, they pass it along to the next customer who needs one. That way, they only need X unique ip addresses, not Y (where Y = the number of customers they have). Simple economics. If you want to "pretend' to have a fixed IP you could use a service like no-ip. However, instead of having an ip octet you'd have an address like: www.no-ip.BigDod. That would create yet another set of issues for you possibly... ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
O.O Posted September 10, 2005 Author Share Posted September 10, 2005 JOOC, why do you expect a new IP address? Do you have two providers or are you just trying to lose the old ip and grab a new one? I thought an isp (or a router) would create a lease for you, and as long as your card had the same mac ID for the length of the lease, you'd always get the same ip address back. Conversely, I wonder why the ip address IS renewed by just disabling the card? You aren't changing the mac id also, are you?<{POST_SNAPBACK}>"JOOC"?I wonder if you are taking me for someone else, but no matter.I have one provider and dynamic ip. No need to change mac/nic, and it does not help either! I did try that too (mobo with 2 ethernet adapters, possibly changeable mac).Ip's are "free game" in this net, as in who ever enters the net, grabs random/next ip. For some reason, there seems to be 2 ip's reserved for a single computer. That is, if I change ip twice, I end up with the first ip. Rarely I get a third ip, possibly because somebody just entered the net and got "my other ip".Simply put, when PPPoE connection is interrupted, isp gives me a different ip. Why that is, I do not know.And why I need another ip, never mind that I must addmit, I am extremely surprised AutoIt doesn't have given tools to handle simple windows and their contents. No matter, I rather enjoy learning new things. I'll look into netsh -stuff If I seriously need it/got some extra time. It does seem interesting. For now, I manage with my extremely sophisticated mouseclick -script Simple command that would disable/enable hardware would be perfect for my needs, but only thing close to it I know, is Recovery Console's services -commands. And they surely do not help. Also any way to interrupt lanconnection would do (which firewall software could give AutoIt-compatible disconnection-reconnection operation?) Link to comment Share on other sites More sharing options...
jefhal Posted September 10, 2005 Share Posted September 10, 2005 "JOOC"?JOOC was "Just Out Of Curiosity"Thanks for filling me in on the rationale for the script. As to why some things are in AutoIT and some are not, I think the things that are "in" are things that were dictated by need. The things that are "not" are those things that not many people have asked for. In addition, the things that are not in are those things for which there are no volunteers to help write the code. To me, learning AutoIT is like putting a fire hose to your mouth. I can't possibly keep up with the new things that are coming out. Finally, I made a script a while back that uses the brute force method to apply fixed IP addresses to our school's laptop computers. It opens the network card's properties page and enters the new ip addresses, dns servers, etc. based on a file containing the machine names and assigned ip's. Your script shouldn't be any more difficult, I hope. ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now