Copy link to clipboard
Copied
I'm still fairly new to javascript and I was hoping someone could assist with a dilemma I'm having. I'm trying to create a script that can retrieve the Page Label of a page, check if it's using the roman numeral style and if so, skip that page and check the next page until it finds a non-roman numeral page. Once roman numerals are no longer applied, it will start paginating from that page onward until the end of the document. I was able to get the Page Label by using the following code, where i is an incrementing variable:
getPageLabel(i);
This of course will just report back the Page Label of the current page it's on. I can create "if" statements for the first 10 roman numerals but that seems inefficient. Is there a way to extract the style applied to the page so that if it's set to "R" or "r" (roman numberal style according to reference guide), it will skip that page? I tried getPageLabel(i).cStyle and getPageLabel(i).aLabel but they come back as undefined in the console. Any help would be appreciated, thanks.
Copy link to clipboard
Copied
This properties are not available.
Copy link to clipboard
Copied
We can't access this property but we can test the value of the Page Label with a GREP regex, for example (not tested):
var str1 = this.getPageLabel(i);
if (str1.match(/(?<=^)M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})(?=$)/) == null) {// script for not roman numeral}
else {// script for roman numeral}