Skip to main content
Known Participant
July 28, 2014
Question

Monitor a folder, run Dr Brown's "Image Processor Pro" script, and move original file

  • July 28, 2014
  • 1 reply
  • 3991 views

I'm on a Windows machine.  Is is possible to have a script (command line or otherwise) monitor a folder for any new files (perhaps every 15 minutes or so would work as well)...then run Dr Brown's "Image Processor Pro" script, and then finally move the original file out of the folder?  I'm not sure how to automate this process.  Basically want to be able to drop very large image files into a folder, have them processed automatically (make several sizes/copies), and then archive the original.  Dr Brown's script seem awesome...but I don't want to have to manually do anything to get the thing rolling.  Is what I am trying to do possible?  Can you help me with this?

Thanks so much!

This topic has been closed for replies.

1 reply

JJMack
Community Expert
Community Expert
July 29, 2014

timlogochair wrote:

Basically want to be able to drop very large image files into a folder, have them processed automatically (make several sizes/copies), and then archive the original.  Dr Brown's script seem awesome...but I don't want to have to manually do anything to get the thing rolling.

No because you state that you do not want to do anything manually to get the thing rolling right after stating that you will be manually dropping large files into a folder to start with.

Since you are doing something manually why monitor a source image folder and start an automated process for if the process start as you are dropping a large set of large file into your source image folder. Some file may be processed and other may not for they did not exist when the automate process started, You seem to indicate that the process may use the Image processor pro script to process the images. The Image Processor pro would the get the list of files in the source image folder. These file would then be processed as your other large images are still being moved or copied into the source image folder  when the image processor pro script ends the automated process must then move the source images to an archive folder that process could move process and unprocessed image files now in the source image folder to the archive folder.

The Image Processor Pro script is also a Photoshop Plug-in which means you can record its use in an action. So all you need do is create an action the uses the image processor pro script to process you source image folder. When you record the action you will need to set all the options you want the script to use in its dialog.  These will be recorded into the action step by the image processor pro as the action step is recorded.  When the action is played there will be no dialog display no intervention needed the image processor pro script will run using the recorded dialog settings.  When the image processor pro action step completes its job the action need to then archive the source image folders files.  How the action does the may be platform dependent. For windows the action could use a Photoshop script that simply writes a windows bat command file containing a move file system command to move all files in the source image folder to the archive folder. once the temp bat file is written the script executes the file.

So after you manually drop all the files you want to processed in a batch and to drop  copy or move finishes all you need do is run the action in Photoshop. I have not used droplets in years perhaps the action could be turned into one and dropping the image onto the droplet may automate the whole thing. One version of Photoshop I installed had bugs in its droplet feature so I stopped using them for anything.

JJMack
Known Participant
July 31, 2014

Thank you so much for taking the time to help me.  I really appreciate it.

I am trying to go this route, and I like the solution if I can get the last part sorted out.

"Photoshop script that simply writes a windows bat command file containing a move file system command to move all files in the source image folder to the archive folder. once the temp bat file is written the script executes the file."  -  This is the part I'm not sure how to do.  Do you have an example of what this script looks like?  Is it a javascript file that I would edit in extendscript and then place it in the "scripts" folder?

By the way, I'm more than content to not "watch" the folder...and instead just run the script on a windows task scheduler once daily.

JJMack
Community Expert
Community Expert
July 31, 2014

Here is how I start a web browser for help on my Photo Collage Toolkit for the help buttons in my collage scripts dialogs. . So I can maintain a single copy remote from the users. That enables me to add information and news of updates and provide a download link.

Instead of writing a html file your Action would steps would be a  File Automate Image Processor Pro step followed File Script move files. The Photoshop Script move files script would write a bat file on windows that would do the move.  On a Mac ??? In the code below change URL to BAT and instead of the html stuff replace that with bat stuff.

You can use any text editor to create Photoshop scripts they are just text files. In fact Photoshop scripts can be used from any folder on your system if you don't put it in Presets\Scripts it will not be listed in File>Scripts>Script Names list.  You would need to browse to the folder when recording the action step. The script name would not be listed by name or run by an accidental click in the list. You don't want files to be archived and not processed.

try{

   var URL = new File(Folder.temp + "/PhotoCollageToolkit.html");

   URL.open("w");

   URL.writeln('<html><HEAD><meta HTTP-EQUIV="REFRESH" content="0; url=http://www.mouseprints.net/old/dpr/PhotoCollageToolkit.html"></HEAD></HTML>');

   URL.close();

   URL.execute();   // The temp file is created but this fails to open the users default browser using Photoshop CC prior Photoshop versions work

}catch(e){

alert("Error, Can Not Open.");

};

DOS move command

MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination

To rename a directory:

MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2

  [drive:][path]filename1 Specifies the location and name of the file

                          or files you want to move.

  destination             Specifies the new location of the file. Destination

                          can consist of a drive letter and colon, a

                          directory name, or a combination. If you are moving

                          only one file, you can also include a filename if

                          you want to rename the file when you move it.

  [drive:][path]dirname1  Specifies the directory you want to rename.

  dirname2                Specifies the new name of the directory.

  /Y                      Suppresses prompting to confirm you want to

                          overwrite an existing destination file.

  /-Y                     Causes prompting to confirm you want to overwrite

                          an existing destination file.

The switch /Y may be present in the COPYCMD environment variable.

This may be overridden with /-Y on the command line.  Default is

to prompt on overwrites unless MOVE command is being executed from

within a batch script.

JJMack