mike-edel / ID-MultiPageImporter

Script for automating the placing (import) of PDF and InDesign files inside Adobe InDesign
119 stars 24 forks source link

Reset InDesign Prefs not working #21

Closed 010BlackStar closed 9 months ago

010BlackStar commented 2 years ago

After using the import script, the selected "crop type" is set as the new preference for the complete app. Placing from menu "File" > "Place" the last selected setting from the script is used.

I tried removing all parts that seem to be connected to the prefs, but this did not change anything, the result was the same. But I am no expert in scripting. Maybe you could help me to solve this?

mike-edel commented 2 years ago

Hi,

can you share your reasoning why you would need to change this?

If I remember correctly, this is standard InDesign behavior. So even if you change the crop type in the regular place options it will remember that for the next file.

I haven't written that part myself but looking at the code (line 349) my understanding is that the script changes the crop type through the PDFPlacePreference for all of InDesign. I strongly suspect there is no other way to control the crop when placing - seen similar behavior in other cases as well.

The documentation kind of indicates the same thing since the crop setting is only available in the attribute of an already placed PDF (PDFAtrribute) or in the preference for placing a new PDF (PDFPlacePreference.pdfCrop: https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PDFCrop.html#d1e80765 Unfortunately, PDFPlacePreference has no method to reset it so all you can do is specifically set app.PDFPlacePreferences.pdfCrop to one of the valid values: https://www.indesignjs.de/extendscriptAPI/indesign-latest/index.html#PDFCrop.html

But none of this should prevent you from using a different PDF crop in the place options dialog when placing things manually.