I wrote an Applescript that adds information about the current track in iTunes to a new DEVONthink note. Especially it ads the player position. So you can take notes about an exact position of a track/podcast/recording…
It would be useful if there was a way to start the track from this DEVONthink note. Is there a way to do this?
I’m just an amateur-AppleScripter, so this script might be buggy. Use it at your own risk.
tell application "iTunes"
activate
set this_track to ""
-- get playing track
if player state is playing then
set this_track to current track
end if
-- if no track is playing, get selected track
if this_track is "" and selection is not {} then
set this_track to item 1 of selection
end if
-- no track is playing or selected
if this_track is "" then
display dialog "No track is selected or playing..." buttons {"Cancel"} default button 1 with icon 2 giving up after 15
end if
-- get the information of the track
set this_name to name of this_track
set this_artist to artist of this_track
set this_album to album of this_track
set this_position to player position
-- convert this_position to dd:hh:mm:ss
set dys to this_position div days as string
if dys = "0" then
set dys to ""
else
set dys to dys & " days "
end if
set this_position to this_position mod days
set hrs to this_position div hours as string
if hrs = "0" then
set hrs to ""
else
set hrs to hrs & " hrs "
end if
set this_position to this_position mod hours
set mins to this_position div minutes as string
if mins = "0" then
set mins to ""
else
set mins to mins & " mins "
end if
set secs to ((this_position mod minutes) as string) & " secs"
set formatted_position to (dys & hrs & mins & secs)
-- make devonthink note
tell application id "com.devon-technologies.thinkpro2" to create record with {name:this_name, type:txt, plain text:("Name: " & this_name & return & "Artist: " & this_artist & return & "Album: " & this_album & return & "Position: " & formatted_position & return & return & "Write your notes here..")}
end tell