Changes

no edit summary
Line 1: Line 1: −
=== About ===
+
<pre class="header-style">The MacroDroid Variable Change trigger fires when a MacroDroid variable is set to a certain value. This trigger monitors both global and local variables, allowing you to create reactive macros that respond to changes in variable state. The trigger fires once when the condition is first met, not repeatedly while the condition persists.</pre>
   −
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
''' Options '''
Will fire when a MacroDroid variable is set to a certain value.
     −
Note that when comparing less than or greater than, the trigger will only fire once when the value transitions into this state (not on subsequent updates where that same condition is still met).
+
''' Variable Selection '''
</pre>
  −
'' See also: '' '' [https://macrodroidforum.com/wiki/index.php/Variables Variables]''
     −
==<p><b>Specific value</b></p>==
+
First, select which variable to monitor from the list of available global and local variables. Variables can be of the following types:
 +
* String
 +
* Integer
 +
* Decimal
 +
* Boolean
 +
* Dictionary (with key selection)
 +
* Array (with index selection)
   −
===  =  ===
+
''' Trigger Mode '''
   −
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
* '''Specific Value Change''' - Fire when the variable changes to a specific value matching certain criteria
Means that the whole content of the string variable has to be equal to the whole set of typed characters.
+
* '''Any Value Change''' - Fire whenever the variable value changes to any new value
</pre>
  −
'' Compatible with [https://macrodroidforum.com/wiki/index.php/Variables#Standard_Variable_Types Variables | String, Integer, Decimal, Boolean] (Boolean only in the compare values condition/constraints) ''
  −
<br>
     −
===  != ===
+
''' Comparison Options by Variable Type '''
   −
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
''Boolean Variables:''
Means that the content of the string variable has to be unequal (i.e. different) to the set of typed characters.
+
* True
</pre>
+
* False
'' Compatible with [https://macrodroidforum.com/wiki/index.php/Variables#Standard_Variable_Types Variables | String, Integer, Decimal, Boolean] (Boolean only in the compare values condition/constraints) ''
     −
=== Contains ===
+
''Integer/Decimal Variables:''
 +
* '''Equal to (=)''' - Fires when the value equals the specified number
 +
* '''Not equal to (!=)''' - Fires when the value does not equal the specified number
 +
* '''Greater than (>)''' - Fires when the value becomes greater than the specified number (fires once on transition)
 +
* '''Less than (<)''' - Fires when the value becomes less than the specified number (fires once on transition)
   −
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
For numeric comparisons, you can specify:
Means that the content of the string variable has to contain the whole set of typed character. For instance, enter the word information to match with a string variable containing the text: Here are the informations you asked for...
+
* A fixed numeric value
</pre>
+
* Another variable's value
'' Compatible with [https://macrodroidforum.com/wiki/index.php/Variables#String Variables | String '']
+
* A mathematical expression
   −
=== Excludes ===
+
''String Variables:''
 +
* '''Equals (=)''' - Fires when the string exactly matches the specified text
 +
* '''Not equals (!=)''' - Fires when the string does not match the specified text
 +
* '''Contains''' - Fires when the string contains the specified text as a substring
 +
* '''Excludes''' - Fires when the string does NOT contain the specified text
   −
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
''' Additional String Options '''
Means that the content of the string variable has not to contain the typed text.
  −
</pre>
  −
'' Compatible with [https://macrodroidforum.com/wiki/index.php/Variables#String Variables | String] ''
     −
=== The wildcards '*' ===
+
* '''Enable regular expression matching''' - Use regex syntax for pattern matching
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
* '''Ignore case''' - Perform case-insensitive comparison (disabled when regex is enabled)
* stands for any number of character (from 0 to any, same as '.*' in Regex).
  −
</pre>
     −
=== The wildcards '?' ===
+
''' Wildcard Matching '''
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
  −
? is for 1 and only 1 mandatory character (same as '.{1}' in Regex).
  −
</pre>
     −
* '''Tick the box '''Enter regular expression matching''' if the typed text follows Regex syntax, far more powerful than plain text with or without wildcards (for advanced users).'''
+
When not using regex, wildcards can be used in string matching:
 +
* '''Asterisk (*)''' - Matches zero or more characters
 +
* '''Question mark (?)''' - Matches exactly one character
   −
==<p><b>Any value change</b></p>==
+
''' Examples '''
   −
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
''Example 1: Announce when counter reaches 100''
Any value, no additional configuration is required.
+
 
</pre>
+
  <pre class="trigger-style">Triggers
 +
 
 +
MacroDroid Variable Change: counter = 100</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Speak Text: Counter has reached 100</pre>
 +
 
 +
''Example 2: React to status variable containing "error"''
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
MacroDroid Variable Change: status contains error</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Notification: Error detected in status</pre>
 +
 
 +
''' Notes '''
 +
 
 +
* For greater than (>) and less than (<) comparisons, the trigger only fires once when the value transitions into this state, not on subsequent updates where the same condition is still met
 +
* Local variables are only monitored for the macro they belong to
 +
* Dictionary and array variables allow you to monitor specific keys or indices
 +
* Magic text can be used in string comparison values
 +
* Expression evaluation is supported for numeric comparisons (e.g., using mathematical formulas)
 +
 
 +
''' See Also '''
 +
 
 +
* [[Action: Set Variable]]
 +
* [[Constraint:_MacroDroid_Variable]]