@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.