• 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: My script won't be running stably
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: My script won't be running stably


  • Subject: Re: My script won't be running stably
  • From: Luther Fuller <email@hidden>
  • Date: Tue, 21 Mar 2017 11:49:03 -0500

On Mar 20, 2017, at 4:59 PM, ILJA SHEBALIN wrote:

My script wakes me up at the time prescribed by me by playing my selected tune.

When playing a sound file, you might want to try using the 'afplay' command
instead of using Quicktime Player. For example the following handler repeatedly plays a
sound file until the process 'mainPID' is completed. (I have eliminated parts of the handler
where the sound file is identified since you don't need it.)

on playUntilComplete(mainPID)
--
-- get soundAlias an alias to the sound file
--
--
--
set soundPath to (quoted form of (POSIX path of soundAlias))
set soundpid to do shell script "afplay " & soundPath & " &> /dev/null & echo $!" -- start the music
repeat
delay 1
try
do shell script "ps -p " & mainPID
if not (the result contains mainPID) then error 
on error
exit repeat -- the process mainPID has finished
end try
try
do shell script "ps -p " & soundpid
on error
set soundpid to do shell script "afplay " & soundPath & " &> /dev/null & echo $!" -- restart the music (loop)
end try
end repeat
try
do shell script "kill " & soundpid -- kill the music
end try
end playUntilComplete -------------------------------



 _______________________________________________
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: My script won't be running stably
      • From: debt <email@hidden>
References: 
 >My script won't be running stably (From: ILJA SHEBALIN <email@hidden>)

  • Prev by Date: Re: My script won't be running stably
  • Next by Date: Re: My script won't be running stably
  • Previous by thread: Re: My script won't be running stably
  • Next by thread: Re: My script won't be running stably
  • Index(es):
    • Date
    • Thread