Skip navigation
Currently Being Moderated

tweaking FM_Outputs_Conditional_Text.jsx

Apr 24, 2012 11:15 AM

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?

 
Replies
  • Currently Being Moderated
    Apr 24, 2012 11:23 AM   in reply to rlauriston

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 24, 2012 12:09 PM   in reply to rlauriston

    This is standard JavaScript regular expressions syntax.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points