OK, something simpler. Scripting. Finding parts of a document and noting their positions.

if I run --

tell application "BBEdit"
find Some_Literal searching in text document 1 options {search mode:literal, starting at top:true} with selecting match
end tell

-- afterward the sought text is selected, and the result of the find includes the "found object" reference value, like:

found object:characters 9774 thru 9798 of text document 1 of application "BBEdit"

Or, if I just ask BBEdit for "the selection" it will give me the same kind of reference (characters 9774 thru 9798 of text document 1 of application "BBEdit")

The stupid problem I am having is that I want to capture that number (9774) and use it later -- but I can't find how to get Applescript to give me access to the elements of a reference. Anything I do with "found object of the result" gets me the referent value, the found string. Like, asking for "word 2 of found object of the result" gets me the second word of the found text itself. I understand WHY it happens, but how do I get around it?

How does one get the character offset of the selection as a number, for use later?

Thanks,

Dave Cortesi
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to