automating gboard

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
tsolignani
Posts: 187
Joined: 12 Jan 2019 11:53
Location: Vignola, Mo, Italy
Contact:

automating gboard

Post by tsolignani » 25 Aug 2019 18:40

Good evening.

This is a bit tricky for me.

I use gboard as a default keyboard.

Many times I use the Google search feature and "copy" (it doesn't get through the system clipboard) some link I found with that into a text I am editing, which is like:

https://automagic4android.com/
Automagic - Android Device Automation

I managed to get when gboard copy and paste link with UI events, component clicked, and now I make it play a sound.

What I would like to do is get the "pasted" text and change its syntax, say to make it a markdown or html link f.i. like [automagic](
https://automagic4android.com/) or else...

But I have no idea how to get to the text passed from gboard to the foreground app.

I tried UI events but found nothing.

Any idea?

Thank you.

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

Re: automating gboard

Post by Desmanto » 26 Aug 2019 18:32

Everytime it copy something, you can use action Copy Text from Clipboard to get the clipboard content. You can use script to process your text, then use action Copy Text to Clipboard to set it back to the OS clipboard, so you can paste it again. You can also trigger event using clipboard changed, so you can monitor for clipboard changes during certain duration.

I made my own clipboard manager to store my last 10 clipboards. So I don't worry missing my clipboard if I accidentally recopy some text.
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.

User avatar
tsolignani
Posts: 187
Joined: 12 Jan 2019 11:53
Location: Vignola, Mo, Italy
Contact:

Re: automating gboard

Post by tsolignani » 27 Aug 2019 05:44

Thank you, but the matter is that gboard pastes that text without getting through the android system clipboard. If I go to the system clipboard, there is nothing.

I don't know how that works, I didn't find anything even checking latest UI events, so I have no idea how to deal with that. I thought maybe you know better android and maybe could spot a way.

Thank you.

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

Re: automating gboard

Post by Desmanto » 29 Aug 2019 18:23

It seems gboard implemented its own clipboard manager which doesn't sync with android clipboard. Try to create a flow with trigger clipboard changed. Add condition debug dialog. Then try several method of copy text using gboard, see if it triggers the flow. If it doesn't trigger anything, seems you have to use other keyboard in order to get the clipboard. I use Smartkeyboard and it works fine with my clipboard manager flow.
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.

User avatar
tsolignani
Posts: 187
Joined: 12 Jan 2019 11:53
Location: Vignola, Mo, Italy
Contact:

Re: automating gboard

Post by tsolignani » 30 Aug 2019 15:30

Thank you. I tried but the trigger doesn't work. I need gboard for it has google search integrated. But I guess there's no way to automate it. Thank you anyway.

Post Reply