Re: Playing Sounds in AppleScript
Re: Playing Sounds in AppleScript
- Subject: Re: Playing Sounds in AppleScript
- From: Christopher Stone <email@hidden>
- Date: Fri, 30 Oct 2015 08:41:20 -0500
- X_v_e_cd: 4be3e5042168bb8bb583b17844ee332f
- X_v_r_cd: 416b986834333b418bb50087859437cb
What I am trying to ask is, how can I resolve the problem of, a user's hard drive is called macintosh HD, yet the above code produces an error. So how do I tell the file to play on Macintosh HD? ______________________________________________________________________
Hey There,
Well – my code operates on the selected file in the Finder – so it's not going to have problems if the file is a playable sound file.
If you're playing from a fixed path on a given system you can use path to <folder-name> from the StandardAdditions.osax (available folders are listed in the StandardAdditions.osax AppleScript dictionary – viewable in the Script Editor).
set myPosixPath to POSIX path of ((path to documents folder as text) & "Library Storage:Sound Library:Sounds from the Internet:affirmative.wav")
Or you could use a home-folder-based path:
tell application "System Events" to ¬ set myPosixPath to POSIX path of disk item "~/Documents/Library Storage/Sound Library/Sounds from the Internet/affirmative.wav"
Is that what you were wanting to know?
|
_______________________________________________
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