Showing posts with label save file. Show all posts
Showing posts with label save file. Show all posts

Sunday

Save and name your indesign file

Now that you're able to create an Indesign document, lets save and give it a name.

But firstly, seeing the "Hello world" prompt gets boring very quickly, you can either comment it out by adding // to the beginning of the line and it will be ignored, or you can just delete it.

#target indesign
//Now you know how to add comments to your code
//alert("Hello world");
app.documents.add();


Ok, back to saving and naming your file in one go. Just add
#target indesign
//Now you know how to add comments to your code
//alert("Hello world");
app.documents.add();
app.documents[0].save();

Hit F5 (Ctrl+R on a mac) to run it.

Screenshot of the Save dialog box














Notice the [0] attached to app.documents[0].save(); this is important as you may have many documents open so you need to tell Indesign to use document 0, which is how counting in javascript works, [0] equals item1, [1] equals item2, [2] equals item3, and so on.

Next, we'll create a text frame and add content to it.