I have been using the following script for over four years; it has
worked fine for me until I upgraded to the latest version. Now, when I
run the script, no results window opens. If I copy the grep string
created by the script and paste it into a multi-file find window in
BBEdit, it produces the desired results. Why am I not seeing a results
window for my find?
--Find one to three terms, in any order, in a sentence of the open
files in BBEdit
--Author: Allen Watson
--Date: Wednesday, October 10, 2007
property threeOrders : {{1, 2, 3}, {1, 3, 2}, {2, 3, 1}, {2, 1, 3},
{3, 1, 2}, {3, 2, 1}}
tell application "BBEdit"
activate
set findstring to ""
set searchParams to text returned of (display dialog ¬
"Find in same sentence: Enter 1 to 3 words or phrases to search
for
in any order, separated by slashes, " & "e.g., 'word1/phrase 2/word 3"
default answer "")
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"/"}
set theTerms to text items of searchParams
set AppleScript's text item delimiters to oldDelims
set theCount to count items of theTerms
if theCount = 1 then
set findstring to item 1 of theTerms
else if theCount = 2 then
set findstring to "(" & (item 1 of theTerms) & "[^.?!\")]+" &
(item
2 of theTerms) & ")|(" & (item 2 of theTerms) & "[^.?!\")]+" & (item 1
of theTerms) & ")"
else if theCount = 3 then
repeat with i from 1 to 6
set order to item i of threeOrders
set findstring to findstring & "("
repeat with k in order
set findstring to findstring & (item k of
theTerms) & "[^.?!\")]+"
end repeat
set findstring to findstring & ")|"
end repeat
set findstring to text 1 thru -2 of findstring -- string the
last |
end if
find findstring searching in every text window options {search
mode:grep, case sensitive:false, match words:true, extend
selection:false, showing results:true}
end tell
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>