Hi Christopher & Christopher,

Seems there is an off by one somewhere.

You should mail the issue to [email protected].

Regards,

Jean Jourdain

*tell* *application* "BBEdit"

*set* vDocument *to* *make* new *document* with properties {contents:"def 
do_something( doohickeis )\ndoohickeis.each do | whatsit 
|\nwhatsit.this!\nwhatsit.that!\nprint whatsit\nend\nend\n"}

*set* vNeedle *to* "whatsit"

*set* vFoundObjects *to* {}

*select* *insertion point* *before* *text* *of* vDocument

*repeat*

*set* vResult *to* *find* vNeedle searching in vDocument options {starting 
at top:*false*, wrap around:*false*, search mode:*literal*, returning 
results:*false*} *with* selecting match

*if* (vResult's found) *then*

*set* *end* *of* vFoundObjects *to* vResult's found object

*log* {(vResult's found object) *as* *string*, vResult's found text, *its* 
selection *as* *string*}

*else*

*exit* *repeat*

*end* *if*

*end* *repeat*

*select* vFoundObjects

selection

*end* *tell*

*-- Replies*

*tell* *application* "BBEdit"

*make* new *document* with properties {contents:"def do_something( 
doohickeis )\ndoohickeis.each do | whatsit 
|\nwhatsit.this!\nwhatsit.that!\nprint whatsit\nend\nend\n"}

--> *text document* 1

*select* *insertion point* *before* *every* *text* *of* *text document* 1

*find* "whatsit" searching in *text document* 1 options {starting at top:
*false*, wrap around:*false*, search mode:*literal*, returning results:
*false*} *with* selecting match

--> {found:*true*, found object:*characters* 53 *thru* 59 *of* *text 
document* 1, found text:"whatsit"}

*get* *characters* 53 *thru* 59 *of* *text document* 1

--> "whatsit"

*get* selection

--> "whatsit"

(*whatsit, whatsit, whatsit*)

*find* "whatsit" searching in *text document* 1 options {starting at top:
*false*, wrap around:*false*, search mode:*literal*, returning results:
*false*} *with* selecting match

--> {found:*true*, found object:*characters* 63 *thru* 69 *of* *text 
document* 1, found text:"whatsit"}

*get* *characters* 63 *thru* 69 *of* *text document* 1

--> "whatsit"

*get* selection

--> "whatsit"

(*whatsit, whatsit, whatsit*)

*find* "whatsit" searching in *text document* 1 options {starting at top:
*false*, wrap around:*false*, search mode:*literal*, returning results:
*false*} *with* selecting match

--> {found:*true*, found object:*characters* 77 *thru* 83 *of* *text 
document* 1, found text:"whatsit"}

*get* *characters* 77 *thru* 83 *of* *text document* 1

--> "whatsit"

*get* selection

--> "whatsit"

(*whatsit, whatsit, whatsit*)

*find* "whatsit" searching in *text document* 1 options {starting at top:
*false*, wrap around:*false*, search mode:*literal*, returning results:
*false*} *with* selecting match

--> {found:*true*, found object:*characters* 97 *thru* 103 *of* *text 
document* 1, found text:"whatsit"}

*get* *characters* 97 *thru* 103 *of* *text document* 1

--> "whatsit"

*get* selection

--> "whatsit"

(*whatsit, whatsit, whatsit*)

*find* "whatsit" searching in *text document* 1 options {starting at top:
*false*, wrap around:*false*, search mode:*literal*, returning results:
*false*} *with* selecting match

--> {found:*false*}

*select* {*characters* 53 *thru* 59 *of* *text document* 1, *characters* 63 
*thru* 69 *of* *text document* 1, *characters* 77 *thru* 83 *of* *text 
document* 1, *characters* 97 *thru* 103 *of* *text document* 1}

*get* selection

--> {*characters* 53 *thru* 58 *of* *text document* 1, *characters* 63 
*thru* 68 *of* *text document* 1, *characters* 77 *thru* 82 *of* *text 
document* 1, *characters* 97 *thru* 102 *of* *text document* 1}

*end tell*

Result:

{*characters* 53 *thru* 58 *of* *text document* 1 *of* *application* 
"BBEdit", *characters* 63 *thru* 68 *of* *text document* 1 *of* 
*application* "BBEdit", *characters* 77 *thru* 82 *of* *text document* 1 
*of* *application* "BBEdit", *characters* 97 *thru* 102 *of* *text document* 
1 *of* *application* "BBEdit"}


On Monday, November 8, 2021 at 10:40:41 AM UTC+1 [email protected] wrote:

> On Nov 08, 2021, at 00:14, Christopher Waterman <[email protected]> 
> wrote:
>
> If I select every occurrence of "whatsit" through which ever means.
>
> ...
>
>
> Then run this AppleScript.
>
> AppleScript:
> tell window 1 of application "BBEdit"
> set stuff to get selection
> end tell
>
> *It returns a list like this.*
>
> ------------------------------
>
> Hey Christopher,
>
> I don't see how you're getting a list of selected items.
>
> If I use find with show matches it doesn't work.
>
> If I use LiveSearch it doesn't work.
>
> So how exactly are you doing your selection?
>
>
> --
> Best Regards,
> Chris
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/b5fa857a-0f89-4df9-95b5-b7f9758eae15n%40googlegroups.com.

Reply via email to