How do you get iTunes track playback time using applescript?

I am just starting to play with Geektool and applescripting to make my Mac desktop desktop, and I came across a question that I cannot find an answer to. How do you get the current playing time of a song from the osascript command? I found great resources on how to do something else with iTunes and osascript on the command line, but no one seems to care at all about showing the current playback time. Thank you I assume it will be something like:

osascript -e 'tell application "iTunes" to time of current track'

I have already tried this, although this also tells me how long the song is. I want to know how long he has been playing.

+3
source share
2

iTunes Suite/application:

(): .

 $ osascript -e 'tell app "itunes" to player position'
 56

, / (, iTunes, -).


, , :

$ osascript -e 'tell app "itunes" to {duration, start, finish} of current track & {player position}'
0.0, 254.772003173828, 254.772003173828, 55

( ) ( MM: SS).

+9

iTunes Applescript . .

-2

Source: https://habr.com/ru/post/1726121/


All Articles