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

Framescript: search and replace condition name in a bunch of mif files

Participant ,
Apr 24, 2014 Apr 24, 2014

Copy link to clipboard

Copied

Hello fellows,

I would like to loop through all mif files listed in a book, and search/replace specific condition names with other ones.

This can be done in each FM file as follows:

...

Sub ProcessDoc

  Loop ForEach(CondFmt) In(vCurrentDoc) LoopVar(vCondFmt)

    If vCondFmt.Name = (vCurrentName)

      Set vCondFmt.Name = (vFutureName);

    EndIf

  EndLoop

EndSub

...

The question is what would be the code in case of mif files. Conditions are defined in mif files as follows:

<Conditional

    <InCondition `SampleCond'>

    <InCondition `SampleCond'>

   > # end of Conditional

Thank you for your input in advance!

TOPICS
Scripting

Views

678

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
Advocate ,
Apr 25, 2014 Apr 25, 2014

Copy link to clipboard

Copied

There is no difference in the code. FM binary and mif are just the formats in which the files are stored on the disk. When the document is loaded into FM, the internal representation is what your scripts work on.

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
Participant ,
Apr 26, 2014 Apr 26, 2014

Copy link to clipboard

Copied

Hi Jang,

Thank you for your response. Interestingly enough, FM allows changing the Track Changes conditions to any other conditions using the script, but not the other way around. This can only be done after saving an FM file as MIF and running textual search/replace on all relevant <InCondition> instances in a text editor.

Any idea why FM refuses to change a condition name to FM8_TRACK_CHANGES_ADDED for example?

Thank you!

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
Advocate ,
Apr 26, 2014 Apr 26, 2014

Copy link to clipboard

Copied

LATEST

Hi Roman,

I have not delved into the details of applying conditions, but I did find that some condition formats are predefined by FM. Probably there is a property (possibly hidden) that does not allow you to use any of those reserved names for user-defined conditions. I would not tweak the conditon names via the MIF, as there is no telling whether FM will survive all possible scenarios after such a change.

Kind regards

Jang

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