Toogle Shortcut - launch macros

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
javier
Newbie
Posts: 5
Joined: Tue Jul 16, 2013 7:01 am

Toogle Shortcut - launch macros

Post by javier » Wed Apr 02, 2014 7:22 am

Hi,
I would like to make a macro with a single keyboard shortcut to run various macros.
The intention is to have 2 options and every time start a different macro.

And there was another option that is intended to run a macro or another depending on if you press once or if you press twice.

Can anyone help me?

Thank you very much

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

Post by Marcus Tettmar » Sun Apr 06, 2014 9:33 am

I'm not entirely sure I understand what you want to do. Perhaps you could clarify.

You can assign a hot key to a macro and then have that macro ask the user for information or make some decision based on some other context (e.g. which window is currently active) and then run a different macro or subroutine. So certainly you can have one hot key do different things depending on context or input.

But for more specifics perhaps you can clarify precisely what you want and we'll try to help.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

javier
Newbie
Posts: 5
Joined: Tue Jul 16, 2013 7:01 am

Post by javier » Sun Apr 06, 2014 9:44 am

Hi, sorry for my english.
I'll try to explain better.

They are two different macros:

macro 1
-Press once a shortcut, it displays the message 1.
-Press twice consecutive a shortcut, display message 2.

macro 2
-Press once a shortcut, it displays the message 1.
Saves the state in a register.
After a few seconds...
I'll be back, press once shortcut, displays message 2.

Thanks!

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Mon Apr 07, 2014 4:49 pm

Javier, one way to do the second scenario, is write to an INI file

When script launches, use some logic similar to this...

Code: Select all

IfFileExists
  ReadIniFile for LastMessage
Else
  Use WriteLn to create INI file with Message1 (or some flag to indicate Message1)
  Set LastMessage = Message1
Endif
 
If LastMessage = Message1
  Show Message2
  EditIniFile to Message2
Else
  Show Messge1
  EditIniFile to Message1
Endif
Thanks,
Jerry

[email protected]

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