2017-04-21 45 views
1

在AppleScript的,我知道如何做一个典型的找到类似: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 

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

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 

我得到的错误:

没有结果从这个表达式的某些部分被退回。

为什么找不到记录或列表?有没有一种方法可以设置多文件搜索的功能?

回答

1

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


要想从find命令的记录:

showing results属性必须是returning results属性必须真实,否则findFunction 变量将是不确定的

他re的脚本:

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 
相关问题