Variables
Variables in Android Macro allow you to store and reuse values throughout your automation script. They act like containers that can hold different types of data like screen coordinates, text to type, or detection results.
Creating Variables
To create a variable:
- Click the "Variables" category in the toolbox
- Click "Create variable"
- Enter a descriptive name for your automation needs
- Click "OK"
Using Variables in Macros
Store Detection Results
Use variables to save results from screen detection for later use:
Save Coordinates
Store screen coordinates to reuse in multiple clicks:
Common Variable Uses in Android Macro
Variables are especially useful for:
- Storing screen coordinates for repeated taps
- Saving detection results (whether an image/text exists)
- Counting iterations in automation loops
- Storing text to type into applications
- Saving color detection results
- Managing timing delays between actions
Example: Click Counter
Here's a practical example that counts successful clicks in your macro:
Tips for Android Macro Variables
- Use variables to store detection results before making decisions
- Save frequently used coordinates in variables for cleaner code
- Initialize counters to track automation progress
- Use descriptive names like
login_button_x
ormenu_exists
- Variables can make your macro more reliable by storing and checking states
Variables are essential for creating smart, adaptive macros that can handle different scenarios and maintain state throughout the automation process.