• 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: Applescript-Shell Error Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applescript-Shell Error Question


  • Subject: Re: Applescript-Shell Error Question
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 15 Sep 2012 12:56:17 -0500

Hey Jon,

On Sep 15, 2012, at 11:57, Jon Pugh <email@hidden> wrote:
The problem is that xattr is returning a non-zero result code, which “do shell script” turns into a thrown error.

Right.  I thought I could dump that to /dev/null and be done with it but apparently not.

The AppleScript way to cope is with a try/error block.

Obviously.  :)

A Unix shell technique would be to end with a non-erroring command.  Just as an example, try this:

Ah.  I get it.  Thanks for the tip.

Since you want the info from xattr, this isn’t a proper solution, but it does illustrate what you are asking about.  ;)

In this particular case I don't want the info from xattr.  I just want to turn off any quarantining in the front Finder window and get on with life.

However your tip gave me an idea for getting the output neatly from the shell:

tell application "Finder"
set d to target of front window as string
end tell
set d to POSIX path of d
set cmd to "cd " & quoted form of d & ";
S=`xattr -d com.apple.quarantine * 2>&1`;
echo \"$S\";"
do shell script cmd without altering line endings

--
Take Care,
Chris

 _______________________________________________
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: 
 >Applescript-Shell Error Question (From: Christopher Stone <email@hidden>)
 >Re: Applescript-Shell Error Question (From: Jon Pugh <email@hidden>)

  • Prev by Date: Re: Applescript-Shell Error Question
  • Next by Date: Re: Applescript-Shell Error Question
  • Previous by thread: Re: Applescript-Shell Error Question
  • Next by thread: Re: Applescript-Shell Error Question
  • Index(es):
    • Date
    • Thread