Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.
Const ForWriting = 2 Const TristateUseDefault = -2 Const OverWrite = True Set objIE = CreateObject("InternetExplorer.Application") Set fso = CreateObject("Scripting.FileSystemObject") objIE.Navigate("http://www.mvps.org/winhelp2002/hosts.txt") Do Until objIE.ReadyState = 4 WScript.Sleep 100 Loop objIE.document.parentwindow.clipboardData.SetData "text", objIE.document.body.Innertext Set f = fso.GetFile("c:\windows\system32\drivers\etc\HOSTS") If f.Attributes = f.Attributes AND 1 Then f.Attributes = f.Attributes XOR 1 End If If f.Attributes = f.Attributes AND 2 Then f.Attributes = f.Attributes XOR 2 End If If f.Attributes = f.Attributes AND 4 Then f.Attributes = f.Attributes XOR 4 End If Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault) ts.Write objIE.Document.ParentWindow.ClipboardData.GetData("text") f.Attributes = f.Attributes XOR 1 f.Attributes = f.Attributes XOR 2 f.Attributes = f.Attributes XOR 4 ts.Close objIE.Quit Set objIE = Nothing