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

Read text from external file and add to FM file

Explorer ,
Jul 29, 2021 Jul 29, 2021

Copy link to clipboard

Copied

I have some content in text file. Is there a way to read text from .txt, line by line, and add that to its corresponding content in the .fm file?

 

Thanks

 

Views

183

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 ,
Jul 29, 2021 Jul 29, 2021

Copy link to clipboard

Copied

What do you mean by "corresponding" ?

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
Explorer ,
Jul 29, 2021 Jul 29, 2021

Copy link to clipboard

Copied

For example if I have following in a text file:

 

A -- B

C -- D

 

It should read A and add B to the fm file.

 

Thanks

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
Mentor ,
Jul 29, 2021 Jul 29, 2021

Copy link to clipboard

Copied

Your question is lacking some details. Are you trying to do this with the API or ExtendScript? It is definitely possible with either of those. You would use a File object to read the text and then you would use FrameMaker doc methods to add the text to a document. You can read about the File object in the Javascript Tools Guide, available from the Help menu of the ExtendScript editor. You can find some examples of inserting text into a document here: http://www.weststreetconsulting.com/WSC_ExtendScriptSamples.htm.

 

Russ

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 ,
Jul 29, 2021 Jul 29, 2021

Copy link to clipboard

Copied

If you want all of the text in file external.txt, use Text Inset:
File » Import » File
{select file}
Decide (_) Import_By_Reference or (_) Copy_Into_Document
{verify file type in next dialog, then}
Pick line treatment options and any encoding election.

 

But I'm guessing you need something different.

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
Explorer ,
Jul 30, 2021 Jul 30, 2021

Copy link to clipboard

Copied

Thanks Bob snd Russ,

 

I need something like this

 

For example if I have following in a text file:

 

A -- B

C -- D

 

It should read A, find A in fm file and add B A to the fm file.

 

Thanks

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 ,
Jul 30, 2021 Jul 30, 2021

Copy link to clipboard

Copied

LATEST

Let me know if you want to do a short web meeting so I can see what you are trying to do. Please contact me offlist: rick at frameexpert dot com

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