Page 1 of 1

Unable to add filename to InDesign file

Posted: Sat Mar 02, 2019 5:42 pm
by Sean IO
I have a flow which opens and InDesign file and imports XML with Javascript, which works fine. However, after the import I have code to add a text frame that inserts the filename, this does not work. I am using the same block of code that I used from two other flows that add the filename without a problem. The other two flows do not import XML.

Could my issue be that the XML import is interfering with text frame? Or that the two working InDesign files have no existing text frame and the XML import does? I am looking for other things to try. TIA. See code below

Code: Select all

$doc.importXML( File($infile) );

$doc.pages[0].textFrames.add({geometricBounds:[706.5, 18, 728.5, 576], contents:$arg1});

Re: Unable to add filename to InDesign file

Posted: Mon Mar 04, 2019 9:49 am
by freddyp
Check if the resulting file has an empty text frame. If it has, it simply means that the value of $arg1 is empty. $arg1 is the value of the "Argument 1" property, not the name of the file. If you want it to be the name of the file, you have to define "Argument 1" as a single-line text with variable with the value [Job.Name].

Re: Unable to add filename to InDesign file

Posted: Fri Mar 08, 2019 4:04 pm
by Sean IO
I am almost positive it has something to do with the XML import. I create a new document and the filename get added no problem, but when I add the XML structure back to the document it fails again.