Itunes Play Selected Track

Ok so I'm a beginner at this but dougs apple script to play the selected song next doesn't work on my mac anyway so i started playing about writing my own, I'm not quite sure what I'm doing wrong for it not the play the song. Any help would be great? Heres what I have cheers :-
on run
tell application "iTunes"
activate
if player state is playing and selection of front window is not {} and (count items of selection of front window) is 1 then
set seltrack to selection of front window
else
--exit
end if
set founded to false
repeat while founded is false
set finished to (finish of current track)
set curent to player position
if (round curent) is equal to (round finished rounding down) then
play seltrack
set founded to true
end if
end repeat
end tell
end run

Hi,
Thank you for the advice so far, like i said I'm totally new to this so it is really helpful. I am trying to get Itunes to play the song which is selected at the point of opening the applescript one the song currently playing finishes. Here a code I have altered after Camelot's reply.
on run
tell application "iTunes"
activate
if player state is playing and selection of front window is not {} and (count items of selection of front window) is 1 then
set seltrack to selection of front window
set finished to (finish of current track)
else
tell me to quit
end if
set founded to false
repeat while founded is false
set curent to player position
if (round curent) is equal to (round finished rounding down) then
play seltrack
set founded to true
end if
end repeat
end tell
end run
When running in the applescript editor it seems to get the end time for the track and keep refreshing the player position but when the two are equal and the song should play this error appears
"Itunes got an error: Can't make some data into expected type." While this message is displayed it hi lights the line. In the replies section it sates the error also with "number -1700 to item" on the end.
play seltrack
I have also tried pasting all the statements into the initial if statement like this
on run
tell application "iTunes"
activate
if player state is playing and selection of front window is not {} and (count items of selection of front window) is 1 then
set seltrack to selection of front window
set finished to (finish of current track)
set founded to false
repeat while founded is false
set curent to player position
if (round curent) is equal to (round finished rounding down) then
play seltrack
set founded to true
end if
end repeat
else
tell me to quit
end if
end tell
end run
But i still get the same error. Would it be something to do with the way the script imports the selection details and itunes not recognising it maybe?
Message was edited by: JDeere

Similar Messages

  • ITunes plays purchased tracks - iPOD NANO skips them?

      Windows XP  
    I have a works PC and a Home PC - I have Authorized both PC's to play tracks thru itunes - they do play....however when i copy tracks to my NANO from my home PC the tracks show on the NANO but skip through - this has happened on different purchased music?? help

    Welcome to Apple Discussions!
    Check out this Apple Support article, and see if the directions in it works:
    iPod doesn't play purchased music from iTunes Music Store
    I hope this helps!
    ~~Kylene

  • Itunes 12 won't play any tracks. Selection appears in box at top of screen, but won't play and time doesn't count down. Controls have no effect.

    Itunes 12 won't play any tracks

    Hi there Wellington451,
    Welcome to Apple Support Communities.
    It sounds like there is an issue playing audio tracks in iTunes on your PC. Take a look at the article linked below, it provides a lot of great troubleshooting tips that’ll resolve most issues like this one.
    iTunes and QuickTime for Windows: Audio does not play or plays incorrectly - Apple Support
    Cheers,
    -Jason

  • How can I get 2 different track from iTunes playing on 2 different stereos?

    We are remodeling a part of our home and decided that this would be the time to install a whole house audio system. We would like to use our iTunes library as a source and be able to play different tracks in different parts of the house (also called zones)
    To put it in a slightly different fashion. I could have a dedicated Mac Mini with my iTunes library and it would feed tracks with meta data to 3 stereos in various parts of the house. Each stereo independently select tracks or playlists.
    iTunes purchased tracks need to work as well.
    Thank you all....

    What you need is to use one Mac (or PC) as a server (and storing all the music) and then one of the following in each room connected to that rooms HiFi system.
    Sonos ZonePlayer see http://www.sonos.com this is the most expensive option but is regarded as the premier multi-room solution.
    Roku SoundBridge see http://www.rokulabs.com (I have three M2000 SoundBridges myself)
    Slim Devices Squeezebox see http://www.slimdevices.com
    Apple TV see http://www.apple.com/appletv (unlike all the above this will require the use of a TV)
    With these, different rooms can play different tracks at the same time with them all stored on the single computer.

  • How can i stop itunes changing manually typed in genres when playing a track?

    hi,
    for a long time, itunes has been changing genre information that i typed in manually when playing a track, example giving "soundtrack" to "Filmmusik" or "rock" to "Rock" (i prefer lower case letters). until upgrading to itunes 11, it was able to edit the localizable.strings file and set the predefined genres to lowercase and "Filmmusik" to "soundtrack" and so on. now i had to install itunes 11 to run my new ipod, and the localizable.strings file looks quite different. it doesn't seem to be the file now where the necessary updates have to be done.
    therefore, first question is if anyone can tell me where i can find the predefined genres and update them? then i will have a workaround at least.
    actually, i would prefer to stop itunes changing track information in any case. i've spend more than a year to import all my cd's and used lots of time to have reliable track informations. i don't want the software to change my data without me committing any change. also, even worse, itunes updates the aac-file itself as well. i used to use the last updated information as a criteria in intelligent playlists, but itunes makes it impossible to get the expected result with its unwanted updates.
    so, any help will be aprreciated. in case it should matter, i have an imac with os x 10.6.8. the problem seems to occur only in itunes, when i play the tracks on my ipod, the information remains unchanged. and since i read about similar problems with songs from the itunes store - all my tracks are imported from cd manually.
    regards,
    andi

    Dependent upon which view you are using to look at the album, they will be playing in the "view" order. For example, in the screenshot below, in the Songs view, I have a view of an album like this, while the song "Follow Me" is playing:
    Look carefully at the picture and you will notice that the sort order for this view is in "reverse Last Played order", and if you now look at the Track No. column, you will notice that "Follow Me" is track 12, the last one on the album. If you also look at the Up Next list, you can see every track from the album, in the same order as they appear in the main window, so it will play in reverse order.
    To play this album in the correct track order, I simply click on the Track No. column header (so that the arrow is pointing up) and then select the track at the top of the list, track 1, "Sunset Song". Look at this screenshot:
    Notice that now, the tracks in the Up Next list are in track order and the album will play in the correct order.

  • My music is stored on iCloud and when I'm playing a playlist, it'll only play the track I choose and won't go on to the next one, it just repeats the one I selected. Any ideas please?

    Hi
    All my music is stored on iCloud but when I try and play music from a playlist, the iPhone 4 will only play the track I select and won't progress on to the next one. It just keeps repeating the one I selected. Does anyone else have this problem? Many thanks.

    If you live in a Region that allows re-downloading Music...
    Delete the Song(s) and re-download...
    See Here  >  Download Past Purchases  >  http://support.apple.com/kb/HT2519
    If not... Contact iTunes Customer Service  >  Apple  Support  iTunes Store  Contact Us

  • ITunes playing tracks out of order

    Ever since upgrading to iTunes 11 I've had a problem with some albums playing tracks out of order.
    I put the track number in the file names and track titles, so sometimes I leave the track number field blank. Not a problem, because iTunes sorts the tracks alphabetically so it lists them in the right order.
    In album view, if I select the first track, it plays all the tracks in the right order. But if I select the album, either by double-clicking the album cover or by searching for it from the mini player, it plays them in a random order.
    This makes no sense. What's going on here?   

    So that's an obvious solution (and what I just did in this particular case). But it's an annoying bit of extra work and, more importantly, since it was never necessary before, I have a lot of albums which don't have track numbers. Because, as I said, they always displayed and played in the correct order regardless. So the track number tag was extraneous.
    What I'm wondering is whether there's a fix for this behavior.
    And also whether it's possible to implore the iTunes development team to fix this! If the tracks are listed in a certain order, they should always play in that order.

  • How to view ALL selected tracks in iTunes

    Simple question, I hope, but I've got more tracks on my iTunes than I can fit into my iPhone and I would like to be able to see how much memory my selected tracks take up, in total, not just by artist, before I try to sync.
    Is there anyway of viewing all selected tracks in iTunes?

    Create a new playlist using the command File > New Playlist. Drag the selected tracks into it. Open the playlist and look at the bottom to see the number of tracks, total size, and playing time.

  • ITunes 8 only playing 1 track?

    I have just upgraded to iTunes 8 and I can't seem to get iTunes to play more than 1 track at a time. If I go to a playlist (or just 'Music'), and double-click a song, it plays.
    I have the 'Shuffle' and 'repeat playlist' selected in the bottom left hand corner, but it just stops playing at the end of the current track.
    AmI missing something obvious?

    All the songs in the playlist are checked - but still only plays one track. Only stated with the install of iTunes 8. Also in the menu, I have selected under shuffle - all group
    Any thoughts?

  • "Delete Selected Track Files" Applescript script fails for iTunes 7

    The Delete Selected Track Files script, which is found on the Apple site http://www.apple.com/applescript/itunes/, fails with a error message of "iTunes got an error: file track id 42130 of user playlist id 30791 of source id 40 doesn't understand the delete message." The message is the same regardless of which song(s) I try to delete. Does anyone know how to update the script or know of a workaround?

    Found my mistake. I was testing the script by playing a track from a shared iTunes library across my local net. As soon as I played a track residing on the local machine itself the script worked in iTunes 8.0 as it worked before on iTunes 7.x
    Apparently I'll need to code for the case of a shared track in order to correctly resolve the alias to the file track on the remote machine.
    Thanks Niel!

  • HT5731 I bought a full season of a TV show. I downloaded all episodes. When I go into my iTunes library, select the episodes I get a message of: This computer is already associated with an Apple ID. I can't for the life of me get the TV show to play.

    I bought a full season of a TV show. I downloaded all episodes, I went to my  iTunes library, selected the episode I wanted to watch. I got this message: This computer is already associated with an Apple ID. I can't for the life of me get the TV shows to play. I went on iTunes and when to my purchases. Clicked on the episodes and the same message popped up. How do I get these to play? I also see my download box with an error message saying it has paused the download. I click unpause and it just pauses again. I have been able to get one of the episodes to play once through, but now it gives me the same message.

    It's been months, so you may not care anymore, but you can't download songs from multiple Apple IDs over a 90 days period.  Sorry, it's not allowed for legal reasons.

  • On itunes everytime I try and play a track the warning 'the song could not be played because the original files could not be found' please can anyone help me? Thanks

    Hi. I have been having problems with my PC and recently removed a lot of rubbish to clear it somewhat. I dont know if that is relavant however on top of that I have just received my replacement iPad2 which i had a proble with and  thought I would just tidy up my tunes before  sycing.  The problem is that everytime I click to play a track in iTunes on my PC, whilst the track is showing on my itunes, it comes up with a warning 'the song cannot be used because the original file could not be found. Would you like to find it'. I have tried clicking 'locate', but all that appears is 'music Library' 4 different dates. Help i am very confused, can any shed any light on this
    Thank you

    Sounds like you have somehow moved your itunes music library to a different location to where iTunes thinks they should be. Your music should be in a folder called "iTunes Media>Music". If they are located there, try going into iTunes, right clicking on one of the songs and then "get info". When the box pops up, on the first screen it should give a location line where it thinks the music is located. If it is differen't to where you music is stored, try and match it up to the location line that was in the "get info" box.

  • How can I select tracks to play from my downloaded music as a casual playlist at the time?

    I have downloaded all my music onto my Ipad and have a list of songs. I have created playlists for various occasions but I want to be able to select and play random tracks as a one off playlist at the time. I cannot see anyway I can "tick" tracks to play, then hit play. Can anyone help or is this facility not possible. Thanks

    I have downloaded all my music onto my Ipad and have a list of songs. I have created playlists for various occasions but I want to be able to select and play random tracks as a one off playlist at the time. I cannot see anyway I can "tick" tracks to play, then hit play. Can anyone help or is this facility not possible. Thanks

  • Can no longer play individual tracks within a Podcast on iTunes 11

    I have a good amount of podcasts that I subscribe to where there are tracks within the podcast. On my iPhone I can skip from track to track, and before upgrading to iTunes 11, I could do it in iTunes as well - basically would click the album artwork, and I could select track numbers from a drop down list. That drop down list doesn't exist anymore, and all I can do is fast forward, rewind, or skip to the next podcast episode.
    Anyone have similar problems or a solution? Thanks in advance.

    anyone have any ideas?

  • ITunes can't play all tracks on a cd

    I have a brand new Dell XPS 730 gaming pc. Previously, I was running Vista 32 bit that it came with. The other day I reinstalled Vista 64 bit and installed itunes for 64 bit vista. When I put in either regular audio cds or burned cds, itunes will only recognize a few tracks and just skip the rest. When trying to import a track it skips over it takes about one second and it sees it as being like hundreds of hours long. I tried multiple cd's that work PERFECTLY FINE in a cd player on my boombox. I also then tried these in Windows Media Player 11 and the same exact issue occurred. WMP gave an error message saying there was something wrong with my drive. I have two DVD-RW drives. I tried this all on both drives and same issue happened. I find it hard to believe that in the span of a day both of my drives had something go wrong with them that they can't read discs properly, especially when I can play any DVD games fine and can burn discs using my Roxio burning program perfectly fine as well.
    I don't understand why the same problem would be happening in WMP if it was a problem with itunes. I'm guessing it could be an issue with Vista 64 bit not working properly with the DVD drives, i'm not too sure. I just find it odd that this problem would crop up when my pc was working fine in 32 bit with iTunes. Anyone else having this problem, and anyone actually found a solution to it yet?
    Below is the diagnostic I ran with a regular audio cd in each drive that work fine on my boombox cd player. It's definitely not recognizing them properly as you can see in the track times of like 20 hours plus when they're only 4 to 6 minutes long.
    Microsoft Windows Vista x64 x64 Home Premium Edition Service Pack 1 (Build 6001)
    Dell Inc. XPS 730
    iTunes 8.1.1.10
    QuickTime 7.6
    FairPlay 1.3.6
    iPod Updater Library 8.1d19
    CD Driver 2.1.0.1
    CD Driver DLL 2.1.1.1
    Apple Mobile Device 2.4.1.7
    Apple Mobile Device Driver not found.
    Bonjour 1.0.6.2 (118.5)
    iTunes Serial Number 567794B6885C5B66
    Current user is an administrator.
    The current local date and time is 2009-05-08 11:51:23.
    iTunes is not running in safe mode.
    Video Display Information
    NVIDIA, NVIDIA GeForce GTX 280
    ** External Plug-ins Information **
    No external plug-ins installed.
    ** Network Connectivity Tests **
    Network Adapter Information
    Adapter Name: {2F8AE457-F134-4CF6-9214-7B2B28B419A9}
    Description: NVIDIA nForce Networking Controller #2
    IP Address:
    Subnet Mask:
    Default Gateway:
    DHCP Enabled: Yes
    DHCP Server:
    Lease Obtained: Fri May 08 11:07:17 2009
    Lease Expires: Sat May 09 11:07:17 2009
    DNS Servers:
    Adapter Name: {1A2D65CC-E31A-4A2D-AB99-B76BECC38CCE}
    Description: NVIDIA nForce Networking Controller
    IP Address: 0.0.0.0
    Subnet Mask: 0.0.0.0
    Default Gateway: 0.0.0.0
    DHCP Enabled: Yes
    DHCP Server:
    Lease Obtained: Wed Dec 31 19:00:00 1969
    Lease Expires: Wed Dec 31 19:00:00 1969
    DNS Servers:
    Active Connection: LAN Connection
    Connected: Yes
    Online: Yes
    Using Modem: No
    Using LAN: Yes
    Using Proxy: No
    SSL 3.0 Support: Enabled
    TLS 1.0 Support: Enabled
    Firewall Information
    Windows Firewall is off.
    Connection attempt to Apple web site was successful.
    Connection attempt to iTunes Store was successful.
    Secure connection attempt to iTunes Store was successful.
    Secure connection attempt to iPhone activation server was successful.
    Last successful store access was 2009-05-07 21:00:02.
    ** CD/DVD Drive Tests **
    LowerFilters: PxHlpa64 (2.0.0.0),
    UpperFilters: GEARAspiWDM (2.1.0.1),
    E: HL-DT-ST DVD+-RW GH30N, Rev A102
    Drive is empty.
    E: HL-DT-ST DVD+-RW GH30N, Rev A102
    Audio CD in drive.
    Found 16 songs on CD, playing time 77:32 on Audio CD.
    Track 1, start time 00:02:00
    Track 2, start time 06:36:04
    Track 3, start time 10:12:05
    Track 4, start time 15:37:08
    Track 5, start time 20:08:64
    Track 6, start time 24:15:45
    Track 7, start time 29:45:00
    Track 8, start time 35:31:15
    Track 9, start time 40:38:02
    Track 10, start time 46:35:02
    Track 11, start time 50:42:16
    Track 12, start time 55:27:16
    Track 13, start time 59:14:50
    Track 14, start time 65:51:02
    Track 15, start time 69:34:16
    Track 16, start time 73:05:46
    Audio CD reading succeeded.
    Get drive speed succeeded.
    The drive CDR speeds are: 8 10 16 40 48.
    The drive CDRW speeds are: 8.
    The drive DVDR speeds are: 8.
    The drive DVDRW speeds are: 8.
    D: TSSTcorp DVD-ROM TS-H353B, Rev D500
    Audio CD in drive.
    Found 10 songs on CD, playing time 54:58 on Audio CD.
    Track 1, start time 00:02:00
    Track 2, start time 00:43:53
    Track 3, start time 06:38:73
    Track 4, start time 13:21:57
    Track 5, start time 18:41:21
    Track 6, start time 24:44:20
    Track 7, start time 29:32:61
    Track 8, start time 35:47:27
    Track 9, start time 40:35:71
    Track 10, start time 45:00:45
    Audio CD reading succeeded.
    Get drive speed succeeded.
    ** iPod/iPhone Connectivity Tests **
    iPodService 8.1.1.10 is currently running.
    iTunesHelper 8.1.1.10 is currently running.
    Apple Mobile Device service 2.12.36.0 is currently running.
    Universal Serial Bus Controllers:
    Standard OpenHCD USB Host Controller. Device is working properly.
    Standard Enhanced PCI to USB Host Controller. Device is working properly.
    FireWire (IEEE 1394) Host Controllers:
    Texas Instruments OHCI Compliant IEEE 1394 Host Controller. Device is working properly.
    ** iPhone/iPod Touch Sync Tests **
    No iPhone or iPod found.

    I have a similar issue, pleae let me know if you've figured this out.
    On mine, it will play approx 1 minute of an audio CD, then quit. Will not play subsequent tracks at all, and skips them as you describe when trying to import. Same result in iTunes and Windows Media player. But I was able to play a DVD movie and also to burn a copy of a CD. Very odd.

Maybe you are looking for

  • JSP Calendar Wizard/PopUp Window

    I am looking for a Calendar Wizard that I can include into my JSP, with the ability to scroll between months, and have the user select a specific date that can be returned to the calling JSP. I do not want to use an Applet, it must be pure JSP/Java c

  • Problem with Serial Number when I tried to do the UD

    Dear Colleagues, I need your help with the issue below: I have one material that Serial Number profile was not configured. The GR was done for 3 pcs, these material is to do the UD, but before to completed the process (UD) the material was changed an

  • Many times i see "too many cards" and there 3 or some times no cards

    there are times when i see that message and there are no cards present and it will last so i have to restart my phone alot. is there anyway that sprint can fix this problem because it is extremely annoying. does anybody else have this problem?? Post

  • This movie can be played only on displays that support HDCP?

    I recently purchased The Walking Dead on itunes and i cant watch it at all. "This movie can be played only on displays that support HDCP" warning pops up. Help!

  • Dataload error using MaxL on LINUX

    Hi All, I'm using Essbase 11.1.2.1 & working on ASO cube. I'm trying to load the data using Maxl on LINUX. This is the following error: essmsh error: End of File breaks the Statement. any ideas....... Thanks,