Copy link to clipboard
Copied
Hello,
I am a graphic designer with minimal knowledge of JS and I am currently trying to figure out how to do the following…
I have two Photoshop action scripts:
1) The first one alters an image to be put into a particular template layout that shows the item as a finished product.
2) The second one saves the image and then closes it from Photoshop.
(I was using this action inside the File>Automate>Batch feature to save all opened windows that were made from the first script, into a selected destination folder)
I want to have a script that searches through our main directory and looks inside each folder and sub-folder, for folders that are titled ‘WEB IMG’.
Once it finds one, have it run the first script on those images(jpgs) and then have the second action (the save) put them inside that same folder. When finished running that folder, have it then continue searching for the next folder called ‘WEB IMG’. Repeating this process until all folders have been searched and operated on.
How do I accomplish this? I searched online for awhile but couldn’t find anything that was of the same situation as this.
The closest thing I found was this but still…
https://forums.adobe.com/thread/1853028
Any help would be REALLY appreciated.
Thank you,
Juan
Copy link to clipboard
Copied
juangong2015 wrote:
I am a graphic designer with minimal knowledge of JS and I am currently trying to figure out how to do the following
I have two Photoshop action scripts:
I want to have a script that searches through our main directory and looks inside each folder and sub-folder, for folders that are titled ‘WEB IMG’.
Once it finds one, have it run the first script on those images(jpgs) and then have the second action (the save) put them inside that same folder.
Repeat this process until all folders have been searched and operated on.
How do I accomplish this?
I searched online for awhile but couldn’t find anything
Learn JS and Photoshop Scripting and program the process. Processing all needles in a haystack may take some time. While you are developing your script test it on a small haystack with one or two needles in it.
Copy link to clipboard
Copied
This little function will iterate through a directory's files and subfolders. The only required parameters are a folder to search in (line 1), and a keyword to look for (line 2).
You can do whatever you want once it finds the specific folders you're targeting (line 10).
var mainFolder = new Folder('~/Desktop/Delete');
findFolders(mainFolder, 'WEB IMG'); // Define keyword
function findFolders(folder, key) {
var files = folder.getFiles();
for(var i = 0; i < files.length; i++) {
if(files instanceof Folder) { // Make sure it's a folder
if(decodeURI(files.name).indexOf(key) >= 0) { // Filter by keyword
// Do something - Run actions
}
// Continue recursive function
findFolders(files);
}
}
}
Hope it helps