Page 1 of 1

Cut/Copy - If no selection apply to current line

Posted: Sun Feb 03, 2013 8:12 pm
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>".

Posted: Sun Feb 03, 2013 10:38 pm
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 .

Posted: Fri Feb 08, 2013 3:34 pm
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?

Posted: Fri Feb 08, 2013 6:46 pm
by ak47wong
No, they can't.

Posted: Sat Feb 09, 2013 3:17 pm
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.

Posted: Sat Feb 09, 2013 11:35 pm
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.