 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Rhys
Joined: 17 Apr 2007 Posts: 710 Location: Florida
|
Posted: Wed Mar 05, 2008 5:54 pm Post subject: [Basic] IP Helper - GUI to Release/Renew & Get External |
|
|
This utility will allow non-technical users (and lazy advanced users) some easy access to common IP-related tasks via a small GUI.
Thanks to SKAN for helping me with my issue of runwait not passing all my parameters. Thanks to silveredge78 for giving me the idea.
Please note, this is geared towards simplicity and that there is a much less basic IP tool by aCkRiTe here .
External IP address functionality is gathered via WhatIsMyIP.com.
| Code: | #SingleInstance, Force
#NoEnv
TempFile=%A_Temp%\ip_temp.txt
Gui, Add, Groupbox, w100 h100,IP Address:
Gui, Add, Text, vIPList x20 yp+15 r4 w85
Gui, Add, Button, gGetIP w50, Refresh
Gui, Add, Button, gIPInfo w30 yp x+2, Info
Gui, Add, Button, gReleaseIP +Section y10, Release IP
Gui, Add, Button, gRenewIP y+0 wp xs, Renew IP
Gui, Add, Button, gFlushDNS y+0 wp xs, Flush DNS
Gui, Add, Button, gGetExternalIP y+0 wp xs, External IP
Gui, Show, ,IP Helper
GoSub, GetIP
Return
RenewIP:
SplashTextOn, , 20,Working, Renewing IP
RunWait %comspec% /c "ipconfig /renew > %TempFile%",,Hide
SplashTextOff
GoSub, GetIP
GoSub, GetDetails
Return
ReleaseIP:
SplashTextOn, , 20,Working, Releasing IP
RunWait %comspec% /c "ipconfig /release > %TempFile%",,Hide
SplashTextOff
GoSub, GetIP
GoSub, GetDetails
Return
FlushDNS:
SplashTextOn, , 20,Working, Flushing DNS
RunWait %comspec% /c "ipconfig /flushdns > %TempFile%",,Hide
SplashTextOff
GoSub, GetDetails
Return
GetExternalIP:
SplashTextOn, , 20,Working, Getting External IP
URLDownloadToFile, http://whatismyip.com/automation/n09230945.asp, %TempFile%
SplashTextOff
FileRead, detail, %A_Temp%\ip_temp.txt
If (StrLen(detail) > 15) ;Yeah, I still need to learn RegEx.
{
FileDelete, %TempFile%
FileAppend, ERROR, %TempFile%
}
GoSub, GetDetails
Return
IPInfo:
SplashTextOn, , 20,Working, Getting IP Info
RunWait %comspec% /c "ipconfig.exe > %TempFile%",,Hide
SplashTextOff
GoSub, GetDetails
Return
GetIP:
SplashTextOn, , 20,Working, Getting IP List
IPList=
(
%A_IPAddress1%
%A_IPAddress2%
%A_IPAddress3%
%A_IPAddress4%
)
GuiControl, , IPList,%IPList%
SplashTextOff
Return
GetDetails:
FileRead, detail, %A_Temp%\ip_temp.txt
FileDelete, %A_Temp%\ip_temp.txt
StringReplace, detail, detail, `r`n, , all
Msgbox, ,Details, %detail%
Return
GuiClose:
ExitApp |
_________________ [Join IRC!]
 |
|
| Back to top |
|
 |
Altober
Joined: 16 Jul 2008 Posts: 3 Location: Argentina
|
Posted: Wed Jul 16, 2008 2:25 am Post subject: |
|
|
Hi, simply for offer my thanks for you great script. Is very useful!
Question, is possible add code for send IP data to clipboard? |
|
| Back to top |
|
 |
tidbit
Joined: 10 Mar 2008 Posts: 86
|
Posted: Wed Jul 16, 2008 3:55 am Post subject: |
|
|
Since this is bumped up I guess i will say thanks as well.
even though i pm'd you awhile ago asking if i could use it in my "commando" script.
soooo....thanks again _________________ rawr. be very affraid |
|
| Back to top |
|
 |
Rhys
Joined: 17 Apr 2007 Posts: 710 Location: Florida
|
Posted: Wed Jul 16, 2008 1:05 pm Post subject: |
|
|
@Altober - I'm happy you found it useful - If you'd like the IP info added to the clipboard, add the red line below into the 'GetDetails' sub: | Code: | GetDetails:
FileRead, detail, %A_Temp%\ip_temp.txt
FileDelete, %A_Temp%\ip_temp.txt
StringReplace, detail, detail, `r`n, , all
Clipboard:=detail ;This will put the data into the clipboard
Msgbox, ,Details, %detail%
Return | @Tidbit - Thanks! _________________ [Join IRC!]
 |
|
| Back to top |
|
 |
Altober
Joined: 16 Jul 2008 Posts: 3 Location: Argentina
|
Posted: Wed Jul 16, 2008 10:47 pm Post subject: |
|
|
| Rhys wrote: | @Altober - I'm happy you found it useful - If you'd like the IP info added to the clipboard, add the red line below into the 'GetDetails' sub: | Code: | GetDetails:
FileRead, detail, %A_Temp%\ip_temp.txt
FileDelete, %A_Temp%\ip_temp.txt
StringReplace, detail, detail, `r`n, , all
Clipboard:=detail ;This will put the data into the clipboard
Msgbox, ,Details, %detail%
Return |
|
Many Thanks, Rhys.
Finally, after I learned a little about AutoHotkey, I added a button to copy all the data to the clipboard, and another button that causes appears radio buttons by each IP, so that the user can copy each one in individual way (with balloon TrayTip notice).
It, is ONLY for private use, by no means I will divulge your script modified.
Thanks, again. |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1202 Location: USA
|
Posted: Thu Jul 17, 2008 4:29 am Post subject: |
|
|
| Altober wrote: |
It, is ONLY for private use, by no means I will divulge your script modified. |
ahhh...just put the following at the beginning...
| Code: | ; origional code by Rhys on ahk forum
; see the following post:
; http://www.autohotkey.com/forum/viewtopic.php?t=29332
; modified by Altober
|
if someone didn't want you to use their codez, they shouldn't post it on the forum. that is the wonderful thing about open source. you are normally allowed to modify and use as you wish....however, it is only respectful to provide link to the origional code as well as notify the author. _________________
 |
|
| Back to top |
|
 |
Altober
Joined: 16 Jul 2008 Posts: 3 Location: Argentina
|
Posted: Thu Jul 17, 2008 7:00 am Post subject: |
|
|
| ahklerner wrote: |
| Code: | ; origional code by Rhys on ahk forum
; see the following post:
; http://www.autohotkey.com/forum/viewtopic.php?t=29332
; modified by Altober
|
if someone didn't want you to use their codez, they shouldn't post it on the forum. that is the wonderful thing about open source. you are normally allowed to modify and use as you wish....however, it is only respectful to provide link to the origional code as well as notify the author. |
Of course, is not my idea to steal absolutely nothing.
I have a lot of respect by the people that works, and decides to share its work with the others.
I did not publish my modifications because not yet I have finished it.
At any rate, already had placed the name of the author (Rhys) in the first line of the code. : D
Thanks. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|