Hello! I have simple code, that executes some scripts for Indesign, which work when i run them manually from app Script pannel. But somehow they work for scripts character styles and do not work when i call scripts with changeGrep(). What could be the problem? Or may be there is a better way to do this? Can you recommend something for
(I removed path for privacy, but it seems to be ok, because some of the scripts definitely execute)
function runScriptRunner () {
// Define the scripts folder (relative to InDesign's Scripts folder)
var scriptsFolder = "...\\Scripts Panel\\"
// List of scripts to run (relative to the Scripts folder)
var scriptList = [
File(scriptsFolder + "1Character styles\\dont_change.jsx"),
File(scriptsFolder + "1Character styles\\generate_character_styles.jsx"),
File(scriptsFolder + "2Extra spaces\\extra_spaces.jsx")
]; // Ceate a dialog box
// Iterate through the list of scripts and execute them
for (var i = 0; i < scriptList.length; i++) {
var currentScript = new File(scriptList[i]);
// Check if the script file exists
if (currentScript.exists) {
try {
$.writeln("Running script: " + currentScript.fsName);
app.doScript(currentScript, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT); // Execute the script inside InDesign
} catch (error) {
$.writeln("Error running script: " + currentScript.fsName + "\n" + error);
}
} else {
$.writeln("Script not found: " + currentScript.fsName);
}
}
$.writeln("All scripts executed.");
}
// Run the script runner
runScriptRunner();