• 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: "S. J. Cunningham" <email@hidden>
  • Date: Fri, 30 Oct 2015 07:37:17 -0400


On Oct 30, 2015, at 7:29 AM, email@hidden wrote:

Hi there,
I wanted to see if there was a possibility of playing sounds in my scripts?
The sounds are .mp3 files.
The only way I know how, was using Play Sound. However my concern
would be, if the user's hard drive name wasn't MacintoshHD, then how
will the sounds be played?
Also, is there no alternative to the Play Sound application?
Thanks.

Here's a script I use to wake me up in the morning:

property Reveillie : alias "MacBook Pro:Users:sjc:Documents:Development:cron:Reveille.mp3"
property sysVolMax : 100
property qtVolMax : 256
property reveilleVol : 30 -- reduce to 10 for external speakers
property logfile : "MacBook Pro:Users:sjc:Documents:Development:cron:Debug Log.txt"
try
set logFileID to open for access file logfile with write permission
on error
close access file logfile
return
end try
write ¬
return & "Start at: " & (current date) & return & return to logFileID ¬
starting at get eof of logFileID

-- Set System Volume
set pctVol to reveilleVol / sysVolMax
set saveSysVol to output volume of (get volume settings)
display dialog "Current System Volume is " & saveSysVol
write ¬
"System Volume = : " & saveSysVol & return to logFileID ¬
starting at get eof of logFileID
set volume output volume pctVol * sysVolMax
set newSysVol to output volume of (get volume settings)
display dialog "New System Volume is " & newSysVol

tell application "QuickTime Player"
activate
set theFile to open Reveillie
set audio volume of document 1 to pctVol * qtVolMax
play document 1
repeat while playing of document 1
delay 1
end repeat
-- display dialog "quitting"
quit


end tell

-- Restore System Volume Settings
set volume output volume saveSysVol
write ¬
"Stop at: " & (current date) & return & return to logFileID
close access logFileID

Steve
------------------
OS X 10.6.8, AppleScript 2.1.2

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

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