• 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
Mac OS X 10.6 Snow Leopard security changes for scripting additions (was Re: Beeping Beeper)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mac OS X 10.6 Snow Leopard security changes for scripting additions (was Re: Beeping Beeper)


  • Subject: Mac OS X 10.6 Snow Leopard security changes for scripting additions (was Re: Beeping Beeper)
  • From: Chris Page <email@hidden>
  • Date: Mon, 31 Aug 2009 18:54:51 -0700

On Aug 30, 2009, at 6:06 PM, Deivy Petrescu wrote:

tell application "Finder"
beep 2
--> error number -10004
end tell
tell current application
beep 2
end tell

This will happen in many instances.
Even  if there is an error trap, this would not prevent it from beeping.
That is, this beeps.

tell application "Finder"
try
beep 2
on error e
say e
end try
end tell

For security reasons, in Snow Leopard most of the standard scripting additions no longer accept Apple events from other processes (or other machines); instead, the addition event handler returns a “privilege violation” error (-10004).

For compatibility with existing scripts, when AppleScript receives this error, in most cases it redirects the event to the current process to handle instead. This redirection occurs automatically, so the intermediate -10004 error isn’t seen by the script and won’t be caught by “try/on error,” although all the events and replies are logged.

Note that if you send a command to another computer via EPPC, if the addition must be run on the target computer, it may be redirected to System Events on that machine instead of to the current process. For example, “beep” must be handled on the target machine, because you obviously want the sound to play there rather than on the machine running the script.

See the Snow Leopard release notes for AppleScript for more details:

<http://developer.apple.com/mac/library/releasenotes/AppleScript/RN-AppleScript/RN-10_6/RN-10_6.html#//apple_ref/doc/uid/TP40000982-CH106-SW6>

In most cases, this redirection shouldn’t cause any real change to your script behavior, although your script may run slower because of the additional events being sent. We encourage you explicitly send scripting addition commands to the current application, either by prefixing them with “tell me to …” or “my” (when applicable), or by moving them outside of tell blocks.

-- 
Chris Page

 The other, other AppleScript 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: 
 >Beeping Beeper (From: Luther Fuller <email@hidden>)
 >Re: Beeping Beeper (From: Deivy Petrescu <email@hidden>)
 >Re: Beeping Beeper (From: Luther Fuller <email@hidden>)
 >Re: Beeping Beeper (From: Deivy Petrescu <email@hidden>)

  • Prev by Date: Re: Weird Characters
  • Next by Date: RE: Applescript for Rules in Mail
  • Previous by thread: Re: Beeping Beeper
  • Next by thread: Re: Beeping Beeper
  • Index(es):
    • Date
    • Thread