Difference between revisions of "Trigger: Clipboard Change"

m
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<pre style="background-color: #EEEEEE; color: Black; border-radius: 10px; padding: 10px;">
+
<pre class="header-style">
This trigger requires additional configuration on Android 10 and above. This limitation is due to Google blocking clipboard access from background applications since Android 10.
+
This trigger will fire when the value stored in the clipboard is updated.
 +
</pre>
  
Warning: It stopped working completely for android 13 and higher.
+
''' Options '''
  
When new text is copied, it is saved to the clipboard. This trigger will be activated when this event occurs.
+
* '''Text to Match''' - Enter text to match against the clipboard content. Leave blank to trigger on any clipboard change.
 +
** Supports wildcards (e.g., * for any characters)
 +
** Supports Magic Text variables
  
 +
* '''Enable Regex''' - Enable regular expression matching for advanced pattern matching of clipboard content.
  
The following magic text is available when this trigger fires.
+
* '''Case Insensitive''' - When checked, ignores the use of upper and lower case when matching. This option is disabled when regex mode is enabled.
  
[Clipboard] - the text in the clipboard.</pre>
+
* '''Use Logcat (ADB Hack)''' - On Android 10+, standard clipboard access is not possible in the background unless you have a rooted device with appropriate Magisk modules. MacroDroid can monitor logcat output to help detect new clipboard content as a workaround for unrooted devices. This option requires granting the READ_LOGS permission via ADB.
<br>
 
'''Example Usage'''<br/>
 
If the clipboard receives the value containing code it will try to get the code from 4 to 10 digits and fill the clipboard only with the code.
 
<pre style="background-color: #AC2424; color: white; border-radius: 10px; padding: 10px;">
 
Triggers
 
  
Clipboard change (code)
+
''' Examples '''
*Enable regular expression matching
 
</pre><br>
 
<pre style="background-color: #1665B0; color: white; border-radius: 10px; padding: 10px;">
 
Actions
 
  
Clipboard refresh
+
Example 1: Speak clipboard content when copied
Text manipulation [Extract text ([Clipboard] \d{4,10}
 
Fill clipboard [lv-code]
 
</pre><br>
 
<pre style="background-color: green; color: white; border-radius: 10px; padding: 10px;">
 
Constraints
 
  
 +
  <pre class="trigger-style">Triggers
  
</pre><br>
+
Clipboard Change [Any]</pre>
<pre style="background-color: teal; color: white; border-radius: 10px; padding: 10px;">
+
  <pre class="action-style">Actions
Local variables
 
  
SMS CODE [Var type - String]
+
Speak Text: [clipboard]</pre>
</pre><br>
+
 
 +
Example 2: Open URL when web address is copied
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Clipboard Change [Text: http*]</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Open URL: [clipboard]</pre>
 +
 
 +
''' Notes '''
 +
 
 +
* On Android 10 and later, Google restricted background clipboard access. To use this trigger on Android 10+, you need one of the following:
 +
** Root access with appropriate Magisk modules
 +
** Enable the "Use Logcat (ADB Hack)" option and grant READ_LOGS permission via ADB
 +
** Enable the UI Interaction accessibility service (allows reading clipboard when MacroDroid is in the foreground)
 +
* The logcat method requires the "Draw Over Other Apps" permission for proper operation.
 +
* When using the logcat method, you must grant permission via ADB with the command: <code>adb shell pm grant com.arlosoft.macrodroid android.permission.READ_LOGS</code>
 +
 
 +
''' Permissions Required '''
 +
 
 +
* READ_LOGS (only for logcat method on Android 10+)
 +
* Draw Over Other Apps (for logcat method)
 +
 
 +
''' See Also '''
 +
 
 +
* [[Action:_Fill_Clipboard|Fill Clipboard Action]]

Latest revision as of 22:23, 5 January 2026

This trigger will fire when the value stored in the clipboard is updated.

Options

  • Text to Match - Enter text to match against the clipboard content. Leave blank to trigger on any clipboard change.
    • Supports wildcards (e.g., * for any characters)
    • Supports Magic Text variables
  • Enable Regex - Enable regular expression matching for advanced pattern matching of clipboard content.
  • Case Insensitive - When checked, ignores the use of upper and lower case when matching. This option is disabled when regex mode is enabled.
  • Use Logcat (ADB Hack) - On Android 10+, standard clipboard access is not possible in the background unless you have a rooted device with appropriate Magisk modules. MacroDroid can monitor logcat output to help detect new clipboard content as a workaround for unrooted devices. This option requires granting the READ_LOGS permission via ADB.

Examples

Example 1: Speak clipboard content when copied

Triggers

Clipboard Change [Any]
Actions

Speak Text: [clipboard]

Example 2: Open URL when web address is copied

Triggers

Clipboard Change [Text: http*]
Actions

Open URL: [clipboard]

Notes

  • On Android 10 and later, Google restricted background clipboard access. To use this trigger on Android 10+, you need one of the following:
    • Root access with appropriate Magisk modules
    • Enable the "Use Logcat (ADB Hack)" option and grant READ_LOGS permission via ADB
    • Enable the UI Interaction accessibility service (allows reading clipboard when MacroDroid is in the foreground)
  • The logcat method requires the "Draw Over Other Apps" permission for proper operation.
  • When using the logcat method, you must grant permission via ADB with the command: adb shell pm grant com.arlosoft.macrodroid android.permission.READ_LOGS

Permissions Required

  • READ_LOGS (only for logcat method on Android 10+)
  • Draw Over Other Apps (for logcat method)

See Also