EmuloMobile

How to group Android macro steps with a Compound Action

Use a Compound Action in EmuloMobile to place several Android macro steps behind one condition, keep their order visible, and test the block safely.

By Sertta 6 min read
group Android macro steps Compound Action Android conditional macro block EmuloMobile tutorial EmuloMobile

Repeating the same condition on several consecutive macro steps makes a flow harder to read and maintain. If three actions belong to one response, changing the visual trigger should not require editing three separate cards.

EmuloMobile provides a Compound Action for this structure. It holds child actions in an explicit order and can apply one condition to the complete block. When the parent condition passes, the children are considered in sequence. When it does not pass, none of them runs.

A Compound Action organizes steps inside one macro. If you need to hand execution from one complete macro to another, use the guide to chaining Android macros instead.

Use a block when the actions answer the same event

Start with a sentence that describes the decision: when this state appears, perform these actions in this order.

For example, when a completion panel appears, the macro may need to:

  1. save a screenshot of the completed state;
  2. tap Done;
  3. return to the previous screen.

Those steps answer the same visual event, so a parent block is easier to understand than three unrelated top-level cards. The condition belongs to the completion panel; the children describe the response.

Keep actions separate when they have different triggers, need to remain independently visible in the main sequence, or should not be skipped together. A Compound Action is a structural boundary, not merely a way to make the builder shorter.

Understand the parent condition before building

Conditions attached to the Compound Action guard the complete block. EmuloMobile evaluates that parent gate before entering the child list.

This creates two clear outcomes:

  • if the parent gate passes, EmuloMobile processes the enabled children in their displayed order;
  • if the parent gate fails, the engine skips the Compound Action and does not evaluate or run its children in that pass.

Each child can still have its own condition. Use that second level only for a rule that is specific to the child. For example, the parent may confirm that the completion panel is open, while the Tap text child checks that the Done label is actually present.

Do not copy the parent condition into every child. That removes the main benefit of the block and creates several settings that can drift apart.

How to create a Compound Action in EmuloMobile

Open the automation in the builder and choose the point in the sequence where the grouped response belongs.

1. Add the empty block

Select Add action, choose the custom category, and select Compound Action. EmuloMobile creates an empty card directly in the flow.

Use the note field to describe the result, such as “Record completion and close panel.” A result-oriented note is more useful than repeating the action type.

2. Add child actions in execution order

Inside the Compound Action card, select Add sub-action and create the first child. Repeat for the remaining steps.

For the completion example, add:

  1. Take screenshot;
  2. Tap text configured for Done;
  3. System button configured as Back, only if returning is part of the intended response.

The children appear as nested cards. Use their up and down controls to arrange the sequence. Do not rely on the order in which you happened to think of the steps; review the order as an observable interaction with the target app.

3. Add the shared condition to the parent

In the condition area at the bottom of the Compound Action card, add the signal that identifies the event. It may be text, an image, a color, a count, or a variable supported by the builder.

Choose the most specific stable signal. If a unique completion title is available, a text condition may be enough. If the title is reused on other screens, combine it with another signal or use a focused detection region. The guide to tapping text with OCR explains how regions reduce ambiguous matches.

4. Add child conditions only where they change the decision

A child condition should answer a narrower question than the parent. Examples include:

  • take the screenshot only when a success badge is visible;
  • tap Done only when that label is present;
  • run a cleanup step only when a boolean variable is true.

There is an important sequencing rule inside the block: if a conditioned child does not pass, following children without their own condition are skipped until the engine reaches another explicitly conditioned child. This prevents an unguarded continuation from running after its expected prerequisite failed.

Design each run of children as a small chain. If a later child must make an independent decision, give it its own condition rather than assuming the previous one passed.

5. Save the automation explicitly

Adding the block, reordering children, and editing conditions remain pending in the builder until you select Save. Save before leaving the editor or preparing a full execution.

Example: record a result before dismissing it

Suppose an app shows a result panel after a repetitive process. You want evidence of the result, then you want the macro to dismiss the panel and return.

Build one Compound Action with a parent condition that identifies the result panel. Place Take screenshot first, Tap text: Done second, and the navigation action last.

The order matters. If the macro taps Done before taking the screenshot, the state you wanted to preserve may disappear. If the panel condition is placed only on the first child, later unguarded actions can become difficult to reason about when the flow is edited. The parent gate makes the boundary visible: this entire response belongs to the result panel.

For details about file behavior and gallery access, see the guide to saving screenshots automatically in an Android macro.

Test the gate, the children, and the complete block

Use three levels of testing:

  1. Test the parent condition on a screen where it should pass and one where it should not.
  2. Test each child on the exact screen state it expects.
  3. Test the Compound Action from the beginning of the event and observe the complete order.

Use non-destructive test data when a child can submit, confirm, or leave a screen. A child that works alone may still receive the wrong state after the preceding child changes the interface.

If the block fails, look for the first observable difference. The guide to testing an Android macro step by step provides a method for isolating that boundary without deleting configured steps.

Keep the block small enough to explain

A useful Compound Action represents one event and one response. If the block needs a long note to explain unrelated setup, main work, recovery, and cleanup, split the flow into clearer units.

Nested Compound Actions are available in the builder, but depth should serve a real hierarchy. Prefer a shallow block that can be read on the screen. Use child conditions for local exceptions, and use a separate macro when the routine has its own beginning, purpose, and test cycle.

Make one decision release one coherent response

A Compound Action turns a repeated trigger into a visible boundary: one parent condition, an ordered set of children, and optional child-specific checks. That structure reduces duplicated configuration and makes it easier to see what should happen when the target state appears.

Explore EmuloMobile to build conditional macro blocks directly on Android.