This fails to work
with (Application("Messages")) {
send(text, {to: services["SMS"].buddies[phone]})
}
with Error: Expecting object specifier. Argument has no object specifier.
text is valid and not null. phone is valid and not null. If I hard code the values it works. I decided to try 'dynamic' hard coding which worked.
command = 'with (Application("Messages")) { send("' + text + '", {to: services["SMS"].buddies["' + phone + '"]}) } ;' ;
eval(command) ;
Is there a more elegant way of overcoming this? Why would eval work but the code with the variables not?