I'm converting AppleScript code to JXA and I'm stuck because I can't figure out how to replace placeholderTexts.
I tried to replace whose with where but no success.
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 is:
set (every placeholder text whose tag is thisTag) to theDate
Thanks in advance for any help!