Paste() not working.

Post your questions and help other users.

Moderator: Martin

Post Reply
robchoc
Posts: 81
Joined: 20 Jun 2018 12:38

Paste() not working.

Post by robchoc » 06 Feb 2020 12:24

I have a very simple script and want to be able to paste the contents of the clipboard into the search box in a browser.

I can get my cursor to show in the search box but when I use paste() it does nothing. What am I doing wrong?

Thanks for the help.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Paste() not working.

Post by Desmanto » 06 Feb 2020 18:34

What is the browser and hwo do you focus to the search box. If you are using chrome, try to use focusById() first, then paste().

Code: Select all

focusById("com.android.chrome:id/url_bar");
sleep(200);
paste();
Adjust the sleep to be enough time. Best is to set to sleep(1000) at first try.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

robchoc
Posts: 81
Joined: 20 Jun 2018 12:38

Re: Paste() not working.

Post by robchoc » 07 Feb 2020 10:05

I'm using Firefox

And this is my script that paste does not work, focus works just fine:

Code: Select all

focusById("mib"); (I got that using info from show overlay)
sleep(3000);
paste();

Micky Micky
Posts: 179
Joined: 16 Oct 2019 17:38

Re: Paste() not working.

Post by Micky Micky » 07 Feb 2020 17:59

Isn't this related to the clipboard restriction?

Paste() works in Automagic. Try it in the Control UI script window.

Hope this helps.
Crude but it works.

robchoc
Posts: 81
Joined: 20 Jun 2018 12:38

Re: Paste() not working.

Post by robchoc » 08 Feb 2020 09:45

Is there a way around this?


So is it possible to do a long press (no root) until paste pops up and then click that?

EDIT: I got it to work using sendkey ctrl + V

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Paste() not working.

Post by Desmanto » 08 Feb 2020 18:08

@robhoc : I don't your previous action before this CUI. But if you are on android 10 already and automagci can't access clipboard while in firefox, you can popup some input dialog, message dialog or similar, to make Automagic foreground for a while, then have action copy text from clipboard. After the clipboard copied, you can use it then anywhere else. In the case of the url bar, most of the time, you don't need to paste. Use setText2ById() instead. At my chrome, it is

Code: Select all

setText2ById("com.android.chrome:id/url_bar", clip_data);
But if you what you want is simply to open a new tab in browser, just use action Open URL in browser, pick firefox, that's it. It is much faster and you don't have to be in firefox to do it. You can trigger the URL from anywhere.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply