Delay Indesign Saving a Document

Post Reply
jlisle_PointB
Newbie
Posts: 1
Joined: Tue Sep 26, 2023 7:57 pm

Delay Indesign Saving a Document

Post by jlisle_PointB »

Hello I'm new to Switch and working with one of our in house web developers to come up with a script to have the Indesign Configurator wait 1 minute before it closes and saves the open file as the same name. The goal is to have the file open long enough to auto-activate Adobe fonts in Creative Suite.

Here's the script we come up for the "Save as" in the InDesign Configurator that doesn't seem to be working:

let doc = $doc;
let $outfiles = [];

try {
setTimeout(function() {
let $outfile = new File(`${$outfolder}/${$filename}.${$extension}`);
doc.saveAs($outfile);
$outfiles.push(`${$outfolder}/${$filename}.${$extension}`);
}, 60000)

} catch (error) {
doc.close(SaveOptions.DONOTSAVECHANGES);
$error = error.description;
}

Any ideas how to fix this script or to achieve activating Adobe fonts for InDesign?

Thank you.
jan_suhr
Advanced member
Posts: 564
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Delay Indesign Saving a Document

Post by jan_suhr »

You have the "Use font in package" property if set to yes it will use fonts that come along the file in a package. If that's the way you get the InDesign file.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
freddyp
Advanced member
Posts: 957
Joined: Thu Feb 09, 2012 3:53 pm

Re: Delay Indesign Saving a Document

Post by freddyp »

The Indesign API has an updateFonts method at the Application level. I am not sure it does what you want but it is worth a try. I have not tested it, but the line should be:

Code: Select all

app.updateFonts();
There is also a waitForAllTasks method. Could this do the trick?

A good site for consulting the complete API is this one: https://www.indesignjs.de/extendscriptA ... ation.html
Padawan
Advanced member
Posts: 357
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Delay Indesign Saving a Document

Post by Padawan »

I have used the following line in the past for font activation with extensis

$.sleep(10000)
(Unit is milliseconds)

You might want to try freddys suggestion first, if it works it won't need delays.
loicaigon
Advanced member
Posts: 313
Joined: Wed Jul 10, 2013 10:22 am

Re: Delay Indesign Saving a Document

Post by loicaigon »

For what it's worth, using $.sleep() in InDesign Scripts is quite useless as it freezes script execution (and by extension any InDesign operations).
Post Reply