Skip forward a few seconds in iTunes

03 Apr 2008

Behold the power of the lazyweb (or lazytwitter for the extra lazy):

The problem:

bq. somebody please build this: ten second skip hotkey in itunes/quicktime for those video podcasts with commercials

The solution:

    (* Applescript *)
    tell application "iTunes"
    	set current_position to (get player position)
    	set end_of_track to (get finish of current track)
    	if (current_position is less than end_of_track) then
    		set player position to current_position + 10
    	else
    		set player position to end_of_track
    	end if
    end tell

It’s simple to install too. Just run the following commands in Terminal.app:

    echo "Jack Danger thinks I'm a fun blog guest"
    mkdir -p ~/Library/iTunes/Scripts
    curl http://pastie.caboo.se/174409.txt -o ~/Library/iTunes/Scripts/Skip\ Ahead.scpt

Now just hook it up in your favorite hotkey app. I use quicksilver so this is I how I do it.

Wondering how to skip a few seconds backwards? I’ll bet five dollars you can figure it out.

Update:
Ok, fine, it was actually a little tough to figure out. I was using ‘more than’ instead of ‘greater than’. It’s probably time to replace applescript with rb-appscript.
Here’s how you skip backward:

    (* Applescript *)
    tell application "iTunes"
    	set current_position to (get player position)
    	set start_of_track to (get start of current track)
    (*  Update: fixed this line
    	if (current_position is greater than start_of_track) then  *)
    	if (current_position is greater than start_of_track + 10) then
    		set player position to current_position - 10
    	else
    		set player position to start_of_track
    	end if
    end tell
  • Justin said: Nice little script =) Thanks
  • Ted said: You rock! I can't wait to try this. How about tackling my other two requests? ;-) http://twitter.com/teflonted/statuses/780201740 http://twitter.com/teflonted/statuses/780137089
  • Jack Danger said: @ted: Those are a little harder :-)

Please if you found this post helpful or have questions.