У меня есть приложение Applescript, которое копирует определенный файл .txt и пустой Capture One Pro .session из ресурсов пакета приложения - в новые имена и местоположения, выбранные пользователем., затем откроется Capture One (id C1PR).
Скрипт работает, но я все еще немного новичок в кодировании, поэтому я надеялся, что есть лучший способ написать это.В частности, если 4 x отдельных «диалоговых окна отображения» и «выберите папки» можно заменить на 2x «выберите имя файла с подсказкой« s ?
Я не понял, как использовать , выбрать имя файла и затем создать эту папку, сохраняя при этом ввод имени, чтобы сделать переменные "newJobName" или "seshName" для дальнейшего использования.,
Буду очень признателен за любые советы по его устранению и любые советы по использованию подсказки «Выбор имени файла» из дополнений сценариев пользовательского ввода.Спасибо!
Вот текущий скрипт.
set logoIcon to alias ((path to me as string) & "Contents:Resources:Ourlogo.icns")
set bundleResources to (path to me as string) & "Contents:Resources:"
set defaultLocation to (path to desktop) as alias
set newJobname to text returned of (display dialog "TODAY'S JOB NAME:" with title "OurCompany New Job" default answer "Job-2018-00-00" with icon logoIcon)
set newLoc to (choose folder with prompt "CHOOSE SAVE LOCATION FOR TODAY'S JOB:" default location defaultLocation)
tell application "Finder"
set newJobDirectory to make new folder at newLoc with properties {name:newJobname}
set getJobBrief to file "job_brief_template.rtf" of (bundleResources as alias) --getting job brief from bundle and renaming to match today's job after duplicating
duplicate getJobBrief to newJobDirectory
set name of document file "job_brief_template.rtf" of newJobDirectory to newJobname & ".rtf"
make new folder at newJobDirectory with properties {name:"Raw Folder"} --creating standard folders required for our daily jobs
make new folder at newJobDirectory with properties {name:"Mark Ups"}
make new folder at newJobDirectory with properties {name:"Resources"}
make new folder at newJobDirectory with properties {name:"JPGS"}
make new folder at newJobDirectory with properties {name:"No Retouching"}
set seshName to text returned of (display dialog "TODAY'S CAPTURE SESSION NAME:" default answer newJobname with icon logoIcon) --usually the same as the newJobName but need to give user a choice to ammend it.
set the clipboard to {text:seshName, Unicode text:seshName} --setting job name to clipboard in case Capture Session doesn't work.
set targetSesh to (choose folder with prompt "CHOOSE LOCATION FOR TODAY'S CAPTURE SESSION:" default location defaultLocation)
set newSeshDirectory to make new folder at targetSesh with properties {name:seshName}
make new folder at newSeshDirectory with properties {name:"Capture"} --creating standard Capture One Pro session folders
make new folder at newSeshDirectory with properties {name:"Selects"}
make new folder at newSeshDirectory with properties {name:"Output"}
make new folder at newSeshDirectory with properties {name:"Trash"}
set getSeshDoc to file "session.cosessiondb" of (bundleResources as alias) --getting blank session from bundle and renaming to match today's job after duplicating
duplicate getSeshDoc to newSeshDirectory
set name of document file "session.cosessiondb" of newSeshDirectory to seshName & ".cosessiondb"
set openSesh to result --variable to tell Capture One application to open
end tell