1

在 AppleScript 中,我知道如何通过以下方式进行典型查找:

tell application "BBEdit"
    activate
    open find window
    find "memberFunction\\(\\)" searching in text 1 of text document "theFile" options {search mode:grep, wrap around:true} with selecting match
end tell

我可以进行多文件搜索查找:

tell application "BBEdit"
    activate
    find "memberFunction\\(\\)" searching in {file "path:to:project.bbprojectd:"} options {search mode:grep, showing results:true}
end tell

但我想返回 find multi 结果并将其保存到文件中,所以我想我需要将其保存到记录或列表中,然后重复输入,但是当我尝试时:

tell application "BBEdit"
    activate
    set findFunction to {}
    set findFunction to {find "memberFunction\\(\\)" searching in {file "path:to:project.bbprojectd:"} options {search mode:grep, showing results:true}} as list
end tell

或者:

set findFunction to {find "memberFunction\\(\\)" searching in {file "path:to:project.bbprojectd:"} options {search mode:grep, showing results:true}} as record

我收到以下错误:

此表达式的某些部分未返回任何结果。

为什么没有将查找设置到记录或列表中?有没有办法可以设置多文件搜索的功能?

4

1 回答 1

1

错误是您将find命令放在列表中。


从 find 命令获取记录:

showing results属性必须为falsereturning results属性必须为true,否则findFunction变量将 未定义

这是脚本:

tell application "BBEdit"
    set findFunction to find "memberFunction\\(\\)" searching in file "path:to:project.bbprojectd:" options {search mode:grep, showing results:false, returning results:true}
end tell
于 2017-04-22T04:35:03.100 回答