• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: What is the "error message" in AppleScript (from TN2065)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the "error message" in AppleScript (from TN2065)


  • Subject: Re: What is the "error message" in AppleScript (from TN2065)
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 7 Oct 2008 11:32:55 -0700

On Oct 6, 2008, at 7:48 PM, Mark J. Reed wrote:

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"

...except that, as Mark implies, the number after the "exit" has to be something other than 0. On the other hand, using "exit 0" can be handy for suppressing shell script errors.



--Chris Nebel AppleScript Engineering

_______________________________________________
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
  • Follow-Ups:
    • Re: What is the "error message" in AppleScript (from TN2065)
      • From: "Mark J. Reed" <email@hidden>
References: 
 >What is the "error message" in AppleScript (from TN2065) (From: Jerry Krinock <email@hidden>)
 >Re: What is the "error message" in AppleScript (from TN2065) (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: Can the AppleScript implementation of an AS application be exposed via terminology?
  • Next by Date: Re: What is the "error message" in AppleScript (from TN2065)
  • Previous by thread: Re: What is the "error message" in AppleScript (from TN2065)
  • Next by thread: Re: What is the "error message" in AppleScript (from TN2065)
  • Index(es):
    • Date
    • Thread