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!
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.
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!
Copy link to clipboard
Copied
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