Copy and Paste Phone Number

CurioTink9938

New member
I am struggling with a macro and could use help. I would like Macrodroid to monitor for when I click a Call hyperlink. Then copy the phone number, and paste it into a specific application.

I think I have MD watch for a ACTION_DIAL intent, but then I can't figure out how to copy that text to the clipboard.

For example, if the hyperlink has "Tel:xxx-xxx-xxxx", I want to pull out XXX-XXX-XXXX and share it to an application.

Thanks very much!
 

Endercraft

Moderator (& bug finder :D)
You can use the UI click trigger, the copy to clipboard action and the share text action to achieve this.
 

CurioTink9938

New member
Thank you for the quick response. I have played around with UI click, but just can't get it to work. I may have the parameters wrong?

When I click on a link, nothing happens.
 

Attachments

  • Screenshot_20240106_145147_MacroDroid.jpg
    Screenshot_20240106_145147_MacroDroid.jpg
    318.1 KB · Views: 7

Endercraft

Moderator (& bug finder :D)
The UI click text is for use in later action, in the trigger you set what text will trigger when you click on it. If you enable the regex option you can use \d{3}-\d{3}-\d{4} to match phone numbers.
 

CurioTink9938

New member
I apologize for seeming obtuse, but I don't understand what you mean.

The UI Click requires "Text To Match". But I don't know what the text will be before I click the hyperlink. It will be "tel:+12345678".

At this point, I would be happy just to get MD to display a pop up saying "It Worked" when I click on a phone number.
 

Yogi

Member
I apologize for seeming obtuse, but I don't understand what you mean.

The UI Click requires "Text To Match". But I don't know what the text will be before I click the hyperlink. It will be "tel:+12345678".

At this point, I would be happy just to get MD to display a pop up saying "It Worked" when I click on a phone number.
Hi,
Didn't have this usecase and tried with the trigger "UI click".
In my case the browser jumps in and calls the system dial app with the number ...
So the problem is in my case the browser, did not allow MD to do the job.
Tried also Trigger "Clipboard change" but the system asks for a "one time permission" -
so it works only one time if you are not on a rooted phone.

in a browser it does the job for you: long tap on the phone number usually gives you the options
+) share link
+) call
+) send msg
+)add to contacts
+) copy

It depends on your need what you like to do.
+) If you copy it to the clipboard and maybe show a floating button if the browser appears
then call a macro through the button, disable the button if the browser is closed.
+) share as link with an app
...

Hope it helps
Regards
Fritz
 
Top