0

我们得到了一些具有以下模式的项目 ID 的文件夹:x123_projectname。

我在工作流程中使用Alfred,我需要通过 ID 查找并打开特定文件夹。可以从 Alfred 运行 AppleScript。我是applescript的新手,谷歌帮助我创建了这个:

set theString to "/path/to/folder/containing/projects/"
display dialog "What is the ID?" default answer ""
set theID to the text returned of 
    (display dialog "What is the ID?" default answer "")

tell application "Finder"
    activate
    set x to theString & "theID" as alias
    open x
end tell

但它没有用 - 你对我有什么提示吗?

4

1 回答 1

0

您的脚本存在一些问题,但总的来说您的想法是正确的。主要问题是 applescript 不适用于斜线分隔的路径。Applescript 路径以冒号分隔。您可以使用“posix file”命令将斜杠转换为冒号分隔。试试这个。祝你好运。

set theString to "/path/to/folder/containing/projects/"
display dialog "What is the ID?" default answer ""
set theID to the text returned of result

set macString to POSIX file theString
tell application "Finder"
    activate
    set theResult to every folder of macString whose name contains theID
    open theResult
end tell
于 2013-07-10T12:49:15.543 回答