Hi Dan, I did as you suggested heres what I have:

// OnJobStart rule to repeat records



var RepeatFieldName = "Repeat Count";  // EDIT THIS

var FieldDelimiter = ",";  // EDIT THIS ("\t" for tab-delimited)



var orginputfilename = FusionPro.Composition.inputFileName;



// For composition, the original name is set,

// and the new name must be specified as an HFS path on Mac.

// EDIT THIS



var newfilename = "/Macintosh HD/Users/admin/Desktop/Jobs/Business Card
Repeat/tempout.txt";



if (FusionPro.inValidation)

{



// For composition, both names must be specified as POSIX paths on Mac.



  // EDIT THIS



orginputfilename = "/Macintosh HD/Users/admin/Desktop/Jobs/Business Card
Repeat/Instance.TXT";



  // EDIT THIS



newfilename = "/Macintosh HD/Users/admin/Desktop/Jobs/Business Card
Repeat/tempout.txt";



}



// DO NOT EDIT BELOW THIS LINE



var sf = new ExternalDataFileEx(orginputfilename, FieldDelimiter);

if (!sf.valid)

  throw("Unable to open ExternalDataFile: " + orginputfilename);



var of = new File(newfilename);



//of.remove();

if (of.open("create") == false)

  throw("Could not create output file.");

of.close();



if (of.open("write") == false)

  throw("Could not write output file.");



for (var i=0;i<sf.fieldCount;i++)

{

  if (i)

    of.write(FieldDelimiter);

  of.write(sf.GetFieldValue(0, i));

}

of.write("\r\n");



var NewInputTotalRecords = 0;

for (var i = 0 ; i <= sf.recordCount; i++)

{

 var startval = 1;

 var repeatcount = Int(sf.GetFieldValue(i, RepeatFieldName));



 for(var j = 0; j < repeatcount; j++)

 {

   NewInputTotalRecords++;

   for(var k = 0; k < sf.fieldCount; k++)

   {

       if (k)

         of.write(FieldDelimiter);



       switch(sf.GetFieldValue(0, k))

       {

         case RepeatFieldName:

            of.write(startval+j);

            break;

         default:

            of.write(sf.GetFieldValue(i, k));

       }

   }

   of.write("\r\n");

 }

}



of.close();

FusionPro.Composition.inputFileName = newfilename;



var message = orginputfilename + "\n" + sf.recordCount + " records\n\n";



message += FusionPro.Composition.inputFileName + "\n" +
NewInputTotalRecords + " records";



Print(message);

return message;

When I validate I get the following error:

OnJobStart, line 75 :Error:File operation failed

Thanks,
Richard.
Transcontinental




+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
FusionPro 5.0 Now Available!


Variable text on a curve and soft drop-shadows for variable text


LIMITED TIME upgrade offer of $299 per license for current customers:
http://fusionpro.printable.com/store/upgrade

New licenses available for $599 each at:
http://fusionpro.printable.com/store/

All FusionPro 5.0 customers to receive FusionPro 5.1 with
Adobe Acrobat 8 and InDesign CS3 support when released for FREE.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
--
Users of FusionPro Desktop have unlimited free email support. Contact Printable 
Support at [EMAIL PROTECTED] 
--
View FusionPro Knowledge Base, FusionPro Samples at
www.printable.com/vdp/desktop.htm

--
You are currently subscribed to fusionpro as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
--


--
Note:  All e-mail sent to or from this address will be received or otherwise 
recorded by the e-mail recipients of this forum. It is subject to archival, 
monitoring or review by, and/or disclosure to someone other than the recipient. 
Our privacy policy is posted on www.printplanet.com
--

Reply via email to