Created
June 20, 2012 17:12
-
-
Save katsuma/2960993 to your computer and use it in GitHub Desktop.
Add a sound file to iTunes Library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file = MacTypes::FileURL.path(File.expand_path('/tmp/speech.aiff')) | |
command = "tell app \"iTunes\" to add \"#{file.hfs_path}\"" | |
exec_command = "osascript -e '#{command}'" | |
`#{exec_command}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "iTunes" | |
set added_track to add "Machintosh HD:private:tmp:tmp.aiff" | |
play added_track with once | |
delay 5 | |
set loc to (get location of added_track) | |
delete added_track | |
tell application "Finder" | |
delete loc | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment