Skip to main content
Participant
November 23, 2024
Answered

InDesign Javascript Needs Something to Skip the Save Dialogue, Or At Least Auto Select Don't Save

  • November 23, 2024
  • 2 replies
  • 446 views

I have a working javascript I use that searches through all the indd files in a folder, finding tables with a specified word, and extracting the info from those tables. It works great but the recent batch of files have tables with merged cells, which threw the script off. I've updated the script to unmerge the tables before searching and gathering and it works again, BUT because it's modifying the tables, I now get a Save dialogue box when the script closes each file.

 

Is there something I can add to my script that prevents that dialogue from popping up and just closes the files? Or is there something I can add that will automatically select Don't Save when the dialogue box pops up?

This topic has been closed for replies.
Correct answer Peter Kahrel

Your script probably closes documents without a parameter for .close() (something like myDoc.close()).

You can change that to .close (SaveOptions.NO)

2 replies

Robert at ID-Tasker
Legend
November 24, 2024

@seanl19759898

 

Why do you have to unmerge cells in Tables? 

 

Participant
November 24, 2024

@Robert at ID-Tasker 

I didn't get into it because that part of the script was working, but since you asked, I have to unmerge the cells because the data extraction part of the script finds the table with data, and then pulls data from specified cells. The cells are specified by row and column number. Merged cells throw off the count, or cause an error altogether. So as with below, with the first cells of rows 8 and 9 being merged, the script doesn't see the 9th row, and errors out when trying to find the data in row 9 column 4.

So, by running an unmerge function in the script before it gets to the data hunt, the script now has no issues finding the data in specified locations. 

Robert at ID-Tasker
Legend
November 24, 2024

@seanl19759898 

 

Not sure how do you address your cells - but I have no problem selecting cell [4,9]:

 

 

or:

 

 

(double click in column TYPE selects desired object)

 

It's VisualBasic but scripting - should - work the same.

 

Peter Kahrel
Community Expert
Peter KahrelCommunity ExpertCorrect answer
Community Expert
November 23, 2024

Your script probably closes documents without a parameter for .close() (something like myDoc.close()).

You can change that to .close (SaveOptions.NO)

Participant
November 23, 2024

That works! Thanks so much!