Indesign – open multiple paged placed PDF in Illustrator

Hi all,
as a user of Adobe Indesign I often have to place a PDF as an image in a document. Sometimes the PDF will have multiple pages and I can choose which page to insert. Further down the track I am asked to modify the PDF and update it in the Indesign document. “What?” I ask - “PDFs aren’t supposed to be edited!”. My complaints fall on deaf ears. “Just do it” is the short answer.

So I was very proud of myself for writing this script that allows me to automatically open the appropriate page of a PDF placed in Indesign, in Adobe Illustrator.

tell application "Adobe InDesign CC 2015"
	set MyFilePath to file path of item link of item 1 of all graphics of selection
	set PlacedPDFpageNo to page number of PDF attributes of item 1 of all graphics of selection
end tell

tell application "Adobe Illustrator"
	set user interaction level to never interact
	set page of PDF file options of settings to PlacedPDFpageNo
	open MyFilePath as alias without dialogs
end tell

However, there is a strange issue that affects the Illustrator file after running this script. Normally when you open one page of a multi page PDF manually in Illustrator, there is a dialog box that tells you that if you save the PDF after modifying it, all the other pages will be retained. But after opening the PDF using this script, this is no longer possible and it removes all the other pages if you save it.

I have tried commenting out the lines “set user interaction level to never interact” and “…without dialogs” and then then when I run the script, Adobe Illustrator will ask for the page number. In this case the file retains the other pages after saving as it does in the manual process. So something happens in Illustrator through the manual process that does not happen when using the script, that allows the other pages to be retained.

Has anyone got any ideas as to why this is so?