cURL with $runapplescript

Michael Mantkowski michaelj at
Fri Jan 26 11:09:16 EST 2018

We are using the code below to run cURL on the Mac to send a email.  It
works fine when all your input is correct.  But if you have a incorrect
password for instance, then the "Result" field is returned and empty and the
lvError is 1753.

Does anyone know how to make it return the status information from cURL even
if the command is not successful?  I want to use that to help the user know
what is wrong.

Begin text block
Text: curl -s -S --verbose --url
'smtp[pick(pSecure,'','s','')]://[pHostName]' --ssl (Carriage return)
Text: --mail-from '[pSenderEmail]' (Carriage return)
Text: --mail-rcpt '[pRecipientEmail]' (Carriage return)
Text: --upload-file [MessageFilePathPOSIX] (Carriage return)
Text: --user '[pUserName]:[pPassword]' (Carriage return)
Text: 2>&1     ;; Outputs STDERR to STDOUT.  Verbose uses STDERR.
Applescipt returns STDOUT
End text block
Get text block Command
Do replaceall(Command,kCr,kSp) Returns Command     ;; Replace carriage
returns with spaces to correct the formatting of the command.  Text blocks
in omnis dont allow leading or trailing spaces

Calculate AppleScript as con("do shell script ",kDq,Command,kDq)
Do $runapplescript(AppleScript,Result) Returns lvError
Calculate pTranscriptOut as Result

Michael Mantkowski
ClienTrax Software

More information about the omnisdev-en mailing list