I need to send an html based email, and I can’t seem to do it in applescript, but I know how to do it in PHP. However, my osascript sets a variable to do a shell script. I need this variable to get passed to PHP where the email is composed…or else I need to figure out how to send an HTML email in AS. Which is easier? Can anyone help?
you could redirect the value of the variable to a file with something like
do shell script "echo ""ed form of theVar &" > /file"
then in your php do
$theVar = file_get_contents('/file');
which is quite a simple way to pass data around between the 2 technologies
Thanks! This is awesome…Can I pass more than one variable or is it limited to 1?
Well, I see that I can just do a shell script to a temp file for every variable I want – but I was just wondering if I can send them all to the same temp file instead of 1 per file.
do shell script "echo `php -r 'echo serialize(array(\"theVar\"," & theVar & "));'` > /file"
you could serialize them into an associative array then use
$array = unserialize(file_get_contents('/file'));
theres propably a better way but i just cant think of it at the moment.