Use this code,
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
var templateFile = File("D:/Demo/Template/Sample_Template_2.indt");
var sourceFolder = new Folder("D:/test");
var fileList = sourceFolder.getFiles(/\.indd$/i);
for (var i = 0; i < fileList.length; i++)
var myDoc = app.activeDocument;
Sorry, how do I convert this code into a .jsx file to add to the Scripts Panel folder of InDesign?
Yep I'm aware of where to put the file, however, copying and saving that code as a .jsx file, adding it to Scripts Panel and running it through InDesign did not do anything. So I'm wondering if I'm not saving it properly.
You have to adapt the code to your needs. Change the path strings to the folder paths where you store an InDesign template file and another one where you have to store the inDesign files you want to change.
Then a revised request would be a script where when you double click the script, it opens the Finder for you to direct it to the template and to the source folder of InDesign files. I have similar scripts for loading Character and Paragraph styles and need one for Tags. The source folder will always be different so I need it to work where when you double click the Script, it opens the window for you to select the template, then opens a window for you to select the source folder of documents to load into.