Welcome!

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

SignUp Now!

TCEdit - Selecting Blocks of Code

Aug
2,320
111
I have created an AutoHotKey script for use with TCEdit.

Code:
; AutoHotKey script to automate the task in TCEdit

#q::ExitApp  ; Assign a hotkey to terminate this script

; Hotkey to activate the script (Ctrl+J)
#IfWinActive TCEdit
^j::
    ; Start the selection from the current line to the next Return statement
    Send, +{Down}

    ; Continue holding Shift and pressing Down until reaching the Return statement
    Loop
    {
        ; Send the Down key to move to the next line
        Send, +{Down}
        Sleep, 5  ; Adjust the delay as needed

        ; Check if the current line contains "Return"
        Clipboard := ""  ; Clear the clipboard
        Send, ^c         ; Copy the current line to the clipboard
        Sleep, 25        ; Wait for the clipboard to update
        ClipWait, 1      ; Wait up to 1 second for the clipboard to contain data
        if InStr(Clipboard, "Return")
            break  ; Exit the loop if "Return" is found
    }

    ; Copy the selected text to the clipboard
    Send, ^c
   
    Send, {Down}
Return

I have saved this AutoHotKey script as CtrlJ.ahk

Example use;
Code:
@setlocal
@echo off

Gosub Test

quit

:Test
echo Line 1
echo Line 2
echo Line 3
return

Place the cursor on the :Test line.

Press Ctrl+J key combination.

The text from :Test down to and including Return will be highlighted,
and copied to the Windows Clipboard.

Press the Win+Q key to close the CtrlJ.ahk AutoHotKey script.

Note that the Ctrl+J code will only work in TCEdit.

Adjust the hot keys to your liking.

Joe
 
Back
Top