Copy link to clipboard
Copied
I've searched the XML file for a long time, but I can't find the option I set for "document" or "article" scope.
Looks like I'm wrong again.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Query>
<Header>
<Version major="5" minor="1">
</Version>
<Application value="Adobe InDesign">
</Application>
<QueryType value="Grep" qid="1">
</QueryType>
</Header>
<Description>
<FindExpression value="(?<=m|M)(2|3)(?!\d)">
</FindExpression>
<ReplaceExpression value="">
</ReplaceExpression>
<FindChangeOptions>
<IncludeLockedLayers value="0">
</IncludeLockedLayers>
<IncludeLockedStories value="0">
</IncludeLockedStories>
<IncludeMasterPages value="0">
</IncludeMasterPages>
<IncludeHiddenLayers value="0">
</IncludeHiddenLayers>
<IncludeFootnotes value="1">
</IncludeFootnotes>
<KanaSensitive value="1">
</KanaSensitive>
<WidthSensitive value="1">
</WidthSensitive>
</FindChangeOptions>
<FindFormatSettings>
</FindFormatSettings>
<ReplaceFormatSettings>
<TextAttribute type="cstyle" value="上标">
</TextAttribute>
<TextAttribute type="changecondmode" value="0">
</TextAttribute>
</ReplaceFormatSettings>
</Description>
</Query>
Ah, I see what you are running into here. You are looking at an InDesign Find/Change Query (.xml) export and wondering why there is no scope specified like document or article?
You are correct in thinking that the scope of where a GREP query runs (document vs selection vs story vs article) is not stored in the .xml file of the Find/Change Query. That is not a bug, that is simply how InDesign’s Find/Change system works. The query stores what to find, how to find it, and replace settings, but no
...Copy link to clipboard
Copied
Ah, I see what you are running into here. You are looking at an InDesign Find/Change Query (.xml) export and wondering why there is no scope specified like document or article?
You are correct in thinking that the scope of where a GREP query runs (document vs selection vs story vs article) is not stored in the .xml file of the Find/Change Query. That is not a bug, that is simply how InDesign’s Find/Change system works. The query stores what to find, how to find it, and replace settings, but not where to run it.
I realised this with Find Forwards and Find Backwards is not stored, frustrating.
The scope is chosen at run time by you, in the Find/Change panel or by the script or UI you are using.
app.activeDocument.changeGrepPreferences = NothingEnum.NOTHING;
app.activeDocument.findGrepPreferences = NothingEnum.NOTHING;
app.activeDocument.findGrepPreferences.findWhat = "(?<=m|M)(2|3)(?!\\d)";
app.activeDocument.changeGrepPreferences.appliedCharacterStyle = app.activeDocument.characterStyles.itemByName("superscript");
app.activeDocument.changeGrep();
In this example, the scope is the whole document, defined by app.activeDocument.
I think this is correct for just selection
app.selection[0].changeGrep();
You are not wrong. The XML does not and cannot define scope.
The scope is defined at runtime. As far as I know there is no way to embed a scope (Document, Story, Article) into the .xml query file.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now