Open find window with options

604 views
Skip to first unread message

Oliver Taylor

unread,
May 30, 2012, 6:47:39 PM5/30/12
to bbe...@googlegroups.com
I'd like a hotkey that brings up the find window with specified options (the find options are sticky but when I hit this key I want them to be reset to my specs). I've got the following applescript, but it doesn't populate the search field or fill-out the options.

(I don't know much about applescript)

tell application "BBEdit"
try
open find window
find "hello" searching in text of front text window options {search mode:grep, starting at top:false, wrap around:true, backwards:false, case sensitive:false, match words:false, extend selection:false} with selecting match
end try
end tell

Also, when I hit "return" the window goes away, but when I hit the hotkey for "previous" (shift-command-G) the window stays open, is there a way to "find previous" and dismiss the window with one keystroke?

Christopher Stone

unread,
May 30, 2012, 10:06:29 PM5/30/12
to bbe...@googlegroups.com
On May 30, 2012, at 17:47, Oliver Taylor wrote:
I'd like a hotkey that brings up the find window with specified options (the find options are sticky but when I hit this key I want them to be reset to my specs). I've got the following applescript, but it doesn't populate the search field or fill-out the options.

(I don't know much about applescript)

tell application "BBEdit"
try
open find window
find "hello" searching in text of front text window options {search mode:grep, starting at top:false, wrap around:true, backwards:false, case sensitive:false, match words:false, extend selection:false} with selecting match
end try
end tell
______________________________________________________________________

Hey Oliver,

This is the scripted find command and has nothing to do with the find dialog.

As far as I can see there is no way to do what you want.

Put some text in the find dialog and run this:

tell application "BBEdit"
properties of find window
end tell

It doesn't give you much.

I suggest you make a feature suggestion to support.  If you do you can add me as a +1 - I think the find window should be more scriptable.

Also, when I hit "return" the window goes away, but when I hit the hotkey for "previous" (shift-command-G) the window stays open, is there a way to "find previous" and dismiss the window with one keystroke?

I don't see any way.

You think that Shift-Return/Enter would find backwards though.

--
Best Regards,
Chris

Oliver Taylor

unread,
Jun 3, 2012, 2:39:21 PM6/3/12
to bbe...@googlegroups.com
Thanks Chris, I'll file the requests.

But I was able to work around the problem by creating the following applescript (I call it "Quick Grep Search Forward"):

--Display Dialog and Get Input

display dialog "Grep Search for..." default answer ""


--Get Answer & Return Comment

set theSearch to (text returned of result)


tell application "BBEdit"

try

find theSearch searching in text of front text window options {search mode:grep, starting at top:false, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false} with selecting match

end try

end tell

Christopher Stone

unread,
Jun 3, 2012, 3:11:12 PM6/3/12
to bbe...@googlegroups.com
On Jun 03, 2012, at 13:39, Oliver Taylor wrote:
> But I was able to work around the problem by creating the following applescript (I call it "Quick Grep Search Forward"):
______________________________________________________________________

Hey Oliver,

You didn't ask how to script the find action. :)

There are two or three versions of that in the archives.

--
Best Regards,
Chris


Reply all
Reply to author
Forward
0 new messages