Skip to content

Instantly share code, notes, and snippets.

@mxswd
Created December 24, 2013 09:39
Show Gist options
  • Save mxswd/8110900 to your computer and use it in GitHub Desktop.
Save mxswd/8110900 to your computer and use it in GitHub Desktop.
Log song titles from iTunes http audio streaming to a file.
-- http://www.macosxautomation.com/applescript/sbrt/sbrt-09.html
on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as string
set the open_target_file to open for access file target_file with write permission
if append_data is false then set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
tell application "iTunes"
set song_title to current stream title
set mydate to do shell script "date '+%d/%m/%Y'"
set datas to (mydate) & ", " & song_title & return
set fileo to (((path to desktop folder) as string) & "Song List.txt")
my write_to_file(datas, fileo, true)
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment