UI text input char replace

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
yogi108
Posts: 100
Joined: 09 Nov 2016 08:00
Contact:

UI text input char replace

Post by yogi108 » 05 Aug 2017 12:29

Hi,

Just got the following working:

text = getTextById("com.p1.chompsms:id/new_message_field");
text=replace(text, '“', '"');
setText2ById("com.p1.chompsms:id/new_message_field", text);

Normally I want the character " for scripting, in the case above typing SMS.
If the character “ appears, it should be replaced with ", hope you see the little difference.
It works with chomp SMS because I got the text id.

Could this be done global as well?
Package with *
Getting the textfield id which has focus, replacing the character and writing the new value back?

Thanks a lot,
"You cannot know the meaning of your life until you are connected to the power that created you.”
Shri Mataji Nirmala Devi, founder of Sahaja Yoga

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: UI text input char replace

Post by Martin » 05 Aug 2017 19:03

Hi,

You could try to get this working with trigger UI Event and Event Type Text changed.
I think there are some examples in the flow sharing forum that used this feature to replace some abbreviations to the longer form while typing.

Regards,
Martin

User avatar
yogi108
Posts: 100
Joined: 09 Nov 2016 08:00
Contact:

Re: UI text input char replace

Post by yogi108 » 06 Aug 2017 11:06

Hi Martin,

I found the flow text expansion and will have a deeper look at it,

Wie immer Danke :-)
LG
"You cannot know the meaning of your life until you are connected to the power that created you.”
Shri Mataji Nirmala Devi, founder of Sahaja Yoga

Post Reply