Page 1 of 1

recent auto tools plugins broken

Posted: 15 Sep 2016 10:59
by newturn
hi Martin,

i am wondering no one noticed this yet.

It seems all new auto tools plugins are broken, since they use json with curved clips { and quotes " for formatting. Thus no configuration text made by the plugin will be replaced through automagic and associated variables. I am only able to use normal text and no automagic variables :(

Martin, can you fix this somehow??

thank you in advance!

Re: recent auto tools plugins broken

Posted: 16 Sep 2016 19:01
by Martin
Hi,

Can you give an example of an Auto tools plugin that broke?
Maybe you can also use string concatenation to replace parts within the text, e.g. putString("xyz", '{"abc":'+variable+'}') or something similar.

Regards,
Martin

Re: recent auto tools plugins broken

Posted: 16 Sep 2016 19:35
by newturn
Glad you replied.

Please see screenshot. I don't think concenation is a option. After changing plugin settings you would have to redo it. Also please keep in mind this doesn't only effect the auto tool plugin.

Re: recent auto tools plugins broken

Posted: 16 Sep 2016 20:23
by Martin
Hi,

I also found one that uses JSON...
For the moment you have to use string concatenation to replace the variables. There's probably not going to be a much better way in the short term. I could try to detect when the format is JSON and then use another way to replace the variables, however this is quite complicated and probably fails in some cases.

Example to use string concatenation:

Original:

Code: Select all

putString("parameters", '{"advancedSettings":{"deviceName":"{variable}","sendCustomMessage":false}}');
New:

Code: Select all

putString("parameters", '{"advancedSettings":{"deviceName":"' + variable + '","sendCustomMessage":false}}');
Alternatively, you can break the string into multiple parts. The parts with variable replacements have to be wrapped in double quotes:

Code: Select all

putString("parameters", '{"advancedSettings":{"deviceName":"' + "{variable}" + '","sendCustomMessage":false}}');
I find it quite interesting that the author of the auto-tools has decided to switch to this JSON-approach, since the plugin itself will break quite easily in all automation tools when the replaced text contains a value that looks like JSON or when it just contains double quotes etc.

Assume that variable contains the value abc"123. Automagic will replace the variable and will pass the plugin following text:

Code: Select all

{"advancedSettings":{"deviceName":"abc"123","sendCustomMessage":false}}
That's not valid JSON anymore so the plugin can not even parse the JSON value.

Maybe the author of the plugin is not aware about this issue :?
I'll try to contact the developer of the plugins...

Regards,
Martin

Re: recent auto tools plugins broken

Posted: 20 Sep 2016 19:37
by Martin
The author of the auto-plugins was aware about the mentioned issue but implemented a workaround that only works with the Tasker variable syntax (%variable).

Please check the latest EAP version. It contains a new way to replace variables in case the plugin uses JSON for the values so the Auto-plugins and Automagic should be compatible again (I've just tested with the app Join).
Automagic will take care of properly escaping the values passed to the JSON so the auto-plugins should just start to work after the plugin was configured the next time in Automagic.

Regards,
Martin

Re: recent auto tools plugins broken

Posted: 20 Sep 2016 19:38
by newturn
martin,

sorry that i didn't come around to answer.

Just short: THANK YOU!!!

I will try it later when i am again at home with a little bit of free time :)

best regards