Skip to content

Instantly share code, notes, and snippets.

@narthur
Created June 11, 2015 15:26
Show Gist options
  • Save narthur/fa5960ef8586b23030c2 to your computer and use it in GitHub Desktop.
Save narthur/fa5960ef8586b23030c2 to your computer and use it in GitHub Desktop.
InDesign script for replacing double tabs with single tabs
//Based on http://wwwimages.adobe.com/content/dam/Adobe/en/products/indesign/pdfs/InDesignCS5_ScriptingGuide_JS.pdf
var myDocument = app.activeDocument;
//Clear the find/change text preferences.
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
//Set the find options.
app.findChangeTextOptions.caseSensitive = false;
app.findChangeTextOptions.includeFootnotes = false;
app.findChangeTextOptions.includeHiddenLayers = false;
app.findChangeTextOptions.includeLockedLayersForFind = false;
app.findChangeTextOptions.includeLockedStoriesForFind = false;
app.findChangeTextOptions.includeMasterPages = false;
app.findChangeTextOptions.wholeWord = false;
//Search the document for the string "copy" and change it to "text".
app.findTextPreferences.findWhat = "\t\t";
app.changeTextPreferences.changeTo = "\t";
myDocument.changeText();
//Clear the find/change text preferences after the search.
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment