• 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: Playing Sounds in AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Playing Sounds in AppleScript


  • Subject: Re: Playing Sounds in AppleScript
  • From: Christopher Stone <email@hidden>
  • Date: Fri, 30 Oct 2015 08:14:00 -0500

On Oct 30, 2015, at 07:24, Shane Stanley <email@hidden> wrote:
The code looks correct (as long as there is no return after "alloc()'s"), but the error message suggests the path is incorrect.
______________________________________________________________________

Works for me.

--
Take Care,
Chris

-------------------------------------------------------------------------------------------
# dNam: Playing Sounds with ASObjC
# dMod: 2015/10/30 08:01
-------------------------------------------------------------------------------------------

use scripting additions
use framework "Foundation"
use framework "AppKit"

tell application "Finder" to set finderSelectionList to selection as alias list

if finderSelectionList is not {} then
  set theSound to POSIX path of first item of finderSelectionList
  tell (current application's NSSound's alloc()'s initWithContentsOfFile:theSound byReference:false) to play()
end if

-------------------------------------------------------------------------------------------

 _______________________________________________
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: Playing Sounds in AppleScript
      • From: email@hidden
References: 
 >Playing Sounds in AppleScript (From: email@hidden)
 >Re: Playing Sounds in AppleScript (From: Shane Stanley <email@hidden>)
 >Re: Playing Sounds in AppleScript (From: email@hidden)
 >Re: Playing Sounds in AppleScript (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Playing Sounds in AppleScript
  • Next by Date: Re: Playing Sounds in AppleScript
  • Previous by thread: Re: Playing Sounds in AppleScript
  • Next by thread: Re: Playing Sounds in AppleScript
  • Index(es):
    • Date
    • Thread