AutoHotkey Community

It is currently May 25th, 2012, 4:08 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: change ip
PostPosted: June 28th, 2007, 4:02 am 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
hello

I would like a hotkey to disconnect me from the internet, wait 3 seconds and reconnect, in order to change ip

is it possible?

thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 28th, 2007, 4:13 am 
Offline

Joined: July 21st, 2006, 6:13 am
Posts: 558
This uses the WinKey+r as the hotkey, but of course can be changed...

Code:
#r::
RunWait, %comspec% /c ipconfig/release, , Hide
RunWait, %comspec% /c ipconfig/renew, , Hide
Return



HTH....


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 28th, 2007, 4:14 am 
Offline

Joined: May 13th, 2007, 5:40 pm
Posts: 47
Code:
RunWait %comspec% /c ipconfig.exe /release
Sleep,  3000
RunWait %comspec% /c ipconfig.exe /renew


Quote:
The COMSPEC variable

SET COMSPEC=C:\DOS\COMMAND.COM

COMSPEC specifies the secondary command interpreter.
This need not be COMMAND.COM.
One example of a different command interpreter is JP Software's 4DOS.COM.
Replace COMMAND /C with %COMSPEC% /C if you do not know for sure which command interpreter will be used.


lol got beat to it ;) hehe


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 28th, 2007, 8:42 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
Alternatively,
Code:
RunWait, ipconfig /release,, Hide
RunWait, ipconfig /renew,, Hide
;)

ipconfig is a program, rather than a command built into command prompt, so it doesn't require %comspec%. Btw, that quote is a bit outdated... %comspec% typically points to cmd.exe on NT-based systems.

DOS, :lol:

Has anyone verified if this actually works for dial-up connections?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 28th, 2007, 11:59 pm 
Its not working for my dial up.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 29th, 2007, 1:23 am 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
it doesnt working for my adsl


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 29th, 2007, 2:45 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
I thought as much. How do you disconnect/reconnect manually? Does your IP address necessarily change if you do that?

The only (software) way to restart my ADSL router, for instance, is through the web interface. I haven't got the first clue how to automate web pages/javascript.

Edit: For dial-up in Win2k/XP, I think you could use rasdial. Using the examples at that link,
Code:
; replace "EAST OFFICE" with "The Name Of Your Connection"
RunWait, rasdial "EAST OFFICE" /d   ; disconnect
RunWait, rasdial "EAST OFFICE"   ; reconnect

For Win9x, try rnaui.dll (VBScript example).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 29th, 2007, 4:10 pm 
With my dial-up, the IP address usually changes every disconnect/reconnect.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 29th, 2007, 4:20 pm 
& @lexikos

Code works fine with disconnecting, but using the connecting code, it needs the username and password to be specified.

To connect with username/password:
Code:
 ; Replace EAST OFFICE, Username and Password with your info
RunWait, rasdial "EAST OFFICE" Username Password   ; reconnect


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 4th, 2007, 2:22 am 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
lexikos wrote:
How do you disconnect/reconnect manually? Does your IP address necessarily change if you do that?


I manually disconnect by double clicking on the connection tray icon and then click "disconnect" on its tab

then I wait 5 seconds

then I reconnect by clicking the shortcut on the desktop

it changes ip in most cases

how can I do all these with a hotkey?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 4th, 2007, 2:31 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Have you tried this script?
http://www.autohotkey.com/forum/topic18720.html


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 4th, 2007, 3:43 am 
Offline

Joined: November 1st, 2005, 6:38 pm
Posts: 114
Location: Ottawa
Why do you need to change IP address?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 4th, 2007, 3:37 pm 
Perhaps to continue doing some bad job after its IP address has been blocked... :(


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 18th, 2007, 4:30 pm 
Came with console window but work.
speedy=your connection
user=user :D
pasword=password :D

Code:
F12::
RunWait, %comspec% /k rasdial speedy /DISCONNECT & rasdial speedy user password  & exit


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 5th, 2008, 1:38 am 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
thanks !

but, does this work for ethernet connections?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: 0x150||ISO, BrandonHotkey, Hodofca, Pulover, rbrtryn, sks, vsub, Yahoo [Bot] and 19 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group