Text expansion flow

Share and discuss your flows and ideas with other users.

Moderator: Martin

vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

Text expansion flow

Post by vamzicool » 18 Jan 2017 07:09

The following flow called Text expansion expands text when typed into a text box. For example :
"@fn" becomes "Godwin Burby"
"@ph" becomes "+919400961484"
Thus we can store most used text with such shorthands. The only criteria is that the shorthand should always start with "@" symbol. You can modify shorthands by editing the first script action by modifying the global variable global_text_exp which is a map. Ideally this global variable should be assigned in automagic startup flow. And always edit this variable only after disabling the flow otherwise it will result in unwanted modifications inside the script itself.

The flow is given below :

http://automagic4android.com/flow.php?i ... 335c44122a

vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

Re: Text expansion flow

Post by vamzicool » 19 Jan 2017 04:02

To avoid confusion while typing email ids, a new "~" symbol is now available to precede shorthands to increase the scope of usage of this flow. For example :

"~gm" becomes "Good Morning"
"~gn" becomes "Good Night"

"@em" becomes "godwinburby@gmail.com"

As usual global_text_exp map variable in the first script can be modified to suit your needs (after disabling the flow). Please note that the accessibility service should be turned on for automagic for this flow to work.

Updated flow is given below :

http://automagic4android.com/flow.php?i ... 0a8951826c

Ankit Bindal
Posts: 90
Joined: 12 Feb 2016 03:23

Re: Text expansion flow

Post by Ankit Bindal » 20 Jan 2017 07:33

Thanks for sharing a wonderful flow.
1)Is it possible to delete action copy to clipboard, as I don't want to copy the text into clipboard.
2)Remove variable is not able to remove global_text_exp variable, I want to remove variable as well after changing the text, how to do that.

vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

Re: Text expansion flow

Post by vamzicool » 20 Jan 2017 08:22

Hello Ankit to answer your first query i have to say that currently it's not possible because of the following reasons :
(I) to replace shorthand (which is used anywhere inside the text) with the expanded text ,paste is the only option. Other wise the whole text in the text box will be replaced with expanded text.
(II) reason (I) is because control UIs setText and sendText functions needs automagic input methods which needs root permission to be enabled.and other methods like settext2 needs either coordinates or id of the focused text box which can't be retrieved as of now. All these functions seems to replace the whole text even if the shorthand is selected.

And for your second query , if you are unhappy with the global variable just make it local so you need not have to go around deleting it again and again as it will appear again with each single execution of the flow.

vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

Re: Text expansion flow

Post by vamzicool » 20 Jan 2017 08:36

I recommend everyone to use my first flow instead of the second one. Because if your text has newlines or line breaks the second flow will not work.

I think this has mainly to do with the general behaviour of regular expressions in Automagic . Automagic regular expressions search gives no result even if the text in question is in the source text as the source text will have newlines in it. If anyone can help me with this , the second flow can be modified to work flawlessly with texts with newlines.

Ankit Bindal
Posts: 90
Joined: 12 Feb 2016 03:23

Re: Text expansion flow

Post by Ankit Bindal » 20 Jan 2017 10:56

Hi,
Thanks for your reply.
I can't understand your explanation about my second query as i don't know how to write scripts.
Can you post me a flow or give an detailed explanation.
Thanks.
And my device is rooted, if you can help me in my first query also.

vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

Re: Text expansion flow

Post by vamzicool » 20 Jan 2017 13:56

Dear Ankit what I have been trying to explain it to you is that automagic script functionality has limitations because of which I can only rely on copy to clipboard action to accomplish text expansion. So buddy i can't help you with your first query.

As for your second query, since you don't like global variable i have made that into a local variable just for you. The updated flow is given below :

http://automagic4android.com/flow.php?i ... 07f273012e

Now you have to go inside the script and edit "text_exp" local map variable to suit your needs. Sorry , a little bit of knowledge about scripting is needed to use my flow. Cheers

Ankit Bindal
Posts: 90
Joined: 12 Feb 2016 03:23

Re: Text expansion flow

Post by Ankit Bindal » 20 Jan 2017 16:21

Thanks Bro very much for your help.

vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

Re: Text expansion flow

Post by vamzicool » 26 Jan 2017 12:19

I'm back with a few important modifications which enables you to use these flows without any knowledge of scripting. A few helper flows have been added to this new update.

I have moved out the shorthands and the descriptions outside to a text file called text_expansion.txt(please put this text file inside automagic folder). You can look through the attached sample file to see how to input data. Please make sure your data is always enclosed in double quotes

Please create a custom toggle widget using the available global variable global_textexp_state to enable and disable the flow. Edit the above text file only after disabling the flow by using the toggle widget.

Another change is the addition of
@all shorthand which lists all the available shorthands and their descriptions in the text box itself.

And lastly to get started simply run the "text expansion startup" flow.

Updated flows and the sample text file is given below.

http://automagic4android.com/flow.php?i ... f8493bf85a
Attachments
text_expansion.txt
(315 Bytes) Downloaded 382 times

clennep
Posts: 2
Joined: 29 Jan 2017 20:17

Re: Text expansion flow

Post by clennep » 29 Jan 2017 21:10

Many thanks for your flow, @vamzicool.

Post Reply