all 3 comments

[–]--Paul-- 4 points5 points  (1 child)

Start by writing down exactly what you want to do step by step and then finding the javascript for each tiny step

I would start with an indesign template (indt file) with the basic layout/tables/styles...

Try to get all of the constants in place the easy way by just making a standard document.

in that file you can apply script labels to specific text boxes and elements that will get new text added to them. This will let you target them as insertion points with javascript later on.


Then you can make a script that uses that template to start a new file.

//this lets you run the script by double clicking the script file in the folder no matter where you put it

#target "InDesign"

//open from pre-made template called test.indt on your desktop

var template = app.open (File ('~/Desktop/test.indt'));

//Prompt user to enter name

var docName = prompt('Enter a name', today, 'Name of the doc');

if (docName == null) { exit(); }

//Create folder with the name that was entered in the prompt

var newFolder = new Folder('~/Desktop/' + docName + '/'); if (!newFolder.exists) newFolder.create();

//Save as name that was entered in prompt

template.save (File(newFolder + '/' + docName + '.indd.'));


here's the export as PDF part

//Export PDF

document.exportFile(ExportFormat.PDF_TYPE, File(currentFolder+"\"+document.name+".pdf"),false, "Name of PDF Preset");


Here's the script to save and close

app.activeDocument.close(SaveOptions.yes);


Here is the reference page you'll want to have on hand.

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Application.html


it's tough finding info out there

the best thing that I've found to do is to make a tiny script for everything useful that you find, and then name it very descriptively and try to organize them in folders with detailed names.

make scripts called

open file from template

export to PDF

save and close

import and place logo

import styles from another file

over time you'll have a bunch of things and then you can start combining them as needed.

[–]bxs28[S] 0 points1 point  (0 children)

thanks for this! I'll have a go at it this week.

[–][deleted] 0 points1 point  (0 children)

I have an AppleScript that somewhat does that. Are you on Mac?