Created
February 17, 2026 18:36
-
-
Save atroia/8560e86b69672d212b67cc04f8163c98 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* -------------------------------------- | |
| Auto Save IDML | |
| by Aaron Troia (@atroia) | |
| Modified Date: 2/17/26 | |
| Description: | |
| Startup Script that exports an IDML as soon as an INDD is opened | |
| Note: This script goes in Startup Scripts folder not Scripts Panel folder. | |
| -------------------------------------- */ | |
| #targetengine "afterOpen" | |
| app.addEventListener('afterOpen', function() { | |
| try{ | |
| if (isIDML(app.activeDocument)) { | |
| return; // continue, break, return | |
| } else { | |
| var IDML = String(app.activeDocument.fullName).replace(/\..+$/, "") + ".idml"; | |
| IDML = String(new File(IDML)); | |
| app.activeDocument.asynchronousExportFile(ExportFormat.INDESIGN_MARKUP, new File(IDML)); | |
| } | |
| } catch (e) { | |
| alert(e.description); | |
| } | |
| // determin if file is INDD or IDML | |
| function isIDML(d) { | |
| try { | |
| app.activeDocument.fullName; | |
| return false; | |
| } catch(f) { | |
| var n = app.activeDocument.name.split("."); | |
| if (n[n.length-1] != "indd") { | |
| return true; | |
| } | |
| } | |
| } | |
| }); | |
| // https://stackoverflow.com/questions/23255581/need-indesign-script-to-run-on-file-open | |
| // https://community.adobe.com/questions-671/check-if-the-file-opened-is-a-idml-file-879853 | |
| // beforeOpen, afterOpen, beforeClose, afterClose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment