I think it is going to be easy.

tell application "BBEdit"
set the_text to the selection
set my_line to line 1 of the_text
end tell

Not "paragraph 1." Line 1. Took a long time to trial-and-error that over here.

c
On Jun 22, 2011, at 8:52 AM, Warren Michelsen wrote:

> This ought to be very easy. I have html documents containing tables. No 
> colspan or rowspan properties are used so each table row has the same number 
> of columns.
> 
> The documents are formatted such that each table row is one line in the 
> document; the line starts with "<tr> and ends with "</tr> so that a complete 
> row can be selected by selecting a complete line.
> 
> Now then, I seem to be having a problem using AS to select the first line of 
> a document's selection.  I've tried all kinds of things up to:
> 
>       set my_line to paragraph 1 of the selection of text document 1 of text 
> window 1
> 
> I keep getting the error: "An attempt was made to resolve an Apple Event 
> reference to a non-existent object."
> 
> How does one set a variable to the first line of the selected text of the 
> front-most BBEdit document window?
> 
> All I want to do is get the characters of that first line and count the 
> instances of "<td" to determine how many columns the selected table has.
> 
> I thought this was going to be easy... 
> 
> -- 
> 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>


--
Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants
310-452-3720

Read the Boyce Blog: http://christianboyce.blogspot.com
Follow us on Twitter! http://twitter.com/christianboyce
Be a fan on Facebook! http://tinyurl.com/cboyce-and-associates-facebook

Now Playing on The Boyce Blog: Search Google Images by COLOR

-- 
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>

Reply via email to