Difference between revisions of "Constraint: MacroDroid Variable"

 
Line 1: Line 1:
<span style="color: #0E9549; font-size: 24px;">'''About this constraint '''</span>
+
<pre class="header-style">This constraint allows or prevents a macro/feature from running based on a MacroDroid variable value.</pre>
  
This constraint can be used to allow a trigger to fire only when a MacroDroid variable is set to a particular value.
+
''' Options '''
  
The rules for such a constraint to be TRUE are the same as for 'If clause' action.
+
* '''Variable''' - Choose the variable to check
 +
* '''Boolean''': Match true or false
 +
* '''Integer''': Equals, not equal, greater than, or less than a value (or compare to another variable/expression)
 +
* '''Decimal''': Equals, not equal, greater than, or less than a value (or compare to another variable/expression)
 +
* '''String''': Equals/Not equals, Contains, or Excludes (supports regex and case sensitivity)
 +
* '''Dictionary/Array''': Select a key path, choose the entry type, then apply the same boolean/integer/decimal/string comparison options
 +
 
 +
''' Example '''
 +
 
 +
''Example 1: Only launch the camera when a flag is enabled''
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Widget Button</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Launch Application: Camera</pre>
 +
  <pre class="constraint-style">Constraints
 +
 
 +
MacroDroid Variable - [camera_allowed] = true</pre>
 +
 
 +
''' See Also '''
 +
 
 +
* [[Trigger: MacroDroid Variable Change|MacroDroid Variable Change Trigger]]
 +
* [[Action: Set Variable|Set Variable Action]]

Latest revision as of 13:22, 9 January 2026

This constraint allows or prevents a macro/feature from running based on a MacroDroid variable value.

Options

  • Variable - Choose the variable to check
  • Boolean: Match true or false
  • Integer: Equals, not equal, greater than, or less than a value (or compare to another variable/expression)
  • Decimal: Equals, not equal, greater than, or less than a value (or compare to another variable/expression)
  • String: Equals/Not equals, Contains, or Excludes (supports regex and case sensitivity)
  • Dictionary/Array: Select a key path, choose the entry type, then apply the same boolean/integer/decimal/string comparison options

Example

Example 1: Only launch the camera when a flag is enabled

Triggers

Widget Button
Actions

Launch Application: Camera
Constraints

MacroDroid Variable - [camera_allowed] = true

See Also