Differences

This shows you the differences between two versions of the page.

Link to this comparison view

autoitipaddr [2014/10/26 01:52] (current)
Line 1: Line 1:
 +== AutoIt add IP Address to hosts file==
 +<​code>​
 +
 +# UpdateHost.au3
 +
 +#include <​GUIConstants.au3>​
 +#include <​Constants.au3>​
 +
 +host_file()
 +
 +Func host_file()
 +    $Prompt = "​Server IP Address"​
 +    $Server = "​Default"​
 +    $IPADDRESS = InputBox("​IP Setup",​ "What is the IP address of the your server?"​ & @CRLF & "If the Server address hasn't changed, click '​Cancel'",​ $Prompt, "",​ _
 + -1, 157, 300, 300)
 +    $HostName = InputBox("​Hostname",​ "What is the Hostname of your server?"​ & @CRLF & "You have to specify a hostname",​ $Server, "",​ _
 +        -1, 157, 300, 300)
 +    ​
 +    If @error <> 1 Then
 +        If StringCompare($Prompt,​ $IPADDRESS) > 0 OR StringCompare($Prompt,​ $IPADDRESS) < 0 Then
 +     $OPENHOSTS = FileOpen("​C:​\WINDOWS\system32\drivers\etc\hosts",​ 1)
 +     FileWrite($OPENHOSTS,​ $IPADDRESS & @TAB & $Server & @CRLF)
 +     FileClose($OPENHOSTS)
 + Endif
 +    EndIf
 +EndFunc
 +</​code>​
 +
 +----
 +
 +  * [[autoit3|Back to AutoIt]]
  
autoitipaddr.txt ยท Last modified: 2014/10/26 01:52 (external edit)
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0