Copy link to clipboard
Copied
Hello all!
I have a series of very effective scripts that I am running against a series of photoshop files. Now the big quiestion!
Is there a program to
1) "watch" a folder, so when a file is saved in that folder.
2) It runs my script(s) on that file?
If you look at it simply-- I would like to replace the "drag and drop" method used for droplets, with the "drop in the folder" method.
No doubt this would require a separate program, to consistently check the folder for new files.
This is something that I would prefer to tackle with python, but maybe you all in the community could provide me with a more "industry accepted" solution?
Oh and Ideally I would run this on both mac and PC.... though I understand if windows makes more sense for an operation like this.
Best,
Thomas Murphy
1 Correct answer
Hi Tomas
If you manage to have a computer just to deal with it having Bridge opened on the "hotFolder", you can use Bridge to do that.
- Select a folder on your network to be the "hotFolder" (you can change its name and in the code itself);
- On the computer that will be the listener over the hotFolder, just put this code on the Bridge "Startup Scripts" folder and reopen Bridge
- Using another computer, put some images in the folder "hotFolder" and check is the listener event handler reacts automatically.
Explore related tutorials & articles
Copy link to clipboard
Copied
I do not think there is a standard "Watched Folder" than works the same on different platforms. If you search this forum site you will find a question similar to yours in forum for several of Adobe products. There are also questions on how the process should work. Thing to considered like how to handle new files being dropped in while the process is running where output is stored are process file moved out/deleted etc from the watched folder. Should the process be started by a drop in event or on a schedule. There many thought but no standard feature that I know of.
Copy link to clipboard
Copied
Can you name a program that you have used at least for mac?
Copy link to clipboard
Copied
I chose to use Windows more things are available for windows compared to Mac and Linux.
Copy link to clipboard
Copied
What programs have you used for windows?
Copy link to clipboard
Copied
I don't do anything like that and if a wanted to automate something like that I thing I would just schedule a job the would check a folder on some schedule. If I want it done immediately I would run the process rather than use a watched folder. I would also think that Mac OSX would have a scheduler like windows.
Copy link to clipboard
Copied
yeah I know these programs exist. I'm asking for recommendations.
Copy link to clipboard
Copied
Hi Tomas
If you manage to have a computer just to deal with it having Bridge opened on the "hotFolder", you can use Bridge to do that.
- Select a folder on your network to be the "hotFolder" (you can change its name and in the code itself);
- On the computer that will be the listener over the hotFolder, just put this code on the Bridge "Startup Scripts" folder and reopen Bridge
- Using another computer, put some images in the folder "hotFolder" and check is the listener event handler reacts automatically.
- You can then add your code in the lines (see line 25) or use the file as an argument to run other code you want;
- In the end, after the file was processed, just move it or remove it;
- This listener will be triggered anytime a file is added or removed or the cache is refreshed. It works only on a folder called "hotFolder";
Hope it helps,
var listenerHotFolder = function( event ) {
// IMPORTANT: $.hiresTimer > 180000 this will make sure to trigger only once on cached folders like the hot folder, because when a file is detected it trigers twice (start building cache and finishing building cache).
if ( event.object instanceof Document && event.type == 'loaded' && $.hiresTimer > 180000) {
// only works if the active folder name is "hotFolder" case sensitive
if (app.document.thumbnail.name.toLowerCase() == "hotfolder") {
var myFiles_array = [];
// if doesn't exist, creates a subfolder to move the active processing files
var processingFolder = Folder(app.document.presentationPath + "\\processing");
if (!processingFolder.exists) processingFolder.create();
// You can change the image kind you want to deal with, or other file kind
var items = Folder(app.document.presentationPath).getFiles( function(f) { return (f instanceof File && f.name.toLowerCase().match(/\.dng|cr2|jpe?g$/) != null);}); // JPG | CR2 | DNG
for (var a=0 ; a < items.length ; a++) {
var copied = File(decodeURI(items)).copy( File(File(decodeURI(items)).path + "/processing/" + File(decodeURI(items)).name ) );
if (copied) {
$.writeln(File(File(decodeURI(items)).path + "/processing/" + File(decodeURI(items)).name ).fsName)
myFiles_array.push(File(File(decodeURI(items)).path + "/processing/" + File(decodeURI(items)).name ).fsName);
File(decodeURI(items)).remove();
}
}
app.document.thumbnail.refresh();
// if files were dropped on the hotFolder, and were collected, any script can be running on each file.
if (myFiles_array.length > 0) {
for (var a=0 ; a < myFiles_array.length ; a++) {
// here you can put your code
// this is just an exemple to test (you can delete this later:
alert("Processing the File:\n" + File(decodeURI(myFiles_array)).name);
}
}
}
//
return {
// FALSE + block last path repetition »» só repete o evento numa numa pasta (não repete em F5 ou em cache rebuild) Resumo: sá actua se navegar numa nova pasta
// TRUE + block last path repetition »» repete em várias situações: numa nova pasta, ao criar/apagar ficheiros/pastas no folder activo, ao reordenar a primeira vez (qd cria a primeira vez o file invisivel .bridgesort)
handled:true
}
}
}
app.eventHandlers.push( {handler: listenerHotFolder} );
Copy link to clipboard
Copied
Thank you Pedro- perfect!
Copy link to clipboard
Copied
Opps. Seems like it's not working for some reason.. I need it to launch photoshop, and it seems to fail-- is there a way to run this script via photoshop-- or can you show me an example where you plop the code in? It seems when I place my script in here it fails to run or even open photoshop.
Copy link to clipboard
Copied
Hi
The script is prepared to function with Bridge always active (bring to front).
If you are using photoshop, Bridge will loose focus and will fail.
That is why i said to send images to the network hotFolder from another computer and leave this one to have Bridge always on focus.
There is also another chance of using the 2 apps. But more complex. If you make sure some how to make Bridge "bring to front" (to focus) when you need to run this listener, it should work. You can use BridgeTalk to communicate between the 2 apps to embed the other app code.
Copy link to clipboard
Copied
Hi,
I use the scripts on this post Automatically run scripts on files in a specific folder
Pedro Cortez Marques's answer. it works fun. But Could anyone tell me how to return to bridge to reactive the hotfolder listner with ps scripts.
THanks a lot.
my best regards!
Copy link to clipboard
Copied
Get.
BridgeTalk.bringToFront( 'bridge' )
Copy link to clipboard
Copied
Hi Pedro,
This script is really awesome! I hope you wouldn't mind if I post it on my site with some sample code of my own.
Regards,
Kasyan
Copy link to clipboard
Copied
Thank you Kasyan.
Please do.
All we need is to bring forward the hidden gems that Bridge still has.
Bridge has a lot more to give that people don't use. Specially big teams and big image data.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Have you moved your site to another address? / ah right, you removed .com
Copy link to clipboard
Copied
Thanks for the useful script. can this be modified to watch two (or more) folders at the same time?
Help will be appreciated.
Copy link to clipboard
Copied
Hi,
I never tested to watch 2 hotFolders the same time, but I would prefer to have those 2 different folders inside an hotFolder and check them both and its contents.
Copy link to clipboard
Copied
Can anybody tell me if this works in CC 2022? I'm unable to get it to run.
Copy link to clipboard
Copied
Do these work for you?
https://github.com/Paul-Riggott/PS-Scripts/blob/master/Bridge%20Hot%20Folder.jsx
http://kasyan.ho.ua/bridge/hot_folder_in_bridge/hot_folder_listener.html
http://kasyan.ho.ua/bridge/watched_folder/watched_folder.html
http://kasyan.ho.ua/bridge/hot_folder_in_bridge/hot_folder_in_bridge.html
Copy link to clipboard
Copied
Hi Stephen,
I will check them out this morning. Just starting my day at the office aka kitchen table.
Thank you!

