Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Finish current track in iTunes playlist and pause' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Finish current track in iTunes playlist and pause
Authored by: ChaChi on Oct 14, '10 09:23:47AM
This is about as close as I've ever gotten to achieving this...
set curPos to 0
repeat 20 times
	set curPos to curPos + getCur()
	my goSleepy(0.1)
end repeat
set curPos to curPos / 20 + 2

tell application "iTunes"
	my goSleepy((duration of current track) - curPos)
	pause
end tell

on goSleepy(x)
	do shell script "sleep " & x
end goSleepy

on getCur()
	tell application "iTunes" to return player position
end getCur
One main problem is iTunes "player position" is only accurate to 1 second. This script, although not very elegant, tries to average out a more accurate "player position". Hope this helps someone...

[ Reply to This | # ]