2017-04-21 42 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 
相關問題