• 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: beep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: beep


  • Subject: Re: beep
  • From: Ron Hunsinger <email@hidden>
  • Date: Fri, 29 Apr 2011 13:20:04 -0700

On Apr 29, 2011, at 10:34 AM, louie wrote:
> Hi all I am trying to change the beep sound when running a script.
> The below no workie.
> Thanks for any help.
>
> tell current application
> beep as "Tink"
> end tell

Try:
	do shell script "/usr/bin/afplay '/System/Library/Sounds/Tink.aiff'"

You need the full, exact path to the sound file. If you know which beep you want at the time you write the script, hard code the full path in the script. If you won't know the "beep name" until runtime, you'll have to search for it in all the usual locations (~/Library/Sounds, /Library/Sounds, and /System/Library/Sounds), where it might appear with either a .aif or a .aiff filename extension. Something like:

property dirs : {path to home folder, path to startup disk, path to system folder}
property exts : {".aif", ".aiff"}

on playBeep(beepname)
	set beeppath to missing value
	repeat with aDir in dirs
		repeat with anExt in exts
			set fullPath to (aDir as string) & "Library:Sounds:" & beepname & anExt
			tell application "Finder"
				if exists alias fullPath then
					set beeppath to fullPath
					exit repeat
				end if
			end tell
		end repeat
	end repeat
	if beeppath is not missing value then
		set beeppath to quoted form of POSIX path of beeppath
		do shell script "/usr/bin/afplay " & beeppath
	end if
end playBeep

playBeep("Tink")
playBeep("Basso")

 _______________________________________________
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: beep
      • From: Luther Fuller <email@hidden>
    • Re: beep
      • From: Tommy Bollman <email@hidden>
References: 
 >beep (From: louie <email@hidden>)

  • Prev by Date: Re: beep
  • Next by Date: Re: beep
  • Previous by thread: Re: beep
  • Next by thread: Re: beep
  • Index(es):
    • Date
    • Thread