Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

js01

macrumors newbie
Original poster
Oct 7, 2007
2
0
hi, i've written a simple applescript to find and play a song in itunes using dialog boxes with text input option and matching the track name to the text that was entered. it works fine but when i then go back to itunes and press skip, it just goes back to the beginning of the song as if it's on single song repeat. it does the same thing when i choose shuffle songs on front row, so i don't think it's a problem with my script. any ideas why this might have happened / ever heared of it doing this before? any comments would be helpful :) cheers.
 

Mekanik561

macrumors newbie
Feb 10, 2007
8
0
If you post the code I'll be more than happy to look at it. I work with AppleScript for a living.

Make sure to set the view of itunes to the container of the playing track.

tell application "iTunes"
--foo is just whatever your search returns
set foo to file track 3 of playlist 10 of source 1
set bar to container of foo
set view of window "iTunes" to bar
play foo
--just to be sure
set song repeat of current playlist to all
delay 3
next track
end tell
 

js01

macrumors newbie
Original poster
Oct 7, 2007
2
0
Here's my script

thats great, cheers for the reply, here's the script i have at the moment

repeat
repeat
repeat
display dialog "Enter Song Title" default answer ""
set song_name to text returned of result
if song_name is "" then display alert "You Must Enter A Song Title"
if song_name is not "" then exit repeat
end repeat
display dialog "Enter Artist Name" default answer ""
set Artist_Name to text returned of result
tell application "iTunes"
try
set the_songs to the name of every track of playlist 1 whose name contains song_name and artist contains Artist_Name
set res1 to result
if res1 is not {} then exit repeat
end try
end tell
end repeat
set song_title to ¬
choose from list the_songs with prompt ¬
"Which Song Do You Want To Play?"
tell application "iTunes"
play (every track of playlist 1 whose name contains song_title and artist contains Artist_Name)
end tell
end repeat
 

Mekanik561

macrumors newbie
Feb 10, 2007
8
0
If you check the count of the_songs you don't need to make a choice when there is only one choice.



if (count of the_songs) > 1 then
set song_title to choose from list the_songs with prompt "Which Song Do You Want To Play?"
else
set song_title to item 1 of the_songs
end if
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.