Question
Make script work across multiple docs
Hey guys,
Could you please modify the script below to make it work across multiple docs? There are actually two scripts in this code (the second one starts at "function main() {" line). Would it be possible to merge them, so that it work in one go?
function main() {
var doc = app.activeDocument;
app.findGrepPreferences = NothingEnum.NOTHING;
app.changeGrepPreferences = NothingEnum.NOTHING;
app.findGrepPreferences.pointSize = "6.5";
app.findGrepPreferences.tracking = 0;
app.findGrepPreferences.fillColor=app.swatches.item("Paper");
var found = doc.findGrep();
for (var i = 0; i < found.length; i++)
for (var j = 0; j < found[i].parentTextFrames.length; j++) {
var frame = found[i].parentTextFrames[j];
if (frame.isValid) {
frame.textFramePreferences.autoSizingReferencePoint = AutoSizingReferenceEnum.CENTER_POINT;
frame.textFramePreferences.autoSizingType = AutoSizingTypeEnum.WIDTH_ONLY;
}
}
};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Set Autosizing');
function main() {
var doc = app.activeDocument;
app.findGrepPreferences = NothingEnum.NOTHING;
app.changeGrepPreferences = NothingEnum.NOTHING;
app.findGrepPreferences.pointSize = "8.5";
app.findGrepPreferences.leading = "11";
var found = doc.findGrep();
for (var i = 0; i < found.length; i++)
for (var j = 0; j < found[i].parentTextFrames.length; j++) {
var frame = found[i].parentTextFrames[j];
if (frame.isValid) {
frame.textFramePreferences.autoSizingReferencePoint = AutoSizingReferenceEnum.LEFT_CENTER_POINT;
frame.textFramePreferences.autoSizingType = AutoSizingTypeEnum.WIDTH_ONLY;
}
}
};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Set Autosizing');
Thanks in advace,
Rogerio
