Skip to content

Instantly share code, notes, and snippets.

@kuyseng
Created May 26, 2012 03:50
Show Gist options
  • Save kuyseng/2792051 to your computer and use it in GitHub Desktop.
Save kuyseng/2792051 to your computer and use it in GitHub Desktop.
javascript: indesign find by grep
function find_by_grep (grep_keyword, paragraph_style, app_document) {
var app_doc = app_document || app.activeDocument;
app.findChangeGrepOptions.includeLockedLayersForFind = false;
app.findChangeGrepOptions.includeLockedStoriesForFind = false;
app.findChangeGrepOptions.includeHiddenLayers = false;
app.findChangeGrepOptions.includeMasterPages = false;
app.findChangeGrepOptions.includeFootnotes = false;
// app.findChangeTextOptions.caseSensitive = true;
// app.findChangeTextOptions.wholeWord = true;
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.appliedParagraphStyle = paragraph_style || null;
app.findGrepPreferences.findWhat = grep_keyword;
var my_founds = app_doc.findGrep();
// app.changeGrepPreferences.changeTo = NothingEnum.nothing;
// mySelection.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences = null;
return my_founds;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment