2 Replies Latest reply on Aug 20, 2014 1:14 AM by HanielMoore

    Indesign Scripting: How can I move a placed item using Javascript?


      Hey all,


      I have been trying to write a script that places a slug object from an indesign library on to a document and then moves it to my slug area. It all seems to work except the move command. I think the problem is that I haven't selected my placed asset correctly.


      Please help!


      This is what I have so far:


      //Create new document

      var doc = app.documents.add();



      // Get page size values

      var w = doc.documentPreferences.pageWidth;

      var h = doc.documentPreferences.pageHeight;



      //Create layer called SLUG

      var slugLayer = doc.layers.add({name:"SLUG"});



      //Set document slug area size

      doc.documentPreferences.documentSlugUniformSize = false;

      doc.documentPreferences.slugBottomOffset = "20 mm";



      //Open InDesign library file that contains the slug file

      var slugLibrary = app.open(File("/Users/Shared/Slug.indl"));



      //Place slug script to go here

      var myPlacedAsset = slugLibrary.assets.item("Slug");



      var mySlug = myPlacedAsset.placeAsset(doc);

      //Close the slug library


      // Move slug object to slug area




      //Lock SLUG layer

      slugLayer.locked = true;