Page 1 of 1

Ui event text variable bug

Posted: 02 Jun 2017 17:48
by houdinix64
Im not sure if this is a bug or phone related problem.

Phone model: huawei p8 lite 2017, nougat
Automagic: latest version from playstore

The text variable generated by UI event: component clicked cannot be recognized.

Trigger: ui event component click
App = messaging

When I clicked one of my contact name in my inbox, text captured
text = GLOBE

I have a problem with the text variable, i cannot used it in my flows.

Re: Ui event text variable bug

Posted: 02 Jun 2017 19:59
by Martin
Hi,

What do you mean by text variable can not be recognized for UI Event? Does the trigger not provide the variable at all or does the variable contain the "wrong" value?

Your example flow is interesting. The left (Bad) branch assigns the text GLOBE that contains a few non-printable unicode characters so it's not visible in any text editor, however the string assigned to the variable text indeed is not the same like the one tested in the condition afterwards so I think this is not a bug.
You can make the characters visible with: text = replaceAll(text, '\\p{C}', '?');
or remove such characters with: text = replaceAll(text, '\\p{C}', '');

Regards,
Martin

Re: Ui event text variable bug

Posted: 03 Jun 2017 00:07
by houdinix64
Thanks Martin. Using text = replaceAll(text, '\\p{C}', '');
solved the problem.

The variable text contains the right value however you have to used the command above before you can normally used it in the flow. Sorry Im a newbee, no background in programming. :)

Re: Ui event text variable bug

Posted: 03 Jun 2017 19:25
by Martin
No problem, I've never seen this issue myself and it is quite difificult to understand what might be going on. Maybe I could add an option to trigger UI Event to remove such values automatically when the flow is executed. I'm not sure if there's a good way to avoid the problem in scripts. Maybe pasting the value into a string literal could use the unicode escape sequences for the special characters so it would become visible at least.

Regards,
Martin