Copy link to clipboard
Copied
I have an Applescript that gathers a bunch of JPEGs, which I then combine into a PSD with File -> Scripts -> Load Files Into Stack…
However, I'd like to automate that final step if possible. Can I send a list of files to the Load Files Into Stack script from my Applescript?
I'm not sure if or how Applescript can pass an array of file objects but the javascript function below accepts an array and stacks without a dialog. You will need to edit the include path to match your system
function runLoadStack( fList ){
var loadLayersFromScript = true;// must be set before the include
// @include '/C/Program Files/Adobe/Adobe Photoshop CS4/Presets/Scripts/Load Files into Stack.jsx'
var aFlag = true;
loadLayers.intoStack( fList, aFlag );
}
Copy link to clipboard
Copied
Let me add that it does occur to me I could open all the files and use UI scripting to call the script, click the "Add Open Files" button, then click OK. However, that won't work if there are any other files open in Photoshop at the time, which is why I ask. Thank you.
Copy link to clipboard
Copied
I'm not sure if or how Applescript can pass an array of file objects but the javascript function below accepts an array and stacks without a dialog. You will need to edit the include path to match your system
function runLoadStack( fList ){
var loadLayersFromScript = true;// must be set before the include
// @include '/C/Program Files/Adobe/Adobe Photoshop CS4/Presets/Scripts/Load Files into Stack.jsx'
var aFlag = true;
loadLayers.intoStack( fList, aFlag );
}
Copy link to clipboard
Copied
Thank you! Is there way I can pass just the name of the folder that contains the images I want in the stack? I explored the .jsx file but couldn't quite figure it out. That may save me the trouble of figuring out how to pass an Applescript list as a JavaScript array.
Copy link to clipboard
Copied
If you can pass the full path to the folder as a string this should work.
function runLoadStack( folderPath ){// full path as String
var loadLayersFromScript = true;// must be set before the include
// @include '/C/Program Files/Adobe/Adobe Photoshop CS4/Presets/Scripts/Load Files into Stack.jsx'
var folder = new Folder( folderPath );
var fList = folder.getFiles('*.jpg')
var aFlag = true;
loadLayers.intoStack( fList, aFlag );
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now