• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

tweaking FM_Outputs_Conditional_Text.jsx

Contributor ,
Apr 24, 2012 Apr 24, 2012

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?

TOPICS
Scripting

Views

839

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 24, 2012 Apr 24, 2012

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

Votes

Translate

Translate
Community Expert ,
Apr 24, 2012 Apr 24, 2012

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 24, 2012 Apr 24, 2012

Copy link to clipboard

Copied

That seems to do the trick, thanks. Where is the .replace syntax documented?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 24, 2012 Apr 24, 2012

Copy link to clipboard

Copied

LATEST

This is standard JavaScript regular expressions syntax.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines