Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Sorting lines of text in TCEdit

Aug
2,799
144
I want the ability to sort lines of text while inside TCEdit.

To do this,
I created an AutoHotKey script,
and added it to my HotStrings.ahk file.

Code:
#HotIf WinActive("ahk_exe TCEdit.exe")
^+x:: {   ; Ctrl (^) + Shift (+) + X
    ; Select all
    Send("^a")
    Sleep 60

    ; Copy 
    Send("^c")

    ClipWait(2)

    txt := A_Clipboard
    txt := Sort(txt, "U")
    A_Clipboard := txt
   
    Sleep 80 ; Paste the result (replaces the highlighted text)
    Send("^v")
}
#HotIf

This code uses the U sort option,
which removes duplicate items from the list so that every item is unique.

The link below (in Ref.) provides the other sort options that can be used.

Now, when in TCEdit,
I press Ctrl+Shift+X,
and all the lines that are in TCEdit are sorted,
and duplicate lines removed.

Ref: Sort - Syntax & Usage | AutoHotkey v2

Joe
 
Back
Top