Paste text automatically! Is it possible?

Walidhks

New member
Hi, I'm new here I'm trying to create a macro that paste the clipboard content in the selected area by long click, if the field is empty, and if the field contain a text then select all the text and copy it

Thank you macrodroid
 

mapriex

Active member
my suggestion:
save the clipboarded string in a variable. (i think dictionary variable)
use screenreader with id.
use an if condition on the certain id to check if this id is empty.
if its empty use the variable to the dictionary.
else creating a new variable(dic. variable aswell) that use the certain id.

to see the variable you can write it in a note on app or for testing watching the variable directly in macrodroid.

thats the basic flow. if you created something we can go further to achieve this finally.

for my interest, what did you try?
I'm trying to create a macro
how would you solve this and where did you stop thinking of the goal?
 

Walidhks

New member
I made a macro doing approximately the same, but it copies the selected text and it worked for me,
But I want to directly paste the clipboard content when the field is empty. Please look at the attachment may be you get an idea
 

Attachments

  • Screenshot_20240205_070319_edit_58239006149658.jpg
    Screenshot_20240205_070319_edit_58239006149658.jpg
    333.9 KB · Views: 25
  • Screenshot_20240205_065228_edit_58292267524950.jpg
    Screenshot_20240205_065228_edit_58292267524950.jpg
    294.4 KB · Views: 24

mapriex

Active member
ok, that is something.
first create a test macro to determine the screen dictionary where you want to fill the text in. i advice you that you can use your macro as a submacro (you need edit your macro a bit, like variable "THIS IS THE LINE") or something with a custom text in the needed empty space to determine which id-number you will need. after your text is filled in, do a screen reading action and then you see where you need to operate.

i will wait, till you have this.
 

Walidhks

New member
ok, that is something.
first create a test macro to determine the screen dictionary where you want to fill the text in. i advice you that you can use your macro as a submacro (you need edit your macro a bit, like variable "THIS IS THE LINE") or something with a custom text in the needed empty space to determine which id-number you will need. after your text is filled in, do a screen reading action and then you see where you need to operate.

i will wait, till you have this.
I'm very noo here, i don't understand id's


All what I need is to paste clipboard content if long press in empty area triggered
😭
 

Walidhks

New member
Okk here is the macro you told me to do and here is the output when trigger fired up ;
PS: I TRIED IT IN NOTE APP.Screenshot_20240207_073455.jpgScreenshot_20240207_073317.jpg
 

hsurB

Well-known member
I am not sure if you can identify the field where you are trying to write easily.
For exemple the field where I am writing now has some random index after runing read screen action and I believe using ui click trigger won't work when clicking this field.
Its under index:608 for exemple and it will be changing every time.
So there is a lot of difficult things to deal with.
And even after figuring it all out it might be unreliable.
 

Walidhks

New member
I am not sure if you can identify the field where you are trying to write easily.
For exemple the field where I am writing now has some random index after runing read screen action and I believe using ui click trigger won't work when clicking this field.
Its under index:608 for exemple and it will be changing every time.
So there is a lot of difficult things to deal with.
And even after figuring it all out it might be unreliable.
Yes exactly what I'm thinking, but I think and I'm sure there is a trick to paste text when long press in the empty field.
I made a variable with value ^$ means nothing I think.
Means when I do long press on an empty field, it will paste the clipboard content

But still does not succeed
 

hsurB

Well-known member
I tried something like this. Go to list of your macros or templates and try to long click on searching field, it should paste word 'Hey' there after importing macro
Depending what app you use and where you want to paste the text it might require a little bit different configuration. For exemple when long clicking on my opera browser at the top field, if clause condition would have to be variable contains 'Search or enter address' (its translation from my language, I dont know exact words in english) etc.
Maybe it will help you a little bit

Disabled pop up action was there just for me for tests.
I used it and tried long clicking on different fields to see whats detectable by macrodroid and what phrase to put as condition for if clause later. So you can disable if clause, enable pop up and keep testing for yourself (after changing trigger since its only for macrodroid app for now)

Edit. I've just realised long clicking the field even after macro pasted the word Hey there keep triggers macro so as I said - its very tricky. But its in macrodroid.
Edit2. But when used in opera, it recognizes the word Hey that has been pasted so after changing condition in if clause it successfully pasted the word when it was empty and then stopped triggering macro after
 

Attachments

  • Screenshot_20240207_220748_MacroDroid.png
    Screenshot_20240207_220748_MacroDroid.png
    166.3 KB · Views: 15
  • Long_click_macrodroid.macro
    3.4 KB · Views: 8
Last edited:

Walidhks

New member
Great ideas, we are not far from the final idea :

I changed the trigger from macrodroid app to all app, the challenge here is the {click} variable change every app as you previously said, so the question is : why it copies the placeholder text?-I mean the transparent text in the empty field - ( like image I attached), is there any method to check if the field is real empty or not?

I think that android should develop something like that cuz there is nothing to do when we press a long click in an empty field, just to paste
 

Attachments

  • Screenshot_20240208_084001.jpg
    Screenshot_20240208_084001.jpg
    417.1 KB · Views: 14
  • Screenshot_20240208_083323_edit_85843902494544.jpg
    Screenshot_20240208_083323_edit_85843902494544.jpg
    302.8 KB · Views: 11

hsurB

Well-known member
I am not sure. Depending on how much effort you want to put in this macro, you could just check most apps/all apps you use, check what description of field indicates that its empty (for this particular field), store all descriptions in an array/dictionary and create one if clause checking if this array contains current variable's value and if it does - paste clipboard text.
Unless someone finds universal way of checking if its really empty (as you said)
+Some empty fields like the one we write here on forum won't be detected by macrodroid and I am not sure either if there's any way to bypass that too. Probably not with ui interactions based triggers/actions

Edit. After runing read screen action the field has key and a value, you can probably use both but long clicking (with key used) will probably trigger even if its not empty
 
Last edited:

mapriex

Active member
Okk here is the macro you told me to do and here is the output when trigger fired up ;
PS: I TRIED IT IN NOTE APP.View attachment 8527View attachment 8526
ok, now write something in the expected "empty" or not "empty" space and execute the macro again to determine the location of the needed bracket and tell me which word you wrote in.

keep in mind that a floating button will interference with the screen reading option, but for testing purposes its fine.

after you have done that we go to the math part and work around with "check text on screen", there you can save it as a variable and create the necessary conditions you need.
 

Walidhks

New member
I am not sure. Depending on how much effort you want to put in this macro, you could just check most apps/all apps you use, check what description of field indicates that its empty (for this particular field), store all descriptions in an array/dictionary and create one if clause checking if this array contains current variable's value and if it does - paste clipboard text.
Unless someone finds universal way of checking if its really empty (as you said)
+Some empty fields like the one we write here on forum won't be detected by macrodroid and I am not sure either if there's any way to bypass that too. Probably not with ui interactions based triggers/actions

Edit. After runing read screen action the field has key and a value, you can probably use both but long clicking (with key used) will probably trigger even if its not empty
Yes i agree with you, by creating an array grouping all possible texts as variables
 

Walidhks

New member
Thank you for your help, I really appreciate it Topic is still active until a clear solution to be found
 
Top