Today I am exploring osascript and I am trying to open Mail with a new message prepared for sending:
This works in the terminal
/usr/bin/osascript -e ‘tell application “Mail”’ -e ‘set msg to make new outgoing message with properties {subject:“Test”, content:“Test2”, visible:true}’ -e ‘tell msg to make new to recipient with properties {address:“me@my.com”}’ -e ‘end tell’
How do I do the same with the Xojo shell?
The below returns syntax error (on the sh.Execute line). Well, hm, yes, I get it, but where is the syntax error on that line? Or am I doing something that is not possible?
dim sh as new shell
sh.Mode =1
sh.Execute "osascript -e 'tell application "Mail"' -e 'set msg to make new outgoing message with properties {subject:"Test", content:"Test2", visible:true}' -e 'tell msg to make new to recipient with properties {address:"me@my.com"}' -e 'end tell'"
msgbox str(sh.Result)