2 Replies
      Latest reply on Apr 9, 2020 3:46 AM by wchongo
      wchongo Level 1 Level 1 (0 points)

        I’m getting error on last line trying to replace every placeholderText tag.

        I'm stuck for  a couple of days trying to fix the error.

         

        Thanks a lot for any kind of help.

         

        Here's the code:

         

        var PagesApp = Application("Pages");

         

        var theseTags = PagesApp.documents[0].placeholderTexts.tag()

         

        var uniqueTags = []

         

        for(var i=0; i < theseTags.length; i++){

             var thisTag = theseTags[i];

         

             if (!(uniqueTags.includes(thisTag))) {

                  uniqueTags.push(thisTag);

             }

        }

         

        var theDate = "20200326"

         

        for(var i=0; i < uniqueTags.length; i++){

          var thisTag = uniqueTags[i];

         

          if (thisTag.includes("theDate")) {

         

               PagesApp.documents[0].placeholderTexts.whose({tag: thisTag}).tag = theDate; // Error: Error: Invalid key form.

         

          }

        }

         

        The error line in AppleScript works well :

         

          set (every placeholder text whose tag is thisTag) to theDate