I have an Adobe 9 javascript which will import text data to form fields loops through the records and emails the form.
The script loops through the records until the last row and then keeps processing the last record in an infinite loop and wont stop.
the "if ( counter == null )" part of the script is not working.
If someone can provide assistance with this part of the script so that after the last row is processed the script will then stop, any help will be most appreciated, script as follows:
* Merge to email*/
try
{
var counter=0;
do
{
//
var myPath = "/h/Drawing Office/PDF/Scripting Form Fields/Mail Merge/Mailmerge.txt"
row = this.importTextData(myPath, counter);
if ( counter == null ) throw "No more rows. Total processed: " + counter;
counter++
var p = this.getField("PackageName");
var v = this.getField("VendorName");
// Mail document
this.mailDoc({
bUI: true,
cTo: "",
cCC: "",
cSubject: "Request for Tender " + p.value + " " + v.value,
cMsg: "Please find attached request for tender." + "\n" + "\n" + "Please fill in and return"
});
} while (true)
}
catch(e)
{
console.println("Batch aborted: " + e);
event.rc = false; // abort batch
}