• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

change in locked stories (GREP)

Participant ,
Sep 28, 2016 Sep 28, 2016

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

TOPICS
Scripting

Views

968

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Sep 29, 2016 Sep 29, 2016

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

...

Votes

Translate

Translate
Guide ,
Sep 28, 2016 Sep 28, 2016

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;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 28, 2016 Sep 28, 2016

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;

   

    }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 28, 2016 Sep 28, 2016

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 28, 2016 Sep 28, 2016

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;

   

    }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 29, 2016 Sep 29, 2016

Copy link to clipboard

Copied

i got this error and no thing changed

1.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 29, 2016 Sep 29, 2016

Copy link to clipboard

Copied

  use this..

app.findChangeGrepOptions.includeLockedLayersForFind = true;

"s" missing in findChangeGrepOptions

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 29, 2016 Sep 29, 2016

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 29, 2016 Sep 29, 2016

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 29, 2016 Sep 29, 2016

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 29, 2016 Sep 29, 2016

Copy link to clipboard

Copied

LATEST

Dear mg, thanks a lot my dear works perfect and awesome

many thanks again for your help and time..

cheers

Suzan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines