Copy link to clipboard
Copied
Hi all,
i'm seeking a way to do change in all locked stories without need to unlock them.
i tried a lot in scripting but i only found a way to change in hidden layers not locked stories or text frame
is it possible to do in scripting because i found it possible but on apple coding
Thanks
Suzan
Hi,
Generally using `[target].changeGrep()` won't work.
I found another way, this work for me (cc version9.3) without unlocking textframes and layers.
...main();
function main() {
var doc = app.activeDocument;
var find_grep_obj = {
appliedFont: "Arial",
fontStyle: "Regular",
};
var change_grep_obj = {
appliedFont: "Myriad Pro",
fontStyle: "Bold",
};
with (app.findChangeGrepOptions) {
// includeFootnotes = false;
// includeHiddenLayers = false;
inc
Copy link to clipboard
Copied
I hope you included in this lines before find and change (if you usie Grep search)
app.findChangeGrepOptions.includeLockedStoriesForFind = true;
Copy link to clipboard
Copied
well, i used your advice as shown on below code but still no thing changed on locked layers (stories)
main();
function main() {
var doc = app.activeDocument;
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
app.findChangeGrepOptions.includeLockedStoriesForFind = true;
app.changeGrepPreferences.appliedFont = "Arial";
app.findGrepPreferences.fontStyle = "Regular";
app.changeGrepPreferences.appliedFont = "Myriad Pro";
app.changeGrepPreferences.fontStyle = "Bold";
doc.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
}
Copy link to clipboard
Copied
Hi
.includeLockedStoriesForFind
try of locked layer
.includeLockedLayersForFind
You can only find in locked stories and layers, to change you should unlock stories (from InCopy?) or layers.
thankyou
mg.
Copy link to clipboard
Copied
try this..
main();
function main() {
var doc = app.activeDocument;
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
app.findChangeGrepOptions.includeLockedStoriesForFind = true;
app.findChangeGrepOption.includeLockedLayersForFind = true;
app.findGrepPreferences.appliedFont = "Arial";
app.findGrepPreferences.fontStyle = "Regular";
app.changeGrepPreferences.appliedFont = "Myriad Pro";
app.changeGrepPreferences.fontStyle = "Bold";
doc.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
}
Copy link to clipboard
Copied
i got this error and no thing changed
Copy link to clipboard
Copied
use this..
app.findChangeGrepOptions.includeLockedLayersForFind = true;
"s" missing in findChangeGrepOptions
Copy link to clipboard
Copied
unfortunately same result
did that code work for you? i'm afraid that may be my application or file is corrupted..
sorry for bothering you again and again.
Suzan
Copy link to clipboard
Copied
milligramme wrote:
Hi
.includeLockedStoriesForFind
try of locked layer
.includeLockedLayersForFind
You can only find in locked stories and layers, to change you should unlock stories (from InCopy?) or layers.
thankyou
mg.
i tried both lines but no thing changed, this means that there is no way to change text inside locked stories or layers and i have to unlock it first ??
Suzan
Copy link to clipboard
Copied
Hi,
Generally using `[target].changeGrep()` won't work.
I found another way, this work for me (cc version9.3) without unlocking textframes and layers.
main();
function main() {
var doc = app.activeDocument;
var find_grep_obj = {
appliedFont: "Arial",
fontStyle: "Regular",
};
var change_grep_obj = {
appliedFont: "Myriad Pro",
fontStyle: "Bold",
};
with (app.findChangeGrepOptions) {
// includeFootnotes = false;
// includeHiddenLayers = false;
includeLockedLayersForFind = true;
// includeLockedStoriesForFind = true;
// includeMasterPages = false;
// kanaSensitive = true;
// widthSensitive = true;
}
var match = grep_find(doc, find_grep_obj);
for (var mi=0, mlen=match.length; mi < mlen ; mi++) {
var container = match.parentStory.textContainers;
for (var ti=0, tlen=container.length; ti < tlen ; ti++) {
// without unlocking
// container[ti].locked = false;
// container[ti].itemLayer.locked = false;
};
for (var prop in change_grep_obj) {
match[mi][prop] = change_grep_obj[prop];
};
};
function grep_find (target_obj, find_grep_obj) {
app.findGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.properties = find_grep_obj;
var result = target_obj.findGrep();
app.findGrepPreferences = NothingEnum.nothing;
return result;
}
}
thank you
mg.
Copy link to clipboard
Copied
Dear mg, thanks a lot my dear works perfect and awesome
many thanks again for your help and time..
cheers
Suzan