【问题标题】:Applscript- Use List to Select Specifc Photoshop ActionApplescript- 使用列表选择特定的 Photoshop 动作
【发布时间】:2018-11-11 15:58:33
【问题描述】:

我一直在尝试使用我所拥有的知识编写一个 Applescript

目前的绊脚石是

-获取返回的列表选择以运行 Photoshop 操作

-如何在多个图像上重复操作。

瞄准 我想使用一个列表从定义的文件夹中提取不同的文件组合(具有设置的命名约定), 然后,我希望相同的列表选择在多个 photoshop 操作之间进行选择,并通过该操作运行提取的文件组合。

第一阶段 -在运行时打开一个列表

-包含一组与 Photoshop 操作相关的名称的列表

-从列表中选择

第 2 阶段 - 选择包含源图像的文件夹(总是 14 个图像,最后 9 个字符总是相同的 _0000.tif 到 _0013.tif)

-选择一个保存文件夹

第 3 阶段 - 依赖于原始列表选择,自动从源图像文件夹中收集文件并通过相应的 photoshop 操作运行它们

例如,如果从列表中选择“动作 1”,则从源文件夹中选择图像“_0001.tiff & _0010.tif”并执行 Photoshop 动作“Action1”

第四阶段 保存在选定的“保存文件夹”中

到目前为止的脚本

--第一阶段--

set PhotoshopActionList to {"Action1", "Action2", "Action3", "Action4", "Action5"}

set ActionrequiredAnswer to choose from list PhotoshopActionList with title "Actions Picker" with prompt "Choose Action?"


if ActionrequiredAnswer is false then
    error number -128 (* user cancelled *)
else
    set ActionrequiredAnswer to ActionrequiredAnswer's item 1 (* extract choice from list*)
end if

end run

--第二阶段--

property SourceFolder : missing value
property destinationFolder : missing value

if SourceFolder = missing value then
    set SourceFolder to (choose folder with prompt "Choose Base Images:")
    set destinationFolder to (choose folder with prompt "Choose Save Location:")
else

    tell application "Finder"
        set theFolders to every item of entire contents of SourceFolder as list
        repeat with thisFolder in theFolders
            make new alias file at destinationFolder to thisFolder
        end repeat
    end tell
end if

--第三阶段--

tell application "Finder"
    set filesList to {files of entire contents of SourceFolder contains "_001", "_002", "003"} as alias list
end tell

tell application "Adobe Photoshop"
   repeat with aFile in filesList
       open aFile

       do action "Action1" from "Actionsfolder"
end tell

--第四阶段--

save currentDocument in folder destinationFolder as JPEG

【问题讨论】:

  • “我正在努力将所有核心领域拉到一起” - 请edit your question 澄清一下绊脚石到底在哪里?
  • 感谢您的回复,更新了,应该更清楚我现在在挣扎什么,

标签: list applescript action photoshop tiff


【解决方案1】:

我没有找到一种方法来选择文件夹的全部内容并过滤扩展名 'tif'、'tiff'、.. 并过滤名称中包含您的模式的文件。

作为解决方法,我做了两个步骤:

1) 在整个内容中仅选择具有目标扩展名的文件。

2)我遍历这些文件以检查文件名是否包含目标模式。这是由例程 FnameOK 完成的。

您需要使用 Photoshop 操作和“另存为”来完成以下脚本:

set PhotoshopActionList to {"Action1", "Action2", "Action3", "Action4", "Action5"}
set ListOK to {"_001", "_002", "003"}
set ActionRequiredAnswer to choose from list PhotoshopActionList with title "Actions  Picker" with prompt "Choose Action?"
if ActionRequiredAnswer is false then
    error number -128 (* user cancelled *)
else
    set ActionRequiredAnswer to ActionRequiredAnswer's item 1 (* extract choice from list*)
end if

set SourceFolder to (choose folder with prompt "Choose Base Images:")
set DestinationFolder to (choose folder with prompt "Choose Save Location:")

tell application "Finder" to set filesList to files of entire contents of SourceFolder whose name extension is in {"tiff", "tif"}

repeat with aFile in filesList
    tell application "Finder" to set NameF to name of aFile
    if FNameOK(NameF, ListOK) then -- the file name contains a valid pattern, then process the file
        tell application "Adobe Photoshop" 
            open (aFile as alias)
            -- perform action selected
            -- save as to Destination Folder
        end tell
    end if
end repeat

on FNameOK(Local_Name, LocalList) -- check if the file name contains an element of the list
    set LocalCheck to false
    repeat with OneItem in LocalList
        if Local_Name contains OneItem then
            return true
        end if
    end repeat
    return false
end FNameOK

【讨论】:

  • 您好,感谢您的回复,我刚刚尝试了脚本 a 并且它在创建别名列表时卡住了?我尝试将其从别名列表更改为仅列表,但在设置 NameF 时卡住了。任何帮助的想法都非常感谢。谢谢J
  • 这个脚本在我的 mac 上完美运行。唯一的区别是我称其为“Adobe Photoshop CS3”,因为我有一个旧的 Photoshop 版本。但是不会影响文件列表。您确定您使用了与脚本中相同的语法吗?你的错误是什么?哪条线? (注意,当然,如果你改变我使用的语法,你会得到别名列表,你可能不再得到别名......然后下一条指令将失败。
  • 再次感谢您的回复我收到以下错误错误“无法制作别名 \":Users:User:Desktop:Base Image Folder:\" 的 «class ects» 的每个文件其扩展名 = {\"tiff\", \"tif\"} 到类型别名列表中。"从别名“:Users:User:Desktop:Base Image Folder:”的每个«class ects»文件中编号-1700,其名称扩展= {“tiff”,“tif”}到«class alst»谢谢J
  • 对不起,我的错误。我错误地复制了我的脚本。该线路现已更新,以及开放线路。
  • 这太棒了,非常感谢您的帮助!!
猜你喜欢
  • 2011-04-10
  • 1970-01-01
  • 2018-12-20
  • 1970-01-01
  • 1970-01-01
  • 2012-04-05
  • 2010-10-27
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多