How do I make a macro run if I press 2 different buttons.

snjzz38

New member
I want to make a macro that pauses the media player when I press the power button AND volume up button simultaneously. Kind of like how power+volume down takes a screenshot.

But the problem is that there is no "and" trigger in triggers. How can I fix this?
 

Dm114

Well-known member
I want to make a macro that pauses the media player when I press the power button AND volume up button simultaneously. Kind of like how power+volume down takes a screenshot.

But the problem is that there is no "and" trigger in triggers. How can I fix this?
You must set both triggers and manage a very short delay (such as 100ms) between each firing.
 

Pseudocyclic

Well-known member
Try this:

T1 = button1
T2 = button2
A = if trigger fired = T1
A = set Iinteger to Iinteger +1
A = else
A = set Iinteger to Iinteger -1
A = end if
A = wait 100ms
A = if Iinteger = 0
A = pause media player
A = else
A = set Iinteger to 0
A = end if
A = cancel macro actions
 

Dm114

Well-known member
Try this:

T1 = button1
T2 = button2
A = if trigger fired = T1
A = set Iinteger to Iinteger +1
A = else
A = set Iinteger to Iinteger -1
A = end if
A = wait 100ms
A = if Iinteger = 0
A = pause media player
A = else
A = set Iinteger to 0
A = end if
A = cancel macro actions
You are nicer than me but I like when users try by themselves at first. 😉
 

Pseudocyclic

Well-known member
Or this (not as precise, but might be sufficient in practice):

T1 = button1
T2 = button2
A = if trigger fired = T1
A = wait until trigger fired = button2 (cancel after 1s timeout)
A = else
A = wait until trigger fired = button1 (cancel after 1s timeout)
A = end if
A = pause media player
 

snjzz38

New member
Thanks for the help.

But do I do all of this in the triggers section or the actions section because I can't set variables in the triggers but I can in the actions.

If I set it in actions. What will be the trigger?
 

Dm114

Well-known member
Thanks for the help.

But do I do all of this in the triggers section or the actions section because I can't set variables in the triggers but I can in the actions.

If I set it in actions. What will be the trigger?
In @Pseudocyclic's suggestion "T" lines (T1 and T2) stand for Triggers (red triggers area). "A" lines stand for Actions (blue actions area).

You should have a look to MacroDroid Wiki to get more familiar with MD.
 
Top