Как запустить Applescript Photoshop Автоматизировать пакет действий - PullRequest
0 голосов
/ 24 июня 2019

Я пытаюсь создать Applescript, который запустит Photoshop и вызовет функцию Automate Batch для запуска определенного действия. У меня нет опыта в этом, и я получил только фрагменты кода из моего поиска. Мне было интересно, может ли кто-нибудь помочь мне в этом ... в частности, возможно ли вообще передать исходную папку в пакетный вызов, а затем как сделать пакетный вызов.

В частности, у меня проблемы с попыткой выяснить, как:

  1. Передать исходную папку в пакетные параметры

  2. Вызов определенного действия в Batch_Options из моего Photoshop

  3. Запустить пакетный вызов с этими параметрами

Я обновил последний код, который частично там есть ...

tell application "Finder"
    set sourceFolder to "Macintosh HD:Users:Joe:Desktop:Temp:" as alias
    set folderList to every item of folder sourceFolder as alias list

    do shell script "echo File Names are: " & folderList
end tell

tell application "Adobe Photoshop CC 2018"
    set action_set_name to "Save as Photoshop PDF"
    activate
    try
        set Batch_Options to {class:batch options, destination:save and close, error file:Error_File, file naming:{document name lower, extension lower}, macintosh compatible:true, override open:false, override save:true, suppress open:true, suppressprofile:true, unix compatible:true, windows compatible:true}
        batch "Save" from files folderList from action_set_name with options Batch_Options
    end try
end tell
* * Тысяча двадцать-одина выход:

«Имена файлов: Macintosh HD: пользователи: Joe: рабочий стол: Temp: Creature01_CO_v003.psdMacintosh HD: пользователи: Joe: рабочий стол: Temp: SecretLab Laboratory.psd»

Фотошоп открывается, а потом ничего не происходит ...

1 Ответ

0 голосов
/ 25 июня 2019

В Automator работает следующее:

    tell application "Finder"
        set sourceFolder to "Macintosh HD:Users:Joe:Desktop:Temp:" as alias
        set folderList to every item of folder sourceFolder as alias list
        do shell script "echo File Names are: " & folderList

        #Alias list needs to be converted to a string for it to work in Photoshop batch call
        set FileNames to {}
        repeat with i from 1 to the count of folderList
            set current_file to item i of folderList
            copy current_file as text to the end of FileNames
        end repeat

        #Setup error log
        set err_log to (sourceFolder as string) & "Error_Log.txt"
        if not (exists file err_log) then
            make new file at sourceFolder with properties {name:"Error_Log.txt"}
        end if
    end tell

    tell application "Adobe Photoshop CC 2018"
        set action_set_name to "SetA"
        activate
        set Batch_Options to {class:batch options, destination:save and close, error file:err_log, file naming:{document name lower, extension lower}, macintosh compatible:true, override open:false, override save:true, suppress open:true, suppressprofile:true, unix compatible:true, windows compatible:true}
        #First arg is the Action Name, second is the list of files, third is the Action Set Name
        batch "ActionA" from files FileNames from "SetA" with options Batch_Options
    end tell
...