Ниже приведена упрощенная версия скрипта, с которым я работал (и имел помощь).и все работает нормально.Я хочу развить это, поэтому при запуске скрипта он показывает диалоговое окно с кнопками, которые выполняют следующие действия.
Кнопка 1 запускает «Spec1» и «Spec2»
Кнопка 2 запуска«Spec2» и «Spec3»
Кнопка «три» показывает диалоговое окно со списком для выбора «Spec1», «Spec2», «Spec3» (как это уже делает скрипт)
Окончательный сценарийбудет иметь еще несколько спецификаций, однако этого будет достаточно, чтобы проиллюстрировать, чего я пытаюсь достичь
Спасибо
-- Spec realted file extensions
--Spec 1
set ListSpec1 to {"_0006", "_0007", "_0010", "_0011"}
--Spec 2
set ListSpec2 to {"_0000", "_0001", "_0002", "_0003", "_0004", "_0005"}
--Spec 3
set ListSpec3 to {"_0006"}
-- Obtain user choice of PS action
set PhotoshopActionList to {"Spec1", "Spec2", "Spec3"}
set ChosenSpec to choose from list PhotoshopActionList with title "Actions Picker" with prompt "Choose Action?"
-- If user cancels, then terminate the script
if ChosenSpec is false then
error number -128 (* user cancelled *)
else
set ChosenSpec to ChosenSpec's item 1 (* extract choice from list*)
end if
--Set image source folder
set SourceFolder to (choose folder with prompt "Choose Base Images:")
set FoldertoReplace to SourceFolder & ChosenSpec as text
--set image save folder
set DestinationFolder to (choose folder with prompt "Choose Save Location:")
set filelocation to DestinationFolder as text
--Setting Files list
tell application "Finder" to set filesList to files of entire contents of SourceFolder whose name ends with ".tif"
repeat with CurrentFile in filesList
tell application "Finder"
set NameF to name of CurrentFile
set currentFileAlias to (CurrentFile as alias) as text
end tell
-- Canadian Files Lists
if ChosenSpec is "Spec1" then
set theListSpecToUse to ListSpec1
else if ChosenSpec is "Spec2" then
set theListSpecToUse to ListSpec2
else
set theListSpecToUse to ListSpec3
end if
-- the file name contains a valid pattern, then process the file
if FNameOK(NameF, theListSpecToUse) then
--open photoshop
tell application "Adobe Photoshop CC 2017"
open alias currentFileAlias
--Canadain Actions
if ChosenSpec is "Spec1" then
do action "Spec1" as text from "Specs"
else if ChosenSpec is "Spec2" then
do action "Spec2" as text from "Specs"
else if ChosenSpec is "Spec3" then
do action "Spec3" as text from "Specs"
end if
--Saving to Format
-- Canadian Saves
if ChosenSpec is "Spec1" then
save current document in filelocation as TIFF with options {class:TIFF save options, image compression:LZW, transparency:true, embed color profile:true}
else if ChosenSpec is "Spec2" then
save current document in filelocation as TIFF with options {class:TIFF save options, image compression:LZW, transparency:true, embed color profile:true}
else
save current document in filelocation as PNG with options {class:PNG save options, compression:9, interlaced:false} appending no extension with copying
end if
--Close Photoshop Document
close current document without saving
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