alexbiz
Joined: 18 Sep 2009 Posts: 4 Location: Montreal
|
Posted: Fri Sep 18, 2009 8:14 pm Post subject: IP Helper redesign |
|
|
Hi everybody,
This is my first post here so I would like to say hello to everybody.
My friend show me this community a couple week ago and I started to read topics all over the forum since yesterday. I found a very interesting script from Rhys who has been post in 2008 but I wanted to add a couple of functions like flush dns, register dns, arp listing and arp removing. I also added a clipboard so you can copy // paste the info wherever you want!
So here it is:
| Code: |
; origional code by Rhys on ahk forum
; modified by Altober
; modified and re-design by: alexbiz35 on ahk forum
; see the following post:
; http://www.autohotkey.com/forum/viewtopic.php?p=297142#297142
; http://www.autohotkey.com/forum/viewtopic.php?t=29332
#SingleInstance, Force
#NoEnv
TempFile=%A_Temp%\ip_temp.txt
;***************************
;Groupbox, text & textbox
;***************************
Gui, Add, GroupBox, x6 y0 w320 h370 , Status
Gui, Add, Text, x16 y20 w120 h20 , Clipboard:
Gui, Add, Edit, x16 y40 w300 h320 vIPList,
;***************************
;Buttons
;***************************
Gui, Add, Button, x6 y380 w70 h30 Grefresh, Refresh
Gui, Add, Button, x86 y380 w70 h30 Grelease, Ip release
Gui, Add, Button, x166 y380 w70 h30 Grenew, Ip renew
Gui, Add, Button, x246 y380 w70 h30 Garplist, ARP Listing
Gui, Add, Button, x6 y420 w70 h30 Gpublicip , Public Ip
Gui, Add, Button, x86 y420 w70 h30 Gregdns , Reg DNS
Gui, Add, Button, x166 y420 w70 h30 Gflushdns , Flush DNS
Gui, Add, Button, x246 y420 w70 h30 Gdeletearp , Delete ARP
Gui, Add, Button, x336 y190 w70 h30 Gexit, Exit
; Generated using SmartGUI Creator 4.0
Gui, Show, x131 y91 h455 w419, Basic Network Function Helper
GoSub, renew
Return
;***************************
;Functions
;***************************
refresh:
SplashTextOn, ,40,Working, Getting ip address
RunWait %comspec% /c "ipconfig /all > %TempFile%",,Hide
SplashTextOff
GoSub, ipconfig
Return
release:
SplashTextOn, ,40,Working, releasing ip address
RunWait %comspec% /c "ipconfig /release > %TempFile%",,Hide
SplashTextOff
GoSub, ipconfig
Return
renew:
SplashTextOn, ,40,Working, renewing ip address
RunWait %comspec% /c "ipconfig /renew > %TempFile%",,Hide
SplashTextOff
GoSub, ipconfig
Return
arplist:
SplashTextOn, ,40,Working, Getting ARP table
RunWait %comspec% /c "arp -a > %TempFile%",,Hide
SplashTextOff
GoSub, ipconfig
Return
publicip:
SplashTextOn, , 20,Working, Getting public ip
URLDownloadToFile, http://whatismyip.com/automation/n09230945.asp, %TempFile%
SplashTextOff
FileRead, detail, %A_Temp%\ip_temp.txt
If (StrLen(detail) > 15)
{
FileDelete, %TempFile%
FileAppend, ERROR, %TempFile%
}
GoSub, ipconfig
Return
regdns:
SplashTextOn, ,40,Working, Register DNS
RunWait %comspec% /c "ipconfig /registerdns > %TempFile%",,Hide
SplashTextOff
GoSub, ipconfig
Return
flushdns:
SplashTextOn, ,40,Working, Flushing DNS...
RunWait %comspec% /c "ipconfig /flushdns > %TempFile%",,Hide
SplashTextOff
GoSub, ipconfig
Return
deletearp:
SplashTextOn, ,40,Working, Delete ARP table
RunWait %comspec% /c "arp -d > %TempFile%",,Hide
SplashTextOff
GoSub, ipconfig
Return
ipconfig:
SplashTextOn, ,40,Working, Getting ip address
FileRead, detail, %A_Temp%\ip_temp.txt
FileDelete, %A_Temp%\ip_temp.txt
GuiControl, , IPList,%detail%
SplashTextOff
Return
exit:
ExitApp
GuiClose:
ExitApp
|
Feel free to comments any suggestion or things to improve. I usually don't like scripting but since I found ahk, I could say I started loving it!
Sorry for any english mistake, it's friday afternoon and I'm tired! |
|