cURL with $runapplescript
Nick Renders
omnis1 at arcict.com
Mon Jan 29 04:22:03 EST 2018
Hi Michael,
Have you tried catching the error in AppleScript?
try
set strResult to do shell script "curl http://www.omnis.nett"
on error strError number nrError
set strResult to "ERROR " & nrError & return & strError
end try
return strResult
Also, you could try and write the CURL output in a text file,
but I'm not sure if it would write any errors. Perhaps one of
the CURL parameters will allow you to do so
curl http://www.omnis.nett > ~/Desktop/curloutput.txt
Nick Renders
On 26 Jan 2018, at 17:09, Michael Mantkowski wrote:
> 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
> 1-614-875-2245
> *********************************************************************
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
More information about the omnisdev-en
mailing list