That's dependent upon the application. But in BBEdit 10, it would be:

   tell application "BBEdit 10"
        set myText to contents of selection
   end tell

…or the shorter form below. So then the script would be:

----------------------------

set myNewTextList to {}

tell application "BBEdit 10" to set myText to contents of selection
repeat with myItem in paragraphs of myText
    tell myItem
        if (count words) > 0 then
            try
set myNumber to word 1 as integer --If this fails, nothing else up to the "on error" executes.
                set myNumberString to word 1
                set myIncrement to 0
                set end of myNewTextList to myItem & "\r"
            on error
                set myIncrement to myIncrement + 1
                if myIncrement < 10 then
set mySubIncrementString to ".0" & (myIncrement as string) & " "
                else
set mySubIncrementString to "." & (myIncrement as string) & " "
                end if
                set myNewIncrement to myNumberString & mySubIncrementString
                set end of myNewTextList to myNewIncrement & myItem & "\r"
            end try
        else
            set end of myNewTextList to "\r"
        end if
    end tell
end repeat
set myText to myNewTextList as string
return myText

----------------------------

On 12/15/14 7:30 PM, Vlad Ghitulescu wrote:
Hi, Rick!


That works! Thanks!

I have one question:


Am 15.12.2014 um 07:53 schrieb Rick Gordon <[email protected] <mailto:[email protected]>>:

--But you'd probably capture it with a selection.

How you do this in AppleScript?

___________________________________________
RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________
WWW: http://www.shelterpub.com

--
This is the BBEdit Talk public discussion group. 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>

--- 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 post to this group, send email to [email protected].

Reply via email to