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.
Delay Indesign Saving a Document
Re: Delay Indesign Saving a Document
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
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
Code: Select all
app.updateFonts();
A good site for consulting the complete API is this one: https://www.indesignjs.de/extendscriptA ... ation.html
Re: Delay Indesign Saving a Document
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.
$.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
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
As far as I know: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?Code: Select all
app.updateFonts();
A good site for consulting the complete API is this one: https://www.indesignjs.de/extendscriptAgetaway shootout...ation.html
Regarding
Code: Select all
updateFonts()
New fonts being installed or activated.
Fonts being modified or removed.
Resolving font-related issues that might arise due to inconsistencies.
Usage:
Access the
Code: Select all
Application
Code: Select all
var app = Application.activeApplication();
Code: Select all
app.updateFonts();
Code: Select all
waitForAllTasks():
Ensuring actions that might affect fonts have fully finished before proceeding.
Avoiding potential conflicts or errors.
Usage:
Call the method:
Code: Select all
app.waitForAllTasks();
To potentially address font-related issues, try combining them:
Code: Select all
JavaScript
app.updateFonts();
app.waitForAllTasks();