Re: What is the "error message" in AppleScript (from TN2065)
Re: What is the "error message" in AppleScript (from TN2065)
- Subject: Re: What is the "error message" in AppleScript (from TN2065)
- From: "Mark J. Reed" <email@hidden>
- Date: Mon, 6 Oct 2008 22:48:10 -0400
On Mon, Oct 6, 2008 at 10:05 PM, Jerry Krinock <email@hidden> wrote:
> In Apple's TN2065 [1], regarding 'do shell script', I read:
>
> "If the script printed something to the standard error stream, that text
> becomes the error message in AppleScript."
>
> What is the "error message" in AppleScript? How can I set a variable to it?
The error message shows up as a thrown exception, but only if the
shell command indicated an error via nonzero exit code. You can force
that by sticking an exit command at the end of the pipeline. Ex:
try
do shell script "echo >&2 boo; exit 0"
on error e
set theMessage to e
end try
theMessage -- "boo"
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden