Skip to content

Instantly share code, notes, and snippets.

@eseiver
Last active August 2, 2017 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eseiver/ad535c58c8356d3bfb5ae5264c021205 to your computer and use it in GitHub Desktop.
Save eseiver/ad535c58c8356d3bfb5ae5264c021205 to your computer and use it in GitHub Desktop.
An applescript that returns the timecode position of the current iTunes track. Handy if transcribing or taking notes on an audio file!
tell application "iTunes"
set elapsed_seconds to player position
set this_elapsed_minutes to round elapsed_seconds / 60 rounding down
set N to result
if N < 10 then
set N to 0 & N
end if
set this_elapsed_seconds to elapsed_seconds mod 60
if {1, 2, 3, 4, 5, 6, 7, 8, 9, 0} contains this_elapsed_seconds then
set this_elapsed_seconds to "0" & (this_elapsed_seconds as string)
end if
set this_elapsed_hours to round elapsed_seconds / 3600 rounding down
set this_elapsed_seconds2 to round (this_elapsed_seconds)
end tell
return ("### 0" & this_elapsed_hours & ":" & N & ":" & this_elapsed_seconds2) as text --
set the clipboard to result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment