I have an applescript that does some layout changes to an indesign document that results in there being blank unneeded pages at the end of my document. I want to delete any blank pages from the end of my document.
As each blank page still has a blank threaded text frame on it I originally tried to use the “end text frame” property to go to the last text frame and delete that page if the text frame was empty - I’d keep repeating this until the last text frame was empty, but i couldn’t work out how to do this.
So I have tried the script below which finds any empty text frames that are the width of the margins and then tries to delete the page. It finds the text frames, however it gets an error when it tries to delete the page. Any help is much appreciated! Thanks!
set everyTextFrame to every text frame
repeat with thisTextFrame in everyTextFrame
set myColumnWidth to text column fixed width of text frame preferences of thisTextFrame
if contents of object reference of thisTextFrame is “” and myColumnWidth is greater than “111” and myColumnWidth is less than “112” then
--I think The 2 lines below are flaky - only partly work; bascially need a way to delete the page set mypage to parent of myTextframe delete mypage end if end repeat end tell