@TᴀW has perfectly pinpointed the issue.
My contribution is the following script, that takes the guesswork out by requiring the user—Hi @Rogerio5C09!—to select a bit of text first. That way we can just pass the actual pointSize to the findGrep.
- Mark
/**
* Set PointSize With ChangeGrep.js
* Will find any text in the document with
* pointSize matching the selected text's
* pointSize and set it to a chosen value.
* @author m1b
* @discussion https://community.adobe.com/t5/indesign-discussions/is-there-a-way-to-remove-all-the-unused-data-placeholders/m-p/14172138
*/
function main() {
var doc = app.activeDocument;
setPointSize(doc, doc.selection[0], undefined);
};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Set Point Size');
/**
* Sets the pointSize of any text found in `target` object
* that matches pointSize of `sourceText`.
* Used in case where it is difficult to manually target
* a particular pointSize due to obscured unit conversion.
* @author m1b
* @date 2023-10-20
* @param {Application|Document|Story|Text} target - the changeGrep target object.
* @param {Text} sourceText - the text with pointSize to find.
* @param {String|Number} [newPointSize] - the pointSize to set (default: ask user).
*/
function setPointSize(target, sourceText, newPointSize) {
if (
target == undefined
|| target.changeGrep == undefined
)
throw Error('setPointSize: bad `target` parameter.');
if (
sourceText == undefined
|| !sourceText.hasOwnProperty('pointSize')
)
throw Error('setPointSize: bad `sourceText` parameter.');
newPointSize = newPointSize
|| prompt('Change to pointSize', sourceText.pointSize);
if (newPointSize == undefined)
return;
app.findGrepPreferences = NothingEnum.NOTHING;
app.changeGrepPreferences = NothingEnum.NOTHING;
// get the point size from the selected text
app.findGrepPreferences.pointSize = sourceText.pointSize;
app.changeGrepPreferences.pointSize = newPointSize
target.changeGrep();
};