我尝试创建一个脚本,将模板文件夹复制到当前查找程序窗口,然后根据对话框输入重命名新文件夹及其中的几个文件。
到目前为止,我已经知道它可以将文件夹(从选择中)复制到当前的查找程序窗口并重命名。但我无法将其重命名为其中的文件。
这是代码 -
property A : POSIX file "/BLOCKED OUT FOR PRIVACY/" as alias
property B : POSIX file "/BLOCKED OUT FOR PRIVACY/" as alias
property C : POSIX file "/BLOCKED OUT FOR PRIVACY/" as alias
property D : POSIX file "/BLOCKED OUT FOR PRIVACY/" as alias
tell application "Finder"
set x to target of window 1 as alias
end tell
set JobName to text returned of (display dialog "Enter Folder Name:" default answer "Template Folder")
set CATno to text returned of (display dialog "Enter CAT number:" default answer "CMXX0000")
set optionList to {"OPTION 1", "OPTION 2", "OPTION 3", "OPTION 4"}
set chosenFolder to choose from list optionList with prompt "Choose a Folder"
set chosenFolder to chosenFolder's item 1
if chosenFolder is "OPTION 1" then
tell application "Finder"
set FolderCopy to duplicate B to x
set the name of FolderCopy to JobName
set Insert to (POSIX path of (path to home folder)) & "DVD Insert Artwork/Indesign Project File/_Insert.indd" as POSIX file
set the name of Insert to JobName & CATno
end tell
end if
我已经删除了POSIX文件路径,因为它们包含我的公司名称等。我还遗漏了if的其他部分,因为它们基本上与第一部分重复。
set Insert to (POSIX path of (path to home folder)) & "DVD Insert Artwork/Indesign Project File/_Insert.indd" as POSIX file
set the name of Insert to JobName & CATno
这是给我带来麻烦的部分。它应该将新复制的文件夹中的文件重命名为CATno对话框中输入的内容+" _Insert.indd"
非常感谢任何帮助!
谢谢:)
答案 0 :(得分:1)
我不确定,但你的意思是这个吗?
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
statementGroupSelectionModel.setSelected(item, profile.getSelected());
}
});
从重复文件夹中获取对indesign文件的引用。