Posted: 11/23/2004 8:17:07 AM EDT
|
I have the followng file that I modified. It all works except I know the double quotes in the line statements are wrong and I do not know what to replace them with and it only writes one line. I do not know j script at all but I have done some vb in the past. This file should create a file redirect.html that will redirect to my homepage. var line = new String(); var ip_address = new String(); WshShell = WScript.CreateObject("WScript.Shell"); fs = new ActiveXObject("Scripting.FileSystemObject"); hfile = fs.OpenTextFile("C:\TROSS.TXT", 1); while (!hfile.AtEndOfStream) { line = hfile.ReadLine(); if (line.indexOf("accepted") > 1) { ip_address = line.substr(line.indexOf("Host")+5,line.indexOf("accepted")-1-(line.indexOf("Host")+5)); }; }; hfile.Close(); hfile = fs.OpenTextFile("C:\REDIRECT.HTML", 2, -1); line = "<HTML>" line = "<HEAD>" line = "<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">" line = "<meta http-equiv="refresh" content="1; URL=http:" + ip_address + "/pictures;">" hfile.WriteLine(line); hfile.Close(); Any help would be great....thanks |
| This is called from a batch file. What the whole thing does is to get my IP address from my provider at home and write it to a file tross.txt. The java script strips out the IP address from that file and writes a file called redirect.html. This file will be copyed to my personal web space on my provider. This proccess will repeat every day. I do not have a static IP so this way I can get around it. I have a working version and it works fine but it does not redirect so I added the redirect to the java file but i do not know the syntax in java to handle the quotes in the line I need to write. |