Multi-Function Hot-key

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Multi-Function Hot-key

Post by Bob Hansen » Fri Dec 03, 2004 1:16 am

:oops: I just finished answering a request in another forum, when I realized it was not Macro Schecduler. :oops:

:idea: But since it was done, I thought it might still be used by Macro Scheduler users. Here you go:
===========================
The question in the other forum:
------
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.

=========================
My reply:

Here is an untested rough skeleton:
//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 oter 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.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Dec 03, 2004 10:09 am

Funnily enough this is addressed in the FAQs section on our web site and there is a very similar skeleton script there answering the same issue. Has been there since around 98 I think :-)
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Dec 03, 2004 4:13 pm

Will have to check that out. This was a reply to a question on TextPad forum, good TextEditor but macro tool extremely limited. I use both products daily to get the best of both.

But I am so used to using Macro Scheduler, I just whipped off the answer for the macro without realizing I was on the wrong forum with my solution.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts