简体   繁体   English

从Photoshop Java脚本中的指定文件夹中获取文件名

[英]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. 我有一个脚本,该脚本需要三个输入并将其插入主要功能。

  1. set the input folder 设置输入文件夹
  2. File Names 档案名称
  3. Output Name 输出名称

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

  1. 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”并将该文件夹中的所有文件名加载到文件名变量中吗?

  2. 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.

相关问题 Photoshop脚本-从外部文件获取单词 - Photoshop script - get word from external file 如何为Java Photoshop脚本设置预选文件夹 - How to set a preselected folder for a Java Photoshop Script 从指定文件夹和所有子文件夹获取文件名的循环 - js - For loop that gets file names from specified folder and all subfolders - js PHP:如何从文件夹中读取文件名并将此文件名加载到Java脚本数组中? - PHP: How can I read from a folder filenames and load this file names in a Java script array? Photoshop 脚本 - 尝试替换项目根文件夹中的图像 - Photoshop Script — Trying to Replace an image from project root folder 将图层名称复制到 Photoshop 中的文本框的脚本 - Script to copy Layer Names to text box in Photoshop Java Photoshop 脚本“在名称中带有自定义前缀的原始图像文件夹中另存为 JPEG” - Java script for Photoshop to "Save as JPEG in origin image folder with custom prefix in the name" Photoshop脚本 - 调整文件夹中的图像大小(对话框) - Photoshop Script - resize images in folder (dialog box) Photoshop 脚本:从列表中选择 - Photoshop script: Choose from list Google脚本可在父文件夹中获取文件夹名称 - Google script to get folder names within a parent folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM