2 Replies Latest reply on Sep 3, 2013 2:27 AM by davidDav

    open multiple extensions

    davidDav

      Hi All,

       

      My script not working for multiple extensions

       

       

      var mySourceFolder = Folder("/WATCHED_FOLDER/IN_QXD");

      var quark_files = getFiles(mySourceFolder,[], ".qxp" , ".qxd");

       

      or

       

      var indesign_files = getFiles(mySourceFolder,[], ".indd" , ".INDD");

       

      how can i open the indesign (or) qurak files without finding extensions

      Note: I have Q2ID plugin in indesign

       

      any help would be appreciated !

       

       

      Thanks in advance

      David

        • 1. Re: open multiple extensions
          Trevorׅ Adobe Community Professional

          Hi David

           

          Regarding the getFiles you have your structure wrong.

          The Folder goes before the get files and not in the brackets and inside the brackets goes a file mask.

          You can look up in the toolguide how to use this.

          One can put a regex as the mask so you can do this:

           

          var mySourceFolder = Folder("/WATCHED_FOLDER/IN_QXD");

          var quark_files = mySourceFolder.getFiles (/\.qxp|\.qxd/i);

           

          The 2 / wrap up the regex the i at the end make it case insensitive (i.e. .qXp is also fine) the | means or and the \ escapes the dots.

           

          This method will find aliases - short cuts like myFile.qxp.ink :-) but would also find myFile.qxp.think which you might not want it to. If you add a $ after the p and the d it will only find were the file extension end in qxp or qxd so if you wanted to be safe you could do

          var quark_files = mySourceFolder.getFiles (/\.qxp$|\.qxd$/|\.qxd\.ink$|\.qxd\.ink$i);

          (See the toolguide for differences between mac and windows regarding .ink handling but I think my method is safe for all)

           

          Regarding finding quark files without an extension, I don't have to much of a clue but on Macs you might be able to use file.type but I doubt it.

           

          Good luck

          Trevor

          • 2. Re: open multiple extensions
            davidDav Level 1

            Hi Trevor,

             

            You gave me the best method, its working fabulous, also I learned form you

             

            Thank you very much

             

             

            David