copy a variable to the clipboard inside Control UI

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:

copy a variable to the clipboard inside Control UI

Post by tsolignani » 07 Jan 2020 06:27

Is it possible to copy a variable's content into the system clipboard while executing a control UI block, or do I have to split the block in two and use an automagic action in between?

Thank you.

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

Re: copy a variable to the clipboard inside Control UI

Post by Desmanto » 07 Jan 2020 16:40

Yes, just parallel them. Let say your previous action is Script. Then just add Copy Text to clipboard, put the variable. From the same action script, add another control UI, do the CUI script you need. Both Copy text and CUI will execute at the same time (not exactly, but at the same execuiton step). If you mean to split is to have 2 action, then yes this is splitted into 2, action Copy Text to Clipboard and Control UI.
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: copy a variable to the clipboard inside Control UI

Post by tsolignani » 11 Jan 2020 10:47

Thank you.

The control UI block has to paste from the clipboard, but, since there are many sleep points, the clipboard could get changed since the control UI block starting then ending into pasting the wrong text.

I wonder if I could put the command to copy a certain variable to the clipboard on a line inside the control UI block or if I have to create 3 blocks: first part control UI, copy variable to clipboard, second part control UI

Thank you.

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

Re: copy a variable to the clipboard inside Control UI

Post by Desmanto » 11 Jan 2020 17:44

If clipboard is necessary in the CUI script, then yes you have to split them. CUI > Copy to clipboard > CUI. Currently there is no function to copy from clipboard, you have to use the action.

But if it is possible, try to find a way if you can use setText2Byid() instead. It won't works on all cases, but maybe it works at that particular usage. setText2ById() will replace the whole element text, so you need to getTextById() first if you need to concatenate. In this case, paste() seems better solution.
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: copy a variable to the clipboard inside Control UI

Post by tsolignani » 11 Jan 2020 20:40

Thank you.

Post Reply