GrungeRocker Posted February 18, 2006 Share Posted February 18, 2006 Hi i need to update my HOST-File every day and i thought, wy shouldn't autoit do this...but i have a prob.i only wanna 4 lines to be updated and the others should be normal....how is this possible?the host-file:# Copyright (c) 1993-1999 Microsoft Corp. # # Dies ist eine HOSTS-Beispieldatei, die von Microsoft TCP/IP # für Windows 2000 verwendet wird. # # Diese Datei enthält die Zuordnungen der IP-Adressen zu Hostnamen. # Jeder Eintrag muss in einer eigenen Zeile stehen. Die IP- # Adresse sollte in der ersten Spalte gefolgt vom zugehörigen # Hostnamen stehen. # Die IP-Adresse und der Hostname müssen durch mindestens ein # Leerzeichen getrennt sein. # # Zusätzliche Kommentare (so wie in dieser Datei) können in # einzelnen Zeilen oder hinter dem Computernamen eingefügt werden, # aber müssen mit dem Zeichen '#' eingegeben werden. # # Zum Beispiel: # # 102.54.94.97 rhino.acme.com # Quellserver # 38.25.63.10 x.acme.com # x-Clienthost 127.0.0.1 localhost 84.137.129.139 L2authd.lineage2.com 84.137.129.139 nprotect.lineage2.com 84.137.129.139 update.nprotect.com 84.137.129.139 update.nprotect.netlines that shoud be updated:84.137.129.139 L2authd.lineage2.com 84.137.129.139 nprotect.lineage2.com 84.137.129.139 update.nprotect.com 84.137.129.139 update.nprotect.net [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
greenmachine Posted February 18, 2006 Share Posted February 18, 2006 Pseudocode idea: Inetget (or whatever method is best) the file Save the file to Orig.txt _FileReadToArray Orig.txt For $i = 1 to $Array[0] - 4 Get line and write to new.txt next change last 4 lines in $array write those new lines to new.txt Upload new.txt as whatever the filename needs to be. Link to comment Share on other sites More sharing options...
GrungeRocker Posted February 18, 2006 Author Share Posted February 18, 2006 (edited) hmmmmm yes..... well thx that should work Edited February 18, 2006 by Analritter [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
GaryFrost Posted February 18, 2006 Share Posted February 18, 2006 maybe something like Dim $host_file = "hostfile.txt" Dim $new_data1 = "84.137.129.139 L2authd.lineage2.com" Dim $new_data2 = "84.137.129.139 nprotect.lineage2.com" Dim $new_data3 = "84.137.129.139 update.nprotect.com" Dim $new_data4 = "84.137.129.139 update.nprotect.net" Dim $backup_file = "hostfile-" & @YEAR & "_" & @MDAY & "_" & @MON & "_" & @HOUR & "_" & @MIN & ".bak" Dim $Host_data = "# Copyright (c) 1993-1999 Microsoft Corp." & @CRLF & _ "#" & @CRLF & _ "# Dies ist eine HOSTS-Beispieldatei, die von Microsoft TCP/IP" & @CRLF & _ "# für Windows 2000 verwendet wird." & @CRLF & _ "#" & @CRLF & _ "# Diese Datei enthält die Zuordnungen der IP-Adressen zu Hostnamen." & @CRLF & _ "# Jeder Eintrag muss in einer eigenen Zeile stehen. Die IP-" & @CRLF & _ "# Adresse sollte in der ersten Spalte gefolgt vom zugehörigen" & @CRLF & _ "# Hostnamen stehen." & @CRLF & _ "# Die IP-Adresse und der Hostname müssen durch mindestens ein" & @CRLF & _ "# Leerzeichen getrennt sein." & @CRLF & _ "#" & @CRLF & _ "# Zusätzliche Kommentare (so wie in dieser Datei) können in" & @CRLF & _ "# einzelnen Zeilen oder hinter dem Computernamen eingefügt werden," & @CRLF & _ "# aber müssen mit dem Zeichen '#' eingegeben werden." & @CRLF & _ "#" & @CRLF & _ "# Zum Beispiel:" & @CRLF & _ "#" & @CRLF & _ "# 102.54.94.97 rhino.acme.com # Quellserver" & @CRLF & _ "# 38.25.63.10 x.acme.com # x-Clienthost" & @CRLF & @CRLF & _ "127.0.0.1 localhost" & @CRLF & _ $new_data1 & @CRLF & _ $new_data2 & @CRLF & _ $new_data3 & @CRLF & _ $new_data4 & @CRLF FileMove ($host_file, $backup_file) FileWrite($host_file, $Host_data) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
cdkid Posted February 18, 2006 Share Posted February 18, 2006 why not look at _FileWriteToLine in my sig? ~cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
Confuzzled Posted February 20, 2006 Share Posted February 20, 2006 (edited) I'm curious as to what legitimate needs you would be pointing German IP addresses to South Korean DNS entries?Quote from the nprotect website:nProtect is a new conceptweb-based anti-hacking & anti virus utility tool designed to protect PCterminals from being infected by viruses or hacking tools. It helps to ensure that all information entered into thePCterminals from being infected by viruses or hacking tools.It helps to ensure that all information entered into the PC terminals during web access will not fall into the hands of hackers. Edited February 20, 2006 by Confuzzled Link to comment Share on other sites More sharing options...
erebus Posted June 6, 2006 Share Posted June 6, 2006 You are probably not a Lineage II player, that's why you say that. Changing these entries in the HOSTS file is a common practice for players that want to bypass the connectivity to the official game server and use other private (and free) servers to play. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now