• 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: on error result, how to parse
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: on error result, how to parse


  • Subject: Re: on error result, how to parse
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 5 Feb 2008 12:24:04 -0800

On Feb 5, 2008, at 3:40 AM, email@hidden wrote:

Yes replying to my own post!

on error errtxt
	my log_eventlocal("Error with Account Creation"& errtxt)

end try

on log_eventlocal(themessage)
set theLine to (do shell script "date +'%Y-%m-%d %H:%M:%S'" as string) & " " & themessage
do shell script "echo " & theLine & " >> " & logpath & "/test.txt"
end log_eventlocal


but the error returned by the lovely Entourage has a ' in text.. which catches out my shell script!

:(

i'll have a think....

The "quoted form" property is your friend:

do shell script "echo " & quoted form of theLine & " >> " & logpath & "/test.txt"

For other tips on using "do shell script", see <http://developer.apple.com/technotes/tn2002/tn2065.html >.


--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
References: 
 >re:on error result, how to parse (From: email@hidden)

  • Prev by Date: Re: Apple Mail - "content" command suddenly does not work - Found Culprit - Time Machine!
  • Next by Date: Evaluating Double Byte
  • Previous by thread: re:on error result, how to parse
  • Next by thread: Setting the correct linefeed.
  • Index(es):
    • Date
    • Thread