Page 1 of 3
Text expansion flow
Posted: 18 Jan 2017 07:09
by vamzicool
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
Re: Text expansion flow
Posted: 19 Jan 2017 04:02
by vamzicool
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
Re: Text expansion flow
Posted: 20 Jan 2017 07:33
by Ankit Bindal
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.
Re: Text expansion flow
Posted: 20 Jan 2017 08:22
by vamzicool
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.
Re: Text expansion flow
Posted: 20 Jan 2017 08:36
by vamzicool
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.
Re: Text expansion flow
Posted: 20 Jan 2017 10:56
by Ankit Bindal
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.
Re: Text expansion flow
Posted: 20 Jan 2017 13:56
by vamzicool
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
Re: Text expansion flow
Posted: 20 Jan 2017 16:21
by Ankit Bindal
Thanks Bro very much for your help.
Re: Text expansion flow
Posted: 26 Jan 2017 12:19
by vamzicool
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
Re: Text expansion flow
Posted: 29 Jan 2017 21:10
by clennep
Many thanks for your flow, @vamzicool.