On Dec 24, 2011, at 12:05, Phil Dobbin wrote:
> I've got a file & I'm wondering is there a way to select all the text between 
> line 1 & line 1217 so it can be copied to the Clipboard rather than dragging 
> the cursor across it (I do this quite often on several files that are shared 
> across the LAN but not often enough nor regular enough to be able to run a 
> script, etc)? 
______________________________________________________________________

Hey Phil,

This one is quite easy as you'll see.

Manually copy to the clipboard:

try
        
        tell application "BBEdit"
                tell front text document
                        if (count of lines) ≥ 1217 then
                                select (lines 1 thru 1217)
                        else
                                error "Not Enough Lines!"
                        end if
                end tell
        end tell
        
on error errMsg number errNum
        set {cr, sep} to {return, "------------------------------------------"}
        set e to sep & cr & "Error: " & errMsg & cr & sep & cr & "Error Number: 
" & errNum & cr & sep
        beep
        display dialog e
end try

Let the script copy the text to the clipboard without selecting it:

try
        
        tell application "BBEdit"
                tell front text document
                        if (count of lines) ≥ 1217 then
                                set the clipboard to (get contents of (lines 1 
thru 1217))
                        else
                                error "Not Enough Lines!"
                        end if
                end tell
        end tell
        
on error errMsg number errNum
        set {cr, sep} to {return, "------------------------------------------"}
        set e to sep & cr & "Error: " & errMsg & cr & sep & cr & "Error Number: 
" & errNum & cr & sep
        beep
        display dialog e
end try

--
Best Regards,
Chris

-- 
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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to