scripted find routine still broken in 9.0.2

1 view
Skip to first unread message

Whiterock

unread,
Oct 24, 2008, 9:57:35 PM10/24/08
to BBEdit Talk
"Returning results:true" does not trigger "find" to issue a list of
found matches. BBEdit continues to act as if "false" was requested.

The result of find in nor class "record" instead of "list of list" as
it was before but it is still not of type "Search Match" and cannot be
converted to "Search Match".

I am surprised this has not been fixed but I guess Applescript has low
priority.

find thePattern searching in fileRef options {search mode:grep,
returning results:true, starting at top:true, showing results:false,
case sensitive:false, extend selection:false, match words:false}
without selecting match

Jim Correia

unread,
Oct 29, 2008, 9:55:38 AM10/29/08
to bbe...@googlegroups.com
On Oct 24, 2008, at 9:57 PM, Whiterock wrote:

> I am surprised this has not been fixed but I guess Applescript has low
> priority.

AppleScript is an important feature in BBEdit. This has not been fixed
because it isn't broken.

> "Returning results:true" does not trigger "find" to issue a list of
> found matches. BBEdit continues to act as if "false" was requested.

`returning results: true` indicates to the "find" verb that it should
return any result it has. What it will not do is change the "find"
commands behavior from iterative to batch.

What follows is an important, but subtle (and sometimes confusing)
point. I've logged a bug so that we can better document this in the
future, and provide examples.

There is a single "find" command which can work in both iterative and
batch "modes". It will do a batch find instead of an iterative find
based on the search targets and how they are expressed.

If you want a batch find, the best way to guarantee that is to specify
your search targets as a list.

For example:

find thePattern searching in {fileRef} options ...

Once you do that, `returning results: true` will return the results to
your script.

> The result of find in nor class "record" instead of "list of list" as
> it was before but it is still not of type "Search Match"

This is simply an artifact of AppleScript. (See commands in the
Standard Additions, provided by Apple, which act the same way.)

A record is returned. The terminology declares the return type as
Search Match so that you can see what fields are available in the
record which will be returned. The actual return type will be a
record. It shouldn't be necessary to do type introspection at runtime
- just use the result.

Jim

Michael Richards

unread,
Oct 30, 2008, 11:15:49 PM10/30/08
to bbe...@googlegroups.com
Thanks Jim.

I was searching a single file for multiple instances of a pattern and
wanted the matches returned as strings. As it is a single file, I had
not included the {list} brackets. This is not the behaviour I remember
from six months ago.

My app works now, I just have to figure out other supposedly simple
aspects that are rendered obscure by Apple's inattention.


2008/10/29 Jim Correia <cor...@barebones.com>:

Reply all
Reply to author
Forward
0 new messages