【发布时间】:2015-03-26 21:33:38
【问题描述】:
我正在尝试通过自动化服务创建一个快捷方式,该服务会将所选文件向上移动到目录中。如下:
获取选定的 Finder 项目
获取变量
Path的值-
运行 Applescript:
on join(someList, delimiter) set prevTIDs to AppleScript's text item delimiters set AppleScript's text item delimiters to delimiter set output to "" & someList set AppleScript's text item delimiters to prevTIDs return output end join to split(someText, delimiter) set AppleScript's text item delimiters to delimiter set someText to someText's text items set AppleScript's text item delimiters to {""} return someText end split on run {input, parameters} set pathToMe to POSIX path of (item 1 of input as text) set newPath to split(pathToMe, "/") set revPath to reverse of newPath set restList to rest of revPath set restList to rest of restList set joinPath to join(reverse of restList, "/") set source to POSIX file joinPath return source end run 设置变量
Parent的值将 Finder 项目移至
Parent
Applescript 解析Path 中的第一个文件路径以查找项目的祖父母,并将其作为 POSIX 文件字符串返回。问题是“移动查找器”操作只接受文件/文件夹。如何使用结果字符串选择目标父文件夹,以便将其传递给“移动查找器”操作?
我尝试过的事情:
- 在
Run Bash Script中使用mv:Run Applescript操作似乎没有向Run Bash Script返回任何内容;设置为作为参数输入,“$@”始终为空。 - 在
Run Applescript中执行tell finder。没有错误或警告,只是没有任何反应。 - 手动设置
parent变量的值。
提前致谢!
【问题讨论】:
标签: service applescript workflow automator finder