This content has been marked as final.
Show 3 replies
-
1. Re: Is there a script to position document windows?
(Oz_Springs) Jul 7, 2007 4:44 AM (in response to John_Nolan-ylAnVM)This script I use all the time to set the ID document to the right window:
Tell application "Adobe InDesign CS3"
activate
Tell active window
maximize
set bounds to {-173, 1283, 1146,3060}
end tell
end tell
You will probably have to reset the bounds. To do this, set up the ID window in the screen sizing how you want it to be then run this script:
tell application "Adobe InDesign CS3"
get properties of active window
end tell
The new measurements will display in the result window in Script Editor, so have that open when you run the script. Then copy them into the first script array.
It's quite easy - once you know!!
HTH
Oz -
2. Re: Is there a script to position document windows?
(Dave_Saunders) Jul 7, 2007 4:46 AM (in response to John_Nolan-ylAnVM)I have indeed written such a script, but it is not aware of second monitors, and off the top of my head, I'm not sure how to make it aware.
Ah, it doesn't have to be aware. The bounds are relative to the total monitor space. So my script will work.
Here you go:
//DESCRIPTION: Resets active window size or uses front window to set default size.
Before you run the script for the first time, position a window where you want this script to position all subsequent windows. It keeps the information in a text file in the same folder as the script. You can reset the position by editing the file (that's what I often do to fine tune the position) or by running the script again with no window open.
// Check for WindowDefault.txt; if present use it to set front window
// if not, use front window to set it after checking with user.
myPath = app.activeScript;
myParts = myPath.toString().split("/");
myParts[(myParts.length - 1)] = "WindowDefault" + app.version.slice(0,1) + ".txt";
myNewPath = myParts.join("/");
mySettingsFile = File(myNewPath);
// Before proceeding, check that there is a front window
// If not, offer user the chance to delete the current settings
if (app.windows.length < 1) {
beep();
if (confirm("No window is open; would you like to delete the settings file?")) {
// User said yes; check that it exists
if(mySettingsFile.exists) {
mySettingsFile.remove();
}
}
} else {
if (mySettingsFile.open("r")) {
savedBounds = mySettingsFile.read();
mySettingsFile.close();
myBounds = savedBounds.split(",");
for (i = 0; i<myBounds.length; i++) {
myBounds[i] = Number(myBounds[i]);
}
app.windows[0].bounds = myBounds;
} else {
beep();
if (confirm("Settings file is missing. Use current front window to set default?")) {
// User said: go to it.
new File(mySettingsFile);
mySettingsFile.open("w");
mySettingsFile.write(app.windows[0].bounds);
mySettingsFile.close();
}
}
}
Dave -
3. Re: Is there a script to position document windows?
John_Nolan-ylAnVM Jul 7, 2007 6:06 AM (in response to John_Nolan-ylAnVM)Thanks, guys. That's great! The text file is a very nice touch, Dave.

