Page 1 of 1

Indesign Error Message Variable

Posted: Tue May 12, 2015 5:43 pm
by woody
When InDesign checks a file and has missing fonts or images, I can't get the error message, as a variable, to display in my email send. I'm using the [Job.FailMessage](and have tried other variables) but nothing shows up. How might I get the error to display in my email?

Re: Indesign Error Message Variable

Posted: Mon May 18, 2015 3:37 pm
by loicaigon
Hi,

You can use a script in the command section to investigate the document and then output an error message :

Code: Select all

function checkDoc(doc) {
	var fts = doc.fonts;
	var lks = doc.links;
	var missingFonts = [];
	var missingLinks = [];
	var n = fts.length;
	var msg = "";
	while (n--) {
		if ( /SUBSTITUTED|NOT_AVAILABLE/.test ( fts[n].properties.status.toString() ) ){
			missingFonts [ missingFonts.length ] = fts[n].name.replace ( /\t+/g, " ");
		}
	}

	n = lks.length;
	
	while (n--) {
		if ( /LINK_MISSING|LINK_INACCESSIBLE/.test ( lks[n].properties.status.toString() ) ) {
			missingLinks[ missingLinks.length ] = lks[n].name;
		}
	}
	
	if ( missingFonts.length ) msg+= missingFonts.length+" missing fonts ["+missingFonts.join()+"]. ";
	if ( missingLinks.length ) msg+= missingLinks.length+" missing links ["+missingLinks.join()+"]. ";
	
	return ( missingFonts.length || missingLinks.length )? msg : "";
}

var c = checkDoc($doc);
c!="" && $error = c;
Then get the message :

Image

HTH,

Loic
http://www.ozalto.com