[英]Get file names from specified Folder in photoshop Java Script
I am a Photographer, I have very less knowledge of programing. 我是一名摄影师,我对编程的了解很少。
I have a script which requires three inputs which it plugs into the main function. 我有一个脚本,该脚本需要三个输入并将其插入主要功能。
please see below 请看下面
var INPUT_FOLDER = Folder.selectDialog ( "Where are your Images" );
var FILE_NAMES = ["image_1" , "image2","image3","image4"];
var OUTPUT_NAME = "Final Image";
main(INPUT_FOLDER, FILE_NAMES, OUTPUT_NAME);
Question 题
right now as you can see in the script Image names are defined in the script and it becomes extremely difficut to change them everytime. 现在,您可以在脚本中看到,图像名称是在脚本中定义的,每次更改它们都变得非常困难。
is there anyway that it searches the defined folder "INPUT_FOLDER" and loads all the file names in the folder to file names variable ? 无论如何,它搜索定义的文件夹“ INPUT_FOLDER”并将该文件夹中的所有文件名加载到文件名变量中吗?
Also similar to input select dialog, it will be great if we have a output window dialoge aswell (some thing like save window) where we can mention the processed image name and location to save it. 同样类似于输入选择对话框,如果我们也有一个输出窗口对话框(例如保存窗口),那将很棒,我们可以在其中提及已处理图像的名称和位置来保存它。
Thanks in Advance. 提前致谢。
Any suggestions on this will greatly help me. 关于此的任何建议将对我有很大帮助。
Thanks 谢谢
var INPUT_FOLDER = Folder.selectDialog ( "Where are your Images" );
// get an array of File objects inside INPUT_FOLDER
var FILES_ARRAY = INPUT_FOLDER.getFiles();
// get a saved file location
var OUTPUT_FILE = File.saveDialog( "Where would you like the image saved?" );
// now call the main function
main(INPUT_FOLDER, FILES_ARRAY, OUTPUT_FILE);
Note that the parameter types for main() have changed -- you'll now be passing an array of File objects instead of an array of file names, and the output file, too, is a File object instead of just a name. 请注意,main()的参数类型已更改-您现在将传递文件对象数组而不是文件名数组,并且输出文件也是文件对象,而不仅仅是名称。
You can find more about Photoshop's file scripting support in Adobe's Javascript Tools Guide . 您可以在Adobe的Javascript工具指南中找到有关Photoshop的文件脚本支持的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.