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 

IP Helper redesign

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
alexbiz



Joined: 18 Sep 2009
Posts: 4
Location: Montreal

PostPosted: Fri Sep 18, 2009 8:14 pm    Post subject: IP Helper redesign Reply with quote

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!
Back to top
View user's profile Send private message MSN Messenger
shajul



Joined: 15 Sep 2006
Posts: 564

PostPosted: Sat Sep 19, 2009 9:42 am    Post subject: Welcome to AHK Reply with quote

Welcome to AHK mate!

Great community with everybody ready to help each other out.. And scripting will be a breeze with AHK..

Enjoy your stay.

Oh, and by the way, thanks for the script.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
alexbiz



Joined: 18 Sep 2009
Posts: 4
Location: Montreal

PostPosted: Mon Sep 21, 2009 12:13 pm    Post subject: Reply with quote

Thanks Smile
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
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