Current location: Hot Scripts Forums » General Web Coding » JavaScript » Need Help w/Jscript


Need Help w/Jscript

Reply
  #1 (permalink)  
Old 01-19-04, 05:36 PM
bearstats bearstats is offline
New Member
 
Join Date: Jan 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Need Help w/Jscript

Here is what I have so far. What I'm trying to do is edit a large multipage *.PS file. %%BeginDocument is the top of the page and %%Trailer is bottom of the page. What I need is for the script to copy every thing betten the top and bottom of the page and out put it as a seperate file.

Any ideas. Please help me out Thx.



var source_file_folder = ("C:\\scripting\\"); //Set to your own file structure
var source_file_name_base = ("31286");
var source_file_name_extension = (".PS");
var output_file_name = ("addresslist.txt");
var input_line;
var page = true;
var d = new Date();
var count = 0;

var line_test = /^%%BeginDocument/

FSO = new ActiveXObject("Scripting.fileSystemObject");
var log_file = FSO.CreateTextFile(source_file_folder + "log.txt", true);

var output_file = FSO.CreateTextFile(source_file_folder + output_file_name, true);

var input_file = FSO.GetFile(source_file_folder + source_file_name_base + source_file_name_extension);
var input_file_stream = input_file.OpenAsTextStream(1);
input_line = input_file_stream.ReadLine();

do
{
input_line = input_file_stream.ReadLine();
if (line_test.test(input_line))
{
output_file.Writeline(input_line);
count++;
} else {
}
}
while (!input_file_stream.AtEndOfStream);

log_file.Writeline("Total records with bad addresses: " + count);

input_file_stream.Close();
output_file.Close();
log_file.Close();
WScript.Echo("All Done");
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 06:36 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.