On Nov 03, 2014, at 12:08, Thomas Mai <[email protected]> wrote:
> Since last weekend I'm a new BBEdit user.
______________________________________________________________________

Hello Thomas,

Welcome to the madhouse.  :)

> • How do I position the cursor at a certain *column* ("Line Number" for 
> columns so to say)?

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2014/11/03 14:45
# dMod: 2014/11/03 14:51
# Appl: BBEdit
# Task: Go-To Column Number of Current Line: Opens a dialog for the user to 
enter a number.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Go-To, @Column
-------------------------------------------------------------------------------------------

try
  
  tell application "BBEdit"
    tell me to set columnNum to (text returned of (display dialog "Enter Column 
Number:" default answer "")) as integer
    tell front text window
      tell line (startLine of selection)
        select insertion point after character columnNum
      end tell
    end tell
  end tell
  
on error e number n
  set e to e & return & return & "Num: " & n
  if n ≠ -128 then
    try
      tell current application to button returned of ¬
        (display dialog e with title "ERROR!" buttons {"Copy Error Message", 
"Cancel", "OK"} ¬
          default button "OK" giving up after 30)
      if ddButton = "Copy" then set the clipboard to e
    end try
  end if
end try

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

> • Is there a "duplicate line" command?

------------------------------------------------------------------------------------------
# Auth: Christopher Stone <[email protected]>
# dCre: 2012/09/17 18:29
# dMod: 2014/11/03 14:33
# Appl: BBEdit
# Task: Duplicate selection.  If no selection exists duplicate the line where 
cursor is.
# Libs: None
# Osax: None 
# Tags: @Applescript, @Script, @BBEdit, @Duplicate, @Selection
------------------------------------------------------------------------------------------

try
  
  tell application "BBEdit"
    tell text of front text window
      set _sel to selection
      set selLen to length of _sel
      
      if selLen = 0 then
        select line (get startLine of _sel)
        set _sel to selection
        set selLen to length of _sel
        if selLen = 0 then return
      end if
      
      set _endLine to endLine of _sel
      set _text to contents of text of _sel
      set lineCount to count of (paragraphs of _text)
      set after line _endLine to return & _text
      set _sel to selection
      select (characters ((characterOffset of _sel) + 1) thru ((characterOffset 
of _sel) + (selLen)))
    end tell
  end tell
  
on error e number n
  set e to e & return & return & "Num: " & n
  if n ≠ -128 then
    try
      tell current application to button returned of ¬
        (display dialog e with title "ERROR!" buttons {"Copy Error Message", 
"Cancel", "OK"} ¬
          default button "OK" giving up after 30)
      if ddButton = "Copy" then set the clipboard to e
    end try
  end if
end try

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

> • What for would you use "Exchange Characters"? (Just curious because I never 
> felt a demand for that)


It's been around forever in editors like VI and EMACS.  A common typo is letter 
transposition, and this command makes correction simple.

That's all I can help with at present.

--
Best Regards,
Chris

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