Cut/Copy - If no selection apply to current line

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
robertcollier4
Posts: 22
Joined: Tue Jan 31, 2012 5:38 am

Cut/Copy - If no selection apply to current line

Post by robertcollier4 »

Is there any way to make that, if nothing is selected and Cut or Copy is done, then Textpad will apply Cut/Copy to the current line?

This is such a common programmer workflow to move lines around. It really wastes my keystrokes to always have to have to hit "<Home> <Shift+Down><Ctrl+X>" every time I want to cut a line when really it should just be "<Ctrl+X>".
ben_josephs
Posts: 2460
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

TextPad has plenty of cut commands, including one that cuts lines. Choose a shortcut key and assign it to that command:
Configure | Preferences | Keyboard | Categories: Edit | Commands: EditCutLine .
robertcollier4
Posts: 22
Joined: Tue Jan 31, 2012 5:38 am

Post by robertcollier4 »

Thanks, but I was hoping to be able to assign Ctrl+X to both EditCut and EditCutLine. And Ctrl+C to both EditCopy and EditCopyLine.

Can these two be assigned to the same hotkey at the same time?
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

No, they can't.
robertcollier4
Posts: 22
Joined: Tue Jan 31, 2012 5:38 am

Post by robertcollier4 »

OK, thanks. It seems to me that it might be possible for me to create this via a Add-in Macro.

Where is the Macro API? I cannot find any documentation. How were the following add-ins created? What is the process for creating and compiling a .TPM file?
http://www.textpad.com/add-ons/macros.html

Should be easy enough if I can find the apporpriate function call to get the current selection and check if it is empty or not.
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

There's no macro API and no documentation. TextPad macros are just keystroke recordings. As far as I can tell, the macros on the Add-ons page were created by recording a macro in TextPad (Macros > Record), saving it, and then copying the .TPM file from the macro folder location (set in Configure > Preferences > Folders).

It wouldn't be possible to record a TextPad macro to do what you want because there's no way to check if a selection has been made or execute commands conditionally.

You can try using an external macro tool like Macro Scheduler or AutoIt. I'm not familiar with either, but they get mentioned from time to time in these forums.
Post Reply