Opening two files from the same folder with-out getFiles()

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

Redrodan

Opening two files from the same folder with-out getFiles()

Post by Redrodan »

I know this sounds simple but I haven’t used JavaScript for Photoshop in about 2 years so I’m extremely rusty.

The script needs to open the two files from the same folder and the names probably won't always be the same. It will be a watch folder where images are dropped into the folder to be processed by Photoshop via Javascript.

Example
Folder contains:
image.jpg
image_mask.png

The rest of my script I have written but using hard-coded image paths/name. Mask is copied from PNG to JPG and then a bunch of processing is done and the final result is saved out.

On another script I’ve use something like the following below but it doesn’t seem to apply to this situation. Since the sample below loops through each file.

Code: Select allif (folderOne != null) {
   // Get all the files found in this folder
   var fileListOne = folderOne.getFiles().sort();
   
   //open each one in turn
   for (var i = 0; i < fileListOne.length; i++) {

   if (fileListOne instanceof File && fileListOne.hidden == false) {
   var docRef = open(fileListOne);
   etc...