3 Replies Latest reply on Sep 29, 2010 10:00 AM by mkeatley17

    Detect Folder with Droplet

    mkeatley17 Level 1

      I am making a droplet and I would like it to behave one way when a file is dropped on it and another way when a folder is dropped on it.

       

      I normally refer to my main object using app.activeDocument.  But if someone drops a folder on the droplet, it doesn't open in Photoshop, so I have no way of referring to the object.

       

      In other words, when a droplet opens a file and runs an action, is there a way to refer to the file other than just with the app.activeDocument?

       

      Thank you

        • 1. Re: Detect Folder with Droplet
          Michael L Hale Level 5

          I am not sure what you are asking. Photoshop can not open folders, only image files. Are you saying that when you drop a folder containing images on a droplet the images do not open?

           

          Droplets are a type of stored batch action and as far as I know there is no way to tell from a script inside the droplet if a single file or folder was dropped. The script will only see one file at a time either way.

           

          In addition to app.activeDocument you can refer to the doc opened by a droplet by index. app.documents[app.documents.length-1]; refers to the last opened document, which would be the one opened by the droplet.

          • 2. Re: Detect Folder with Droplet
            mkeatley17 Level 1

            so I want a droplet that bascially does this:

             

            1.  When you drop a FILE on the droplet, it copies the files to our server

            2.  When you drop a FOLDER on the droplet, it renames the FILES inside the FOLDER to the name of the FOLDER, then copies the FILES to our server

             

            So basically I want the droplet to detect whether a FILE or FOLDER is being dropped on it, and be able to get the name of the FOLDER also.

             

            Is this possible?

             

            Thank you

            • 3. Re: Detect Folder with Droplet
              Michael L Hale Level 5

              Michael L Hale wrote:

               

              ... as far as I know there is no way to tell from a script inside the droplet if a single file or folder was dropped.