0

In my Adobe InDesign I have a startup script where I want to automatically maximize the entire InDesign window.

This says I have an invalid object.

var window = app.documents[0].layoutWindows[0];
window.maximize(); 

How do I make this work?

Cœur
  • 37,241
  • 25
  • 195
  • 267
bgmCoder
  • 6,205
  • 8
  • 58
  • 105

2 Answers2

1

This works for me:

var w = app.windows[0];
w.maximize();
mdomino
  • 1,195
  • 1
  • 8
  • 22
  • It doesn't for me; IND says the Object is invalid at `w.maximize();` Maybe there is some reference missing. – bgmCoder Jul 20 '17 at 15:22
  • Are you sure you have created the document first? What do you get when you do `$.writeln(app.windows.length)`? – mdomino Jul 20 '17 at 19:00
  • This is a startup script; I can't create a document before it starts, I think. The script runs when the app starts. Although, I am starting the app by loading a document, but the script fires before the document is loaded. – bgmCoder Jul 20 '17 at 21:02
  • What exactly do you want to maximize then, if there's no document window? – mdomino Jul 21 '17 at 10:00
  • "I want to automatically maximize the entire InDesign window." even if no document is open.... I guess I didn't phrase that very well. – bgmCoder Jul 21 '17 at 14:40
  • Oh, okay, now I realize what's going on. I'm only using InDesign under Mac OS X with the "Application frame" setting turned off. So, if there is no document open there is actually no window open at all. That was the misunderstanding. Not sure, how to maximize the window then. Are you under Mac or Windows? – mdomino Jul 21 '17 at 19:42
  • Ok, in this case, I'm out of ideas. On mac OS you could trigger some Applescript to resize the application frame itself, but I have no idea if or how something like that could work under Windows. Sorry! – mdomino Jul 22 '17 at 20:01
0

Object 'Window' only parent is 'Document'. It means you can't control the main app window using script (in Windows).

Cashmirek
  • 269
  • 1
  • 9