Re: BBEdit 5 & selection-object
Re: BBEdit 5 & selection-object
- Subject: Re: BBEdit 5 & selection-object
- From: Ricardo Montiel <email@hidden>
- Date: Fri, 23 Feb 2001 16:32:12 -0300
on 22 Feb 2001 23:20, email@hidden wrote:
>
I had trouble with that one too, I think it's just confusing
>
documentation. I believe object is there as a descriptor not code. I
>
found these to work, although I lay no claim to their correctness :-)
>
>
on run
>
tell application "BBEdit 5.1"
>
>
set ln to (the number of lines of window 1)
>
set stln to startLine of selection as integer
>
set edln to endLine of selection as integer
>
>
set s31 to the offset of character 1 of line stln
>
set s32 to the offset of selection as integer
>
>
>
set e31 to the offset of character 1 of line edln
>
set e33 to the length of selection as integer
>
>
-- you can manipulate these numbers and then reselect text eg.
>
select characters s31 through e32 of line stln
>
>
end tell
>
end run
>
>
> Hallo,
>
>
>
> I wrote this:
>
>
>
> set x to line of selection-object
>
>
>
> After compile I get this:
>
>
>
> set x to (line of selection) - object
>
>
>
> What is wrong?
>
>
>
> Iam using BBEdit 5.0 and Script Debugger 1.0.4.
>
>
>
> Thank you
>
>
>
> Daniel Komrska jr.
Hi,
This works in BBEdit 5.1 to "record" a selected chunk of characters (for
example, as the result of a find task or as the result of a manual
selection; why bother with line numbers?), but it's not functional in v6.x:
set xSelStart to selection start
set xSelEnd to selection end
Do your stuff and then, when you need to reselect the text, use:
select (characters xSelStart thru xSelEnd)
HTH,
Saludos,
-- Ricardo