Change text preferences

Hello

I have a method that changes text in a text block, but I just want to change the first instance it finds. For the moment, it changes all the discoveries.

Is there a feedback in ChangeTextPreference.ButJustTheFirstOneMatey

or equivalent?

Thank you very much

Select this option.

Please ignore the c# and "pretend" it's javascript.

private void ChangeTextFrameText (string Document doc, TextFrame TargetTextFrame, ChangeText, string ChangeTo)

{

Application IndesignApp = doc (Application). Parent;

IndesignApp.FindTextPreferences = idNothingEnum.idNothing;

IndesignApp.ChangeTextPreferences = idNothingEnum.idNothing;

FindTextPreference FTP = (FindTextPreference) IndesignApp.FindTextPreferences;

FTP.FindWhat = ChangeText;

CTP ChangeTextPreference = (ChangeTextPreference) IndesignApp.ChangeTextPreferences;

CTP. ChangeTo = ChangeTo;

FindChangeTextOption FCTO = (FindChangeTextOption) IndesignApp.FindChangeTextOptions;

FCTO. CaseSensitive = false;

FCTO. IncludeFootnotes = false;

FCTO. IncludeHiddenLayers = false;

FCTO. IncludeLockedLayersForFind = false;

FCTO. IncludeLockedStoriesForFind = false;

FCTO. IncludeMasterPages = false;

FCTO. WholeWord = false;

O objects = TargetTextFrame.ParentStory.ChangeText (false);

IndesignApp.FindTextPreferences = idNothingEnum.idNothing;

IndesignApp.ChangeTextPreferences = idNothingEnum.idNothing;

}

I don't think that there is no prefrence as 'ChangeTextPreference.ButJustTheFirstOneMatey '.

In my opinion, you replace your code

O objects = TargetTextFrame.ParentStory.ChangeText (false);

with this

O objects = TargetTextFrame.ParentStory.FindText ();

and you get a list of array in O and O [0] then replace your output.

Shonky

Tags: InDesign

Similar Questions

Maybe you are looking for