• 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: How to play consecutive sounds?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to play consecutive sounds?


  • Subject: Re: How to play consecutive sounds?
  • From: Brian Christmas <email@hidden>
  • Date: Fri, 02 Oct 2015 16:14:53 +1000

G’day Shane, and thanks, it worked in the format you posted.

However, when I try and transfer the code to my real situation, which I did not post because of the length, I only get one sound.

I’ve tried to work out why, but it’s beyond me.

Any advice greatly appreciated.

Regards

Santa

property theSound : ""
property soundCounter : 0


on applicationWillFinishLaunching:aNotification
set my ShanesFord to current application's ObjectWithFords's alloc()'s init()
set my theSound to current application's NSSound's soundNamed:"Glass"
theSound's setDelegate:me
my initializingRoutineTwo()
end applicationWillFinishLaunching:


on |sound|:theSound didFinishPlaying:someBool
set soundCount to my soundCounter
set my soundCounter to soundCount - 1
if soundCount > 0 then
theSound's play()
end if
end |sound|:didFinishPlaying:


Part of handler

if my serverBackupState and my attachmentCounter = 0 then
try
tell application "Finder" to set my dailyServerFolder to (my serverFolder & ":" & ("Yearly Email Storage " & my theYear as text) & ":" & (my theAddedMonth) & ":" & (my dailyName) as text)
on error errmsg number errnum
if my runForOz or errnum = 1 then tell application "System Events" to display dialog "Mail Manager Loop Runner setupPrintCoverPage setting dailyServerFolder folder. The Server may not be available. Error " & errmsg & " error number " & errnum & " p = " & p giving up after 10
end try
set p to 10
try
do shell script "mkdir -p " & quoted form of POSIX path of (my dailyServerFolder as text)
on error errmsg number errnum
if my runForOz then say "calling sound” —< says this
set my soundCounter to 3
theSound's play() —< plays once
Called from next handler
if my runForOz then say "calling sound” —< says this
set my soundCounter to 3
theSound's play() — < doesn’t play



On 2 Oct 2015, at 2:34 pm, Shane Stanley <email@hidden> wrote:

Try to avoid loops with delays in them where possible. 

property soundCounter : 0

on applicationWillFinishLaunching:aNotification
set theSound to current application's NSSound's soundNamed:"Glass"
theSound's setDelegate:me
set my soundCounter to 4
theSound's play()
end applicationWillFinishLaunching:

on |sound|:theSound didFinishPlaying:someBool
set soundCount to my soundCounter
set my soundCounter to soundCount - 1
if soundCount > 0 then
theSound's play()
else
my initializingRoutineTwo()
end if
end |sound|:didFinishPlaying:


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


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to play consecutive sounds?
      • From: Shane Stanley <email@hidden>
References: 
 >How to play consecutive sounds? (From: Brian Christmas <email@hidden>)
 >Re: How to play consecutive sounds? (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: How to play consecutive sounds?
  • Next by Date: Re: How to play consecutive sounds?
  • Previous by thread: Re: How to play consecutive sounds?
  • Next by thread: Re: How to play consecutive sounds?
  • Index(es):
    • Date
    • Thread