• 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: Shane Stanley <email@hidden>
  • Date: Fri, 30 Oct 2015 23:24:27 +1100
  • X_v_e_cd: c4afbd7dc1c8b521eb59d370b346bdaa
  • X_v_r_cd: c3efcbbb0b9631f220f5306862301870

On 30 Oct 2015, at 11:19 PM, email@hidden wrote:
>
> The message says
> Can’t get play of missing value.
> What I have is this
>
> use scripting additions
> use framework "Foundation"
> use framework "AppKit"
> set theFile to POSIX path of "Phoenix:Applications:netutils:sounds:logo.mp3"
> set theSound to current application's NSSound's alloc()'s
> initWithContentsOfFile:theFile byReference:false
> tell theSound to play()
> Hopefully I didn't type that all incorrectly?

The code looks correct (as long as there is no return after "alloc()'s"), but the error message suggests the path is incorrect.

Test it like this to see:

use scripting additions
use framework "Foundation"
use framework "AppKit"
set theFile to POSIX path of (choose file of type {"mp3"})
set theSound to current application's NSSound's alloc()'s initWithContentsOfFile:theFile byReference:false
tell theSound to play()


--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>


 _______________________________________________
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: Christopher Stone <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)

  • 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