Skip to main content
Inspiring
August 9, 2021
Answered

opening in tiled window layout

  • August 9, 2021
  • 3 replies
  • 407 views

Hi,

 

I am looking for a usage hint (or perhaps a small script) to help me open files in a tiled window layout.

So, if I have file a open in the left side and file b in the right side,I would like to close b and open b2 instead,

without having anything to but choosing a new file

This topic has been closed for replies.
Correct answer Charu Rajput

@birnerseff 

Taking reference from the what @femkeblanco said, simple script below that will open B2.ai document and close B.ai

 

//Assuming A.ai and B.ai document are already open and B2.ai open exists at Desktop
//First closing B.ai
//Checking B2.ai exists on the Desktop, if yes , open it and then arrange in vertical tile

var doc = app.documents.getByName('B.ai');
doc.close();
var newDoc = File('~/Desktop/B2.ai');
if (newDoc.exists) {
    app.open(newDoc);
}
app.documents.arrange(DocumentLayoutStyle.VERTICALTILE);

 

The link shared by @femkeblanco says arrange method on activeDocument, but when I try to run as app.activeDocument.arrange, it gives an error that saying "app.activeDocument.arrange is not a function ". 

So tried on app.documents.arrange, which works and  it makes sense as we need to arrange multiple document not a active document.

3 replies

Mike_Gondek10189183
Community Expert
Community Expert
August 9, 2021

You would open first,then click the x to close to get the result you requested.

 

Charu Rajput
Community Expert
Charu RajputCommunity ExpertCorrect answer
Community Expert
August 9, 2021

@birnerseff 

Taking reference from the what @femkeblanco said, simple script below that will open B2.ai document and close B.ai

 

//Assuming A.ai and B.ai document are already open and B2.ai open exists at Desktop
//First closing B.ai
//Checking B2.ai exists on the Desktop, if yes , open it and then arrange in vertical tile

var doc = app.documents.getByName('B.ai');
doc.close();
var newDoc = File('~/Desktop/B2.ai');
if (newDoc.exists) {
    app.open(newDoc);
}
app.documents.arrange(DocumentLayoutStyle.VERTICALTILE);

 

The link shared by @femkeblanco says arrange method on activeDocument, but when I try to run as app.activeDocument.arrange, it gives an error that saying "app.activeDocument.arrange is not a function ". 

So tried on app.documents.arrange, which works and  it makes sense as we need to arrange multiple document not a active document.

Best regards
Inspiring
August 16, 2021

Hi,

 

many thanks. I have set up a little script that lets me pick a name from a list of files (spread across a few folders) and uses arrange()

femkeblanco
Legend
August 9, 2021

The document has an arrange() function, which you can use for vertical tiling. 

 

https://ai-scripting.docsforadobe.dev/jsobjref/Document/#document-arrange 

 

It's not available in CS6, so I have not used it.