2 Replies Latest reply on Dec 9, 2009 5:29 AM by SurreyPolice13785

    [JS CS3, Win] Saving InDesign using app.activeDocument.save

    SurreyPolice13785

      Hello.

       

      I am having problems saving an InDesign document using Javascript.

       

      My aim is to have a box in the document where I will type the filename and path where I want the InDesign file to be saved (eventually this will be generated from a datamerge).

       

      I then want to run a script which will read the contents of the box and then save the document to that filename or location.

       

      At the moment I have:

       

      //SaveText.jsx
      //An InDesign CS3 JavaScript
      //
      //Saves the document to the provided path

      //get contents of the FileNameBox box on the document
      var varFileName = app.activeDocument.textFrames.item("FileNameBox").contents;
      //now save
      app.activeDocument.save("/"+ varFileName+".indd");

       

      //alert (app.activeDocument.filePath);

       

      When I run the script (with "Hello" in the FileNameBox) the file changes name on the top bar of InDesign to "Hello.indd", but (when I run the commented out alert at the end) the file is not actually saving anywhere.

       

      If I close InDesign and then open it the file is listed under "Open Recent" on the menu, but clicking it does nothing - again the file doesn't exist.

       

      Does anyone have any ideas to help me from tearing my hair out?

       

      Where is my file saving? (Or, if it isn't, how can I make it save!).

       

      Thanks in advance for any help you can offer.