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.
Paste() not working.
Moderator: Martin
Re: Paste() not working.
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().
Adjust the sleep to be enough time. Best is to set to sleep(1000) at first try.
Code: Select all
focusById("com.android.chrome:id/url_bar");
sleep(200);
paste();
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.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: Paste() not working.
I'm using Firefox
And this is my script that paste does not work, focus works just fine:
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();
-
- Posts: 179
- Joined: 16 Oct 2019 17:38
Re: Paste() not working.
Isn't this related to the clipboard restriction?
Paste() works in Automagic. Try it in the Control UI script window.
Hope this helps.
Paste() works in Automagic. Try it in the Control UI script window.
Hope this helps.
Crude but it works.
Re: Paste() not working.
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
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
Re: Paste() not working.
@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
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.
Code: Select all
setText2ById("com.android.chrome:id/url_bar", clip_data);
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.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.