Page 1 of 1
Delay Indesign Saving a Document
Posted: Wed Oct 11, 2023 6:40 pm
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.
Re: Delay Indesign Saving a Document
Posted: Wed Oct 11, 2023 8:56 pm
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.
Re: Delay Indesign Saving a Document
Posted: Thu Oct 12, 2023 8:35 am
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:
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
Re: Delay Indesign Saving a Document
Posted: Fri Oct 13, 2023 10:17 am
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.
Re: Delay Indesign Saving a Document
Posted: Mon Oct 23, 2023 10:38 am
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).
Re: Delay Indesign Saving a Document
Posted: Fri Jan 19, 2024 5:00 am
by smitham59
freddyp wrote: ↑Thu Oct 12, 2023 8:35 am
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:
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/extendscriptAgetaway shootout...ation.html
As far as I know:
Regarding
Purpose: It's designed to refresh InDesign's internal font list, ensuring it reflects the latest state of available fonts on the system. This can be useful in scenarios like:
New fonts being installed or activated.
Fonts being modified or removed.
Resolving font-related issues that might arise due to inconsistencies.
Usage:
Access the
object:
Code: Select all
var app = Application.activeApplication();
Call the method:
Regarding
Purpose: Pauses script execution until all pending tasks within InDesign have completed. This can be helpful for:
Ensuring actions that might affect fonts have fully finished before proceeding.
Avoiding potential conflicts or errors.
Usage:
Call the method:
Using them together:
To potentially address font-related issues, try combining them:
Code: Select all
JavaScript
app.updateFonts();
app.waitForAllTasks();