Page 1 of 1

Macros to set shortcut key mappings

Posted: Fri Dec 03, 2004 12:01 am
by wotnaz
It would be very useful to be able to set a group of shortcut keys in a macro.

My use case: I program in various languages, and would like to be able to put equivalent code constructs into a file by pressing the same key combinations regardless of what language I'm working with. For example, inserting a Class skeleton by pressing, say, Alt-F. When I'm working in Python, having set my keyboard to the Python mappings, I'd insert a basic Class structure in Python syntax; when using Java, having called up the Java macro, the same keypress would create a skeleton Java Class.

Posted: Fri Dec 03, 2004 9:53 am
by bveldkamp
Sounds good, why don't you add a poll, so we can vote for it?

Maybe an even better idea would be to be able to store several "keyboard definitions" in Tools | Preferences | Keyboard, and then assign one of those to a particular document class.

Posted: Fri Dec 03, 2004 4:28 pm
by Bob Hansen
You asked:
would like to be able to put equivalent code constructs into a file by pressing the same key combinations regardless of what language I'm working with. For example, inserting a Class skeleton by pressing, say, Alt-F.
Here is an untested rough skeleton for the macro:
//HotKey for this macro is ALT-F11
GetActiveWindow>window_title,...............
If>%window_title%=Notepad,Notepad
If>%window_title%=JavaDeveloper,Java
If>%window_title%=OtherName,Other
Repeat as needed for multiple programs
Goto End

Label>Notepad
Do stuff
Goto End

Label>Java
Do other stuff
Goto End

Label>Other
Do more stuff
Goto End

Label>End
Create this macro replacing "Do.....stuff" with the keystrokes you want to happen in that application. Assign a hot-key combination that you want to trigger this macro. As noted in this example, ALT-F11 would run the macro. This would allow one hot-key, ALT-F11, to do different things in Notepad, JavaDeveloper, and Other applications. Edit the macro as needed when new applications need this same hotkey combo.
============================
:oops: Oops, I just realized that this was the wrong forum. The information above is to create a macro in Macro Scheduler. I am so used to answering macro questions on that forum, that I forgot I was on TextPad. I use both products daily to get the bost from both. TextPad for the editing and parsing, and Macro Scheduler for the macros and scheduling. Well maybe this will still be useful. Enjoy!

Posted: Sun Dec 05, 2004 10:52 pm
by wotnaz
From Bob Hansen:
Here is an untested rough skeleton for the macro:
Quote:
//HotKey for this macro is ALT-F11
GetActiveWindow>window_title,...............
If>%window_title%=Notepad,Notepad
If>%window_title%=JavaDeveloper,Java
If>%window_title%=OtherName,Other
Repeat as needed for multiple programs
Goto End

Label>Notepad
Do stuff
Goto End

Label>Java
Do other stuff
Goto End
...
Yeah, it's the "Do stuff" part that's the hangup. Unless I'm mistaken, there's not a reasonable way to set keypad shortcuts in Textpad, other than manually, one at a time.


From bveldkamp:
Sounds good, why don't you add a poll, so we can vote for it?


I'm not opposed to adding a poll, but I have no idea how to do that. It doesn't seem to be a hot issue in any case, judging by the ground swell of controversy or lack thereof.

I've worked in environments where the tools had the capability I'm talking about, and I found it to be a great productivity aid in the kind of programming techniques that Textpad lends itself to. If I only worked with one language, it wouldn't be an issue, though.