1 Reply Latest reply on Dec 13, 2016 1:48 AM by Loic.Aigon

    Placed item Wild Card

    Babymac08 Level 1

      I have been trying unsuccessfully to change this command to a wild card statement for files in this folder... I may be mixing two different scripting styles together but not sure...  Creating a Hot folder that will grab files as they are placed in folder... Have it working successfully when I use a generic file.opendialog option but want it to grab the file from the folder...


      Help Please...


      //This is just the place portion of my entire script...


      //Place New Image

      var image = File('~/Desktop/Files/*.*');

      var newimage = docRef.placedItems.add(); 

      newimage.file = image; 

      newimage.position = [200,-300];

        • 1. Re: Placed item Wild Card
          Loic.Aigon Adobe Community Professional

          Declaring a File instance imply to specifically path an url to a File whatever it exists or not at the time.

          You can't use such a shortcut for getting any files of the folder. Instead you may want to use Folder.getFiles()


          //Place New Image
          var fo = Folder ( '~/Desktop/Files' );
          var files = fo.getFiles ( /* you may want to use a filter function here. See doc */ );
          var file, newimage;
          while ( file = files.pop() ) {
            newimage = docRef.placedItems.add(); 
            newimage.file = file; 
            newimage.position = [200,-300];





          Ozalto | Productivity Oriented - Loïc Aigon