Page 1 of 1

Any way to count character while typing?

Posted: 21 Aug 2019 08:25
by tsolignani
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.

Re: Any way to count character while typing?

Posted: 21 Aug 2019 12:47
by Rafi4
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

Re: Any way to count character while typing?

Posted: 21 Aug 2019 18:15
by Desmanto
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 9395 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.

Re: Any way to count character while typing?

Posted: 24 Aug 2019 08:33
by tsolignani
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.