Copy link to clipboard
Copied
Hello, I am currently attempting to get a script to batch-photomerge a bunch of my photos. However, I am receiving "Error Message: 48, file or folder could not be found". I have triple checked that this file actually does exist in the proper location, so I'm not sure why this is happening. Reading through the forums, a few other users who had this problem were able to fix it by reinstalling photoshop, however, this did not work for me. Most of the threads had gone dead after this. Additionally, I tried placing the file into another folder; using the same file path as the other scripts that come preloaded, that are located in the same folder; removing the parentheses; and saving the script to another .jsx file and running it from there; and adding and removing the semi-colon after line 5.
I have tried this on a Mac, and a P.C, using Photoshop cc 15 and Photoshop cc 2018, all with the same result. I'm hoping that it's as simple as the script being wrong, or having to update my PS version! Thank you for trying to help.
This is the script I have been trying to use:
//This will be the direcotry of the images
var workFolder = Folder("C:\Users\Kevin\Desktop\BatchMerge");
var folders = workFolder.getFiles();
runphotomergeFromScript = true;
$.evalFile("C:\Program Files\Adobe\Adobe Photoshop CC 2018\Presets\Scripts\batchmerge.jsx");
psdOpts = new PhotoshopSaveOptions();
psdOpts.embedColorProfile = true;
psdOpts.alphaChannels = true;
psdOpts.layers = false;
tiffOpts = new TiffSaveOptions();
psdOpts.layers = false;
for( var i = 0; i < folders.length; i++ )
{
if (folders instanceof Folder){
var folder = folders;
var fList = folder.getFiles( '*.tif' );
// override Photomerge.jsx settings. Default is "Auto". Uncomment to override the default.
//photomerge.alignmentKey = "Auto";
//photomerge.alignmentKey = "Prsp";
//photomerge.alignmentKey = "cylindrical";
//photomerge.alignmentKey = "spherical";
//photomerge.alignmentKey = "sceneCollage";
photomerge.alignmentKey = "translation" ; // "Reposition" in layout dialog
photomerge.advancedBlending = true; // 'Bend Images Together' checkbox in dialog
photomerge.lensCorrection = false; // Geometric Distortion Correction'checkbox in dialog
photomerge.removeVignette = false; // 'Vignette Removal' checkbox in dialog
if( fList.length > 1 )
{
photomerge.createPanorama(fList,false);
}
var doc_name = fList[0].name;
var final_name = doc_name.slice(0,-6);
activeDocument.saveAs( new File( fList[0].parent+'/'+final_name+'.psd') , psdOpts, true, Extension.LOWERCASE);
activeDocument.saveAs( new File(workFolder.parent+'/'+final_name+'.tif') , tiffOpts, true, Extension.LOWERCASE);
activeDocument.close( SaveOptions.DONOTSAVECHANGES );
}
}
You need double backslash else use forward slash in the path. Single backslash will fail.
Copy link to clipboard
Copied
I think your issue is that $.evalFile() takes a File object as its input while you are inputting a path to the file as a String.
Try creating a File first and then using that as the input:
var batchMergeFile = new File("C:\Program Files\Adobe\Adobe Photoshop CC 2018\Presets\Scripts\batchmerge.jsx");
$.evalFile(batchMergeFile);
Hopefully that helps!
Copy link to clipboard
Copied
You need double backslash else use forward slash in the path. Single backslash will fail.
Copy link to clipboard
Copied
Hello, I was wondering if you could help with something else related to this script?
I am currently receiving a:
"Error 27: Stack Overrun
Line: 37
-> photomerge.createPanorama(flist, false);
I tried commenting out the other functions that call photomerge, but I'm still getting the error. Is it possible that the variable "flist" from line 23 is trying to grabbing too many files for line 35 to create Panoramas?
Line 23, and Line 35:
var fList = folder.getFiles( '*.tif' );
if( fList.length > 1 )
{
photomerge.createPanorama(fList,false);
}
Copy link to clipboard
Copied
Photomerge is something I have never tried, but I think I can remember people having problems with 32bit files.
If your files are 32bit try 8 or 16 bit files and see if they work.
Hopefully someone with a lot more knowledge will pop in to help.
Copy link to clipboard
Copied
I just tested and apparently $.evalFile() can take either a File object or a string containing the full path to the file so my comment wont actaully help...
Hopefully SuperMerlin's double backslash answer does the trick!
Copy link to clipboard
Copied
Thank you for your help. The other method worked.
Copy link to clipboard
Copied
Awesome, thanks! This seems to resolve the issue!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now