Applescript工具:基于团队成员名称将文件复制到预设目录
我不是一个程序员,而是一个相当大的项目的艺术总监,我每天都做很多重复性的工作。一个常量是将文件移动到团队成员的文件夹中。我想能够选择一些文件,并有一个菜单出现,让我选择谁将接收文件 我取得了一些进步,但我被卡住了。脚本找不到我希望文件进入的目录。我担心它与POSIX路径有关——或者我没有将其定义为文件夹而不是文件?错误内容如下: 错误“未找到文件/Volumes/Workbench/Test/CookieMonster”。编号-43来自“/Volumes/Workbench/Test/CookieMonster” …甚至你也有一个文件夹,上面说没有。我怀疑我的语法不正确Applescript工具:基于团队成员名称将文件复制到预设目录,applescript,Applescript,我不是一个程序员,而是一个相当大的项目的艺术总监,我每天都做很多重复性的工作。一个常量是将文件移动到团队成员的文件夹中。我想能够选择一些文件,并有一个菜单出现,让我选择谁将接收文件 我取得了一些进步,但我被卡住了。脚本找不到我希望文件进入的目录。我担心它与POSIX路径有关——或者我没有将其定义为文件夹而不是文件?错误内容如下: 错误“未找到文件/Volumes/Workbench/Test/CookieMonster”。编号-43来自“/Volumes/Workbench/Test/Cooki
set currentFolder to path to (folder of the front window) as alias
on error -- no open windows
set the currentFolder to path to desktop folder as alias
end try
set artistList to {"CookieMonster", "BigBird", "Bert", "Ernie", "Grouch"}
set assignTo to {choose from list artistList with title "Assign to..." with prompt "Please choose" default items "Bert"}
set assignedArtist to result
set artDeptDir to "/Volumes/Workbench/Test/"
set filePath to {artDeptDir & assignedArtist}
set destinationFolder to filePath as alias
set selected_items to selection
repeat with x in selected_items
move x to folder of filePath
end repeat
如果有人了解我的问题,我很乐意听取他们的意见。感谢您花时间阅读此文章。主要问题是
查找程序不接受POSIX路径。您必须使用HFS路径(以冒号分隔并以磁盘名开头)
此版本修复了另一个问题,并删除了冗余代码
tell application "Finder"
try
set currentFolder to (target of the front window) as alias
on error -- no open windows
set currentFolder to path to desktop
end try
set artistList to {"CookieMonster", "BigBird", "Bert", "Ernie", "Grouch"}
-- no braces {} !
set assignTo to (choose from list artistList with title "Assign to..." with prompt "Please choose" default items "Bert")
if assignTo is false then return
set assignedArtist to item 1 of assignTo
-- no braces {} !
set destinationFolder to "Workbench:Test:" & assignedArtist
move selection to folder destinationFolder
end tell