I've been hunting down a problem with one of my flows for a day, which appears to be a bug in Automagic. As I have reported bugs before which weren't reproducible, I have this time reduced the problem to a simple script as action.
The gist of the problem is:
Conditionals using curly braces for blocks of code won't be executed when executed through eval.
Flow demonstrating the problem:
http://automagic4android.com/flow.php?i ... cb1afcdf40
eval with curly braces
Moderator: Martin
Re: eval with curly braces
Hi,
Automagic replaces inline expressions within string literals so the string assigned to the part {global_foo=1} is replaced by 1:
becomes
You can also see this by adding a condition Debug Dialog after the script is executed.
This behavior is by design. Check out section String inline expressions in the help page of action Script.
You can use single quotes to avoid that inline expressions in strings are interpreted:
Regards,
Martin
Automagic replaces inline expressions within string literals so the string assigned to the part {global_foo=1} is replaced by 1:
Code: Select all
"global_foo=0; if (true) { global_foo=1; }"
becomes
Code: Select all
foo="global_foo=0; if (true) 1";
This behavior is by design. Check out section String inline expressions in the help page of action Script.
You can use single quotes to avoid that inline expressions in strings are interpreted:
Code: Select all
foo='global_foo=0; if (true) { global_foo=1; }'
eval(foo);
Regards,
Martin
Re: eval with curly braces
/me slaps forehead.
I should have thought of that ...
Thanks, Martin.
I should have thought of that ...
Thanks, Martin.
Re: eval with curly braces
No problem, this feature is hidden quite well.
Adding syntax highlighting within string literals would make this more obvious but I did not yet have the time to implement it.
Adding syntax highlighting within string literals would make this more obvious but I did not yet have the time to implement it.