AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

change ip
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
azure



Joined: 07 Jun 2007
Posts: 296

PostPosted: Thu Jun 28, 2007 4:02 am    Post subject: change ip Reply with quote

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
Back to top
View user's profile Send private message
aCkRiTe



Joined: 21 Jul 2006
Posts: 502

PostPosted: Thu Jun 28, 2007 4:13 am    Post subject: Reply with quote

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....
Back to top
View user's profile Send private message
Travley



Joined: 13 May 2007
Posts: 48

PostPosted: Thu Jun 28, 2007 4:14 am    Post subject: Reply with quote

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 Wink hehe
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2558
Location: Australia, Qld

PostPosted: Thu Jun 28, 2007 8:42 am    Post subject: Reply with quote

Alternatively,
Code:
RunWait, ipconfig /release,, Hide
RunWait, ipconfig /renew,, Hide
Wink

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, Laughing

Has anyone verified if this actually works for dial-up connections?
Back to top
View user's profile Send private message
NotLoggedIn-Conquer
Guest





PostPosted: Thu Jun 28, 2007 11:59 pm    Post subject: Reply with quote

Its not working for my dial up.
Back to top
azure



Joined: 07 Jun 2007
Posts: 296

PostPosted: Fri Jun 29, 2007 1:23 am    Post subject: Reply with quote

it doesnt working for my adsl
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2558
Location: Australia, Qld

PostPosted: Fri Jun 29, 2007 2:45 am    Post subject: Reply with quote

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).
Back to top
View user's profile Send private message
NotLoggedIn-Conquer
Guest





PostPosted: Fri Jun 29, 2007 4:10 pm    Post subject: Reply with quote

With my dial-up, the IP address usually changes every disconnect/reconnect.
Back to top
NotLoggedIn-Conquer
Guest





PostPosted: Fri Jun 29, 2007 4:20 pm    Post subject: Reply with quote

& @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
Back to top
azure



Joined: 07 Jun 2007
Posts: 296

PostPosted: Wed Jul 04, 2007 2:22 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 1339

PostPosted: Wed Jul 04, 2007 2:31 am    Post subject: Reply with quote

Have you tried this script?
http://www.autohotkey.com/forum/topic18720.html
Back to top
View user's profile Send private message
ggirf14



Joined: 01 Nov 2005
Posts: 96
Location: Ottawa

PostPosted: Wed Jul 04, 2007 3:43 am    Post subject: Reply with quote

Why do you need to change IP address?
Back to top
View user's profile Send private message
Grumpy
Guest





PostPosted: Wed Jul 04, 2007 3:37 pm    Post subject: Reply with quote

Perhaps to continue doing some bad job after its IP address has been blocked... Sad
Back to top
IPRefreshhh
Guest





PostPosted: Tue Sep 18, 2007 4:30 pm    Post subject: Reply with quote

Came with console window but work.
speedy=your connection
user=user Very Happy
pasword=password Very Happy

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



Joined: 07 Jun 2007
Posts: 296

PostPosted: Wed Mar 05, 2008 1:38 am    Post subject: Reply with quote

thanks !

but, does this work for ethernet connections?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group