Skip to content

Instantly share code, notes, and snippets.

@moluapple
Last active December 15, 2015 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moluapple/5196971 to your computer and use it in GitHub Desktop.
Save moluapple/5196971 to your computer and use it in GitHub Desktop.
[Indesign] Reset the window bounds to the same as last time (CS6)
#targetengine "keepWindowBounds"
(function() {
app.addEventListener("afterOpen", setBounds);
function setBounds(ev) {
var layoutWin = ev.parent,
bounds = eval('[' + app.extractLabel('bounds') + ']');
layoutWin.addEventListener("beforeClose", insertBounds);
function insertBounds(ev) {
try {
// save window bounds before any document close.
app.insertLabel('bounds', ev.parent.bounds + '');
} catch (e) {}
}
// set window bounds when a document opened.
try {
layoutWin.bounds = bounds;
} catch (e) {}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment