Difference between revisions of "Trigger: Screen content"

 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
===<p><b>About</b></p>===
+
<pre class="header-style">This trigger will fire when certain textual content appears on screen or is removed from the screen (as configured). Note that this trigger may not work for all apps/screen content as often text will be non-readable (for example if rendered within a game).</pre>
  
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
''' Options '''
This trigger will fire when certain textual content appears on screen or is removed (as configured).
 
</pre>
 
'''''Note'''''
 
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 
That this trigger may not work for all apps/screen content as often text will be non-readable (for example if rendered within a game).
 
</pre>
 
  
==<p><b>Supported configurations</b></p>==
+
* '''Text to Match / View ID to Match''' - The text string or Android view ID to search for on screen. Supports Magic Text for dynamic matching.
 +
* '''Match Text Content''' - Match against visible text content on the screen
 +
* '''Match View ID''' - Match against Android view IDs (for advanced users who know the specific view identifiers)
 +
* '''Enable Regex''' - Enable regular expression pattern matching for complex text patterns
 +
* '''Ignore Case''' - When enabled (default), text matching is case-insensitive. Not available when regex is enabled.
 +
* '''On Screen''' - Trigger fires when the specified content appears on screen
 +
* '''Off Screen''' - Trigger fires when the specified content is removed from screen
 +
* '''Select Applications''' - Limit detection to specific applications, or monitor all applications
 +
* '''Include Overlays''' - Include overlay windows in content detection (Pro feature)
  
=== Applications ===
+
''' Requirements '''
  
* ''''' For optimal performance please select specific applications and do not use the 'All Applications' option.'''''
+
* UI Interaction Accessibility Service must be enabled
 +
* Pro version required for "Include Overlays" feature
  
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
''' Examples '''
Select one or more applications to search for content on the screen.
 
</pre>
 
  
* ''''' On Screen:''''' ''Only IF Text/ID is present on the display.''
+
'''Example 1: Low battery notification from app'''
* ''''' Off Screen:''''' ''Only NO Text/ID is present on the screen.''
 
  
=== Match Option ===
+
Trigger when a specific app shows "Low Battery" text:
  
* ''''' Text content:'''''
+
  <pre class="trigger-style">Triggers
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 
It will search for the match by text.
 
</pre>
 
  
* ''''' View id:'''''
+
Screen Content (On Screen): "Low Battery"
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
Applications: Smart Home App</pre>
Find the match by identifier, you can find the ids with actions e.g. Read Screen Content, Check Text To Screen.
+
  <pre class="action-style">Actions
</pre>
 
'' See also: '' [[Action: Read Screen Contents|Read Screen Contents]], [[Action: Check Text On Screen|Check Text To Screen]].''
 
  
=== Text to match ===
+
Display Notification: "Device battery is low"
 +
Send SMS to self: "Check smart home device battery"</pre>
  
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
'''Example 2: Auto-dismiss dialog'''
Text to match, supports the use of wildcards and magic text.
 
</pre>
 
'' See also: '' [[magic text|Magic Text]].''
 
  
=== Checkbox ===
+
Automatically handle a recurring dialog that appears on screen:
  
* '''Enable regular expression matching'''
+
  <pre class="trigger-style">Triggers
  
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
Screen Content (On Screen): "Rate this app"</pre>
Regular expression matching (or regex matching) is a technique for finding patterns within text using a specialized syntax known as regular expressions.
+
  <pre class="action-style">Actions
It's a powerful tool for text processing and pattern recognition.
 
</pre>
 
  
* '''''Case insensitive'''''
+
UI Interaction: Click "Not Now"</pre>
  
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
'''Example 3: Track work status'''
It will ignore the use of upper and lower case in title and detail.
 
</pre>
 
  
* '''''Include overlays (Pro Only)'''''
+
Set a variable when work status changes:
  
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
  <pre class="trigger-style">Triggers
An overlay is like an additional layer that is placed on top of other applications on your device.
 
It can be a pop-up window, a banner or even a small icon.
 
</pre>
 
  
=== Read Screen Update Rate ===
+
Screen Content (On Screen): "Available"
''The frequency that the device will query the screen contents.<br>
+
Applications: Slack</pre>
With intervals of 0.1 sec up to a maximum of 5 sec.''<br>
+
  <pre class="action-style">Actions
'''''More frequent updates may cause higher battery drain.'''''
 
  
* '''''Don't read when MacroDroid is open'''''
+
Set Variable: [work_status] = "available"</pre>
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
 
Enabling this option will prevent reading the screen contents when MacroDroid is the foreground app.
+
''' Notes '''
This can prevent laggy behaviour when using the app.
+
 
</pre>
+
* The trigger uses MacroDroid's UI accessibility service to query screen content
 +
* A delay of 500ms is applied between consecutive triggers to prevent rapid firing
 +
* Selecting specific applications is recommended to improve performance and reduce false triggers
 +
* A warning is displayed when "All Applications" is selected due to potential performance impact
 +
* Text rendered as graphics (such as in games or images) cannot be detected
 +
* The screen content update rate can be configured in MacroDroid settings
 +
* Magic Text can be used in the text to match field for dynamic content matching
 +
* On Android 15+ apps can block access to reading the screen content via the accessibility service.
 +
 
 +
''' See Also '''
 +
 
 +
* [[Action:_UI_Interaction|UI Interaction]]
 +
* [[Trigger: Notification]]

Latest revision as of 21:39, 6 January 2026

This trigger will fire when certain textual content appears on screen or is removed from the screen (as configured). Note that this trigger may not work for all apps/screen content as often text will be non-readable (for example if rendered within a game).

Options

  • Text to Match / View ID to Match - The text string or Android view ID to search for on screen. Supports Magic Text for dynamic matching.
  • Match Text Content - Match against visible text content on the screen
  • Match View ID - Match against Android view IDs (for advanced users who know the specific view identifiers)
  • Enable Regex - Enable regular expression pattern matching for complex text patterns
  • Ignore Case - When enabled (default), text matching is case-insensitive. Not available when regex is enabled.
  • On Screen - Trigger fires when the specified content appears on screen
  • Off Screen - Trigger fires when the specified content is removed from screen
  • Select Applications - Limit detection to specific applications, or monitor all applications
  • Include Overlays - Include overlay windows in content detection (Pro feature)

Requirements

  • UI Interaction Accessibility Service must be enabled
  • Pro version required for "Include Overlays" feature

Examples

Example 1: Low battery notification from app

Trigger when a specific app shows "Low Battery" text:

Triggers

Screen Content (On Screen): "Low Battery"
Applications: Smart Home App
Actions

Display Notification: "Device battery is low"
Send SMS to self: "Check smart home device battery"

Example 2: Auto-dismiss dialog

Automatically handle a recurring dialog that appears on screen:

Triggers

Screen Content (On Screen): "Rate this app"
Actions

UI Interaction: Click "Not Now"

Example 3: Track work status

Set a variable when work status changes:

Triggers

Screen Content (On Screen): "Available"
Applications: Slack
Actions

Set Variable: [work_status] = "available"

Notes

  • The trigger uses MacroDroid's UI accessibility service to query screen content
  • A delay of 500ms is applied between consecutive triggers to prevent rapid firing
  • Selecting specific applications is recommended to improve performance and reduce false triggers
  • A warning is displayed when "All Applications" is selected due to potential performance impact
  • Text rendered as graphics (such as in games or images) cannot be detected
  • The screen content update rate can be configured in MacroDroid settings
  • Magic Text can be used in the text to match field for dynamic content matching
  • On Android 15+ apps can block access to reading the screen content via the accessibility service.

See Also