Copy link to clipboard
Copied
I found what sees like a bug in C:\Program Files (x86)\Adobe\AdobeFrameMaker10\Samples\ScriptsAndUtilities\Conditional Text\FM_Outputs_Conditional_Text.jsx.
The script produces two PDFs, which I expected to be named <book_name>_Comment_Red.pdf and <book_name>_Blue_Green.pdf.
Instead, they're named <book_name>.book_Comment_Red.pdf and <book_name>.book_Blue_Green.pdf.
The relevant lines seem to be:
FileSource = OpenBook(InputFile);
SavePdf(FileSource,InputFile + OutPutFiles[output_no]);
Is there some way to tweak the second line so as to remove the .book extension from FIleSource? Or to define another variable minus the extension?
Assuming that InputFile is the path to the book, you can use this:
SavePdf(FileSource,InputFile.replace(/\.book$/i,"") + OutPutFiles[output_no]);
I haven't tested it, but it should work. It replaces the .book extension with an empty string.
Rick
Copy link to clipboard
Copied
Assuming that InputFile is the path to the book, you can use this:
SavePdf(FileSource,InputFile.replace(/\.book$/i,"") + OutPutFiles[output_no]);
I haven't tested it, but it should work. It replaces the .book extension with an empty string.
Rick
Copy link to clipboard
Copied
That seems to do the trick, thanks. Where is the .replace syntax documented?
Copy link to clipboard
Copied
This is standard JavaScript regular expressions syntax.