Skip to main content
TestriteVisual
Inspiring
July 23, 2024
Question

Javascript error only on a specific computer

  • July 23, 2024
  • 2 replies
  • 878 views

Greetings,

I have a coworker on a Mac using InDesign v19.4 and they are getting the error below when running a script, but other coworkwers on Macs are able to run the script with no problem. I'm on a PC running InDesign v19.5 and the script runs fine for me as well. Any help getting it running on the one Mac would be much appreciated 🙂

 

Error Number: 1285

Error String: A document must have at least one page.

Line: 249

Source: graphicTemplate.masterSpreads[0].pages.lastitem0.remove();

 

 

This topic has been closed for replies.

2 replies

rob day
Community Expert
Community Expert
July 23, 2024

Hi @TestriteVisual , I don’t think the error is computer specific—the error would happen on a document setup with Facing pages unchecked. You have to check if the targeted master spread has more than 1 page:

 

if (app.activeDocument.masterSpreads[0].pages.length > 1) {
	app.activeDocument.masterSpreads[0].pages.lastItem().remove();
}else{
	alert("No pages removed")
}

 

 

TestriteVisual
Inspiring
July 23, 2024

Hi @rob day The script generates new pages from scratch, and will run with no documents open. But this problem is only happening on the one Mac, and the person was able to run the script before without error. The script is read-only so I'm not sure what could have changed in InDesign or on the one Mac to start causing the error. Thanks for any more insight.

Community Expert
July 23, 2024

"… The script is read-only so I'm not sure what could have changed in InDesign or on the one Mac to start causing the error."

 

Hi @TestriteVisual ,

well, if the script is adding a new document and that script does NOT specify if the document has facing pages, the default of that specific installed InDesign will apply. And it could be that this has changed to non facing pages documents. So that the script will add documents with only one page per parent page in this special case…

 

Example where the parameter facing-pages is left out so all could happen. A facing-pages document or a non-facing pages document; dependent on what the user has defined as default:

app.documents.add();


Adding a document with facing-pages explicitely defined. This would always add a facing-pages document:

app.documents.add
(
	{
		documentPreferences :
			{
				facingPages : true
			}
	}
);

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Community Expert
July 23, 2024

Hi @TestriteVisual ,

seems that this specific document has only one page in the first parent page.

Maybe that script was executed a second time on the same document.

 

Regards,
Uwe Laubender
( Adobe Community Expert )