Any way to count character while typing?

Post your questions and help other users.

Moderator: Martin

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

Any way to count character while typing?

Post by tsolignani » 21 Aug 2019 08:25

Is there any way to count characters while typing them into automagic?

Say I have an input dialog where I am collecting a string to populate a field with a 70 char max limit.

Seeing in real time how many char you are using maybe via a screen notification would be useful.

Thank you.

User avatar
Rafi4
Posts: 210
Joined: 01 Dec 2017 05:23

Re: Any way to count character while typing?

Post by Rafi4 » 21 Aug 2019 12:47

Hi
If string length greater than 70 characters you will be go back to input dialog. String length lower than 70 characters you will be continued.put everything As in screen shot.

See screen shot.

From record4
Attachments
21.08.2019 18-10.png
Screen shot
21.08.2019 18-10.png (100.71 KiB) Viewed 760 times
Samsung Galaxy j2 non rooted.
Android 5.1.1

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

Re: Any way to count character while typing?

Post by Desmanto » 21 Aug 2019 18:15

Currently Input dialog doesn't have that function. But you can create your own by using widget.

You can also use screen notification (notification on screen), by putting the Control UI in other flow and use looped Control UI to check the Input Dialog text content length. But as I tried, the constant toast message is so annoying and distracting. The speed also limited to 1 update per seconds. You can also use Trigger UI event and check for text changed. But again it will trigger so frequently that it will probably freeze your phone as you type the text.

So far, I think widget method is the best. I have attached the flow : Char Count and Widget
Char Count.png
Char Count.png (82.87 KiB) Viewed 743 times
The count using a widget as the text count display.
1. Before the input dialog, show the widget
2. Launch the input dialog, along with the parallel execution of Control UI. This Control UI has looped script to retrieve the word and count the length, then set it to widget every 500 ms (the fastest speed you can update a widget)
4. I put another 2 checks for the length. If it is more than 50 chars, change the color to yellow. If more than 70 chars, change color to red. We can force a cancel and clear out the text on over 70 chars, but I think that is too harsh. You just need a visual clue that you have overtyped the text.
3. Once you press OK or cancel, it will hide the widget
4. If you press OK, then it will continue to show the toast message of what you have typed, including the char count

BTW, I forgot to give comment (description) inside the CUI script and have uploaded it. I don't want to reupload unless it is necessary. Since it is short, I think it is still readable by most of us. As usual, modify the flow as you need.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

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

Re: Any way to count character while typing?

Post by tsolignani » 24 Aug 2019 08:33

Wow. That's just what I needed. And I learned many new things as well! Thank you so much! Automagic is really magic, I am using my peripherals the good way, at last. Love it. Thanks.

Post Reply