Switch playlist of itunes dj automatically after certain time

hello,
i have 2 playlists in itunes.  i would like to do the following:
1) itunes plays the first playlist by playing the songs in a random order and continues to do this, until
2) after a certain time (say 30 minutes), itunes switches to the second playlist and plays these songs in a random order and continues to do this for another 30 minutes. 
now, for the randomization, i could use shuffle with repeat, but the problem with that is that after all songs are played in the playlist, the exact order repeats again.  i don't want this.  i want itunes to choose a random song from the playlist each time, even if it is the same one twice in a row.  as i understand it, the itunes dj allows this possibility.
for the automatic switching, i read that i can use apple's automator to accomplish this.  however, this is my first time using it.  i chose workflow, and then music under 'actions'.  i see a bunch of stuff for itunes but there is no itunes dj. 
i don't know where to go from here or if there is an easier way to do this.  does anyone have any ideas?
thank you.

In my first script : if the user press the "Camcel" button in the dialogue, the script will give an error.
Here is the corrected script.
global tPlaylists, DJ_Playlist, tIndex, firstTime
property durationTime : 1800 --seconds, equal 30 minutes
on run
    set tPlaylists to {}
    set tIndex to 1
    set firstTime to true
    tell application "iTunes" to set {tnames, uPlaylists} to {name, it} of (user playlists whose its special kind is none)
    set j to (count tnames)
    repeat with i from 1 to j
        set item i of tnames to "" & i & " -  " & item i of tnames
    end repeat
    set n to my choosePlaylist(tnames, "first")
    if n is not "" then
        set end of tPlaylists to item n of uPlaylists
        set item n of tnames to missing value
        set tnames to text of tnames -- remove name of first selected playlist from tnames
        set n to my choosePlaylist(tnames, "second")
        if n is not "" then
            set end of tPlaylists to item n of uPlaylists
            tell application "iTunes"
                set DJ_Playlist to (first playlist whose special kind = Party Shuffle) -- iTunes DJ playlist
                tell front browser window to if exists then set view to DJ_Playlist
                activate
            end tell
            my mixTracks() -- add random tracks in the iTunes DJ playlist
        end if
    end if
    if n is "" then quit -- the user pressed the Cancel button
end run
on idle
    -- set the next index
    if tIndex = 1 then
        set tIndex to 2 -- the second playlist selected by the user
    else
        set tIndex to 1 -- the first playlist selected by the user
    end if
    my mixTracks() -- add 30+ minutes of random tracks from the next playlist
    return durationTime
end idle
on mixTracks()
    set selPlaylist to (item tIndex of tPlaylists)
    tell application "iTunes"
        set b to running
        if b then
            set tTime to durationTime + (duration of DJ_Playlist)
            set trackIndex to (count tracks of DJ_Playlist)
            -- add tracks to iTunes DJ playlist until its duration > (aproximately 30+ minutes of added tracks)
            repeat until duration of DJ_Playlist > tTime
                duplicate (some track of selPlaylist) to DJ_Playlist
            end repeat
            if firstTime then -- play immediately the first added track in the iTunes DJ playlist
                set firstTime to false
                play track (trackIndex + 1) of DJ_Playlist
            end if -- else continues to play tracks normally.
        end if
    end tell
    if not b then quit -- iTunes is closed by the user, quit this script
end mixTracks
on quit
    continue quit -- quit this application
end quit
on choosePlaylist(l, t)
    activate
    set x to (choose from list l with prompt "Select your " & t & " playlist") as string
    if x is not "false" then return (word 1 of x) as integer
    return ""
end choosePlaylist
Also, I added a condition to exit the script if the user quit iTunes, but the script only works once every thirty minutes.

Similar Messages

  • My video playlists from iTunes stop playing after about 3 episodes on Apple TV 2. Is there any fix for this?

    My video playlists from iTunes stop playing after about 3 episodes. It just appears to buffer for no reason. I have checked to make sure that the hard drive that these movies are on does not go to sleep. Any ideas?

    Hi,
    The "Tools" are in the old drop down menu, which are not shown by default in the new Firefox Design. To show this menu:
    Firefox Menu > Customize
    On the bottom left there will be Show/Hide Toolbars. The Menu will be listed here.

  • How to stop a while loop after certain time using Elapsed time vi

    how to stop a while loop after certain time using Elapsed time vi.

    Hi Frankie,
    Just place the Elapsed Time VI inside the WHILE loop, and wire the 'Time Has Elapsed' output to the conditional terminal in the lower right corner (which should be set to 'stop if true' by default).
    In the future, please post your LabVIEW questions to the LabVIEW Forum.  You have a much better chance of getting your questions answered sooner, and those answers can then help others who are searching the LabVIEW forums.  Thanks!
    Justin M
    National Instruments

  • Memory requirement is continiously increased when i am running my application program in an infinite loop,after certain time it shows an error called low virtual memory

    memory requirement is continiously increased when i am running my application program in an infinite loop,after certain time it shows an error called low virtual memory

    What are you doing with your program. Lots of improper programming techniques can cause this - building arrays, concantanating strings, opening but not closing refrences, etc. Need more details or post your VI. Also, have you looked at "LabVIEW Performance and Memory Management"? It's part of the shipping documentation and available from Help>Search the LabVIEW Bookshelf.

  • Why Does iTunes Launch Automatically After A MP3 Download?

    I recently updated to Leopard and I've discovered that iTunes will launch automatically after I download an MP3. This is annoying since I keep my MP3's on an external HD separate from my Download folder. You shouldn't have to keep iTunes open just because you've downloaded an MP3. If I download a PDF to my Download folder, Acrobat doesn't launch automatically. That's the kind of OS behavior I expect from Windows. How do I stop iTunes from behaving in this manner or is this another "genius" feature I'll have to put up with?

    Update:
    If you're sure it's not your browsers, then most likely you have accessed iTunes' preferences and clicked the Set button for "Use iTunes for Internet music playback" (iTunes > Preferences > Advanced) at some point.
    As you can see, there is not an option to undo this change. So, you will either need to use Property List Editor (if you have installed the Developer Tools with OS X), or a 3rd-party property list editor to undo the setting. Short of that, you would have to simply quit iTunes and move the file com.apple.iTunes.plist (/~username/Library/Preferences/) to the Desktop to back it up, or to the Trash--but don't empty it yet in case you want to restore it. Then, launch iTunes and go through the process of setting up the application's preferences again, but don't set the preference to use iTunes for Internet music playback this time.

  • Safari quits automatically after certain amount of idle time.

    I am having a problem with my Safari quiting after a certain amount of system idle time. It could be as little as 5 minutes. I honestly don't know as I really haven't tried to figure out the exact time. Though I've been away as little as 15 minutes to come back and find that Safari as quit.
    I do close the last window of Safari, but I've been doing that for years. I've only noticed that it's quitting by the fact that the little "light" at the bottom of the icon is missing. And that it bounces 1 or 2 times when I click on it. As well as the fact that I am not getting notifications, like eBay.
    I have to admit that I was playing around with an Apple Script to have it quit Safari automatically after some system idle time. However, I can no longer find that Apple Script or the app. Heck, I can't even remember the name. However, I couldn't get the script correct as it never worked. I was doing this because my mother would leave a lot of windows/tabs open on her Mac and would use 50% plus of the CPU at times, even at "idle". I was doing this in Mt Lion, but once Mavericks came out. Her CPU usage has dropped down to less than 5%
    So my questions are... How can I find this Apple Script that I created nearly a year ago? Why all of sudden does it start to work, which is with in the last several days to a week? Could it be something else that's making it quit?
    The only thing that was a "huge" change was the addition of Garmin Express app to update my mother's GPS. (Wish that I did it on her Mac) However, this was installed last night.
    Oh, there was another thing. I've tried to use this Mac as a target boot disc to a pre-2008 MBP 17', non-unibody. And I also tried to use that same MBP as a target disc on this Mac. Used a firewire 800. This was done about a week ago.
    Thank you,
    KOT

    More important information: This only happens under an account that has the Parental Controls enabled. The main Admin account does not have this problem of Safari quitting out.

  • ITunes reopens automatically after quiting

    This problem has been happening through the last few updates. I quit (or even force quit) iTunes, and it reopens automatically. It's a real problem now because it's actually preventing me from shutting down my Mac. I have no programs running with it except for TuneUp, but iTunes will automatically restart even with TuneUp disabled. Please help me.

    I have the same problem over here, it is really annoying because i cant even shut down my mac,
    i had to force shutdown on the button twice, because of this problem.
    Does anyone else has this problem ?

  • Script or anything that will auto quit app after certain time of inactivity?

    I am searching for a way to make apps auto quit after a certain time of inactivity.
    For exmaple, if i open the app store, i would like it to close automatically after a certain amount of time, with the possibility of adding exceptions to the list.
    Is this in any way possible?
    Thanks/.

    The above checks lsof every 30 seconds;
    -) if it's been only inactive for half a second at exactly that point, it'll close it.
    -) You can `while sleep 30;`
    Systemd doesn't seem to have this exact behavior. Autofs does though, it has a timeout option. (Systemd's StopWhenUnneeded is for when services don't need it, and its timeout option is for how long to wait before giving up trying to mount it.)
    Now I wonder if autofs can also trigger a command after unmounting...
    Edit:
    You can use the intofiy-tool's package's inotifywait to wait for an unmount event.
    Last edited by Blµb (2014-03-14 09:52:59)

  • Web Service in JDK 6 - client resends request after certain time ?

    Hi,
    I am using the JAX-WS in JDK 6 to build a web service.
    The client sends a request to the server and server starts processing the request. The Server side processing is time consuming.
    I am not sure what exactly happens, but after a certain time, a new thread gets started for server-side processing. I have not used any multi-threading in my coding .
    Does JDK WS include a built-in timeout after which the client automatically resends the request to the server ?
    Thank you.

    Hi Andy,
    I found a workaround: I added some additional resources using a link "http://localhost:8079/"NAME"/:x/:x/:x/:x/:x/:x/:x​/:x/:x/:x/:x/:x/:x/:x/:x/:x" for each type (PUT, GET, POST, DELETE) where I handle the error message with the "Set HTTP Response Code VI"
    Attachments:
    ws_error.PNG ‏9 KB

  • Logoff scrip doesnt work ..after certain time threshold.

    Hi im setting up PCs for general use in computer lab, with internet cafe like structure where one main computer will control every activity of the rest.
    One of thing i made is setting up the script to force windows to shut down if user log off the windows;(so the computer would not stuck in remote-admin-unreachable limbo; where the control client isn't running and the PC isn't off either to receive WOL command
    to restart and regain control.)
    I noticed that the script will run if the windows being logged off shortly after login. when user clicked the log off button briefly after being logged in, it will actually shut down the PC.
    but if it being used for some time or simply left idle until certain time (still unclear) threshold, the script will not run.
    When the user clicked the log off button, it just log off as usual and returns to user selection screen; instead of initiating shutdown script. (and I have to manually login back or restart to regain control). 
    what causes this script 'timeout'?

    Hi Razi,
    I have deployed a simple script for all users to implement what you mentioned without no issue:
    Please clarify the settings are configured to all users on your GPO server or the local computer policy.
    configure GP for user groups by referring following link:
    Edit Multiple Local Group Policy
    http://technet.microsoft.com/en-us/library/cc731758.aspx
    Kate Li
    TechNet Community Support

  • Unlock user automatically after given time

    Hi,
    I have a requirement where I need to unlock the user automatically after 2 hours once his account gets locked(after 3 unsuccessfull attempts).Do we have this feature Out of the box or we need to write a scheduler for this.
    Regards,
    Edited by: 851992 on Apr 13, 2011 4:54 AM

    Hello,
    If you are using Oracle Access Manager in the setup, then this is feature available out of the box.
    -Mahendra.

  • N73 got shuts down automatically after some time

    hi,
    my n73 music edition gets shut down after some time autmatically please can anybody tell me the reason.

    The reason is that nokia phones have many bugs and problems.
    A common cause of this problem is 3G. If the phone is in a weak 3G area the loss of 3G signal can cause the phone to reboot. It's an old problem thats been affecting nokia's for years. Disabling 3G can stop the random shutdowns.
    It may also be worth updating the phones firmware but this is a fairly risky procedure that can cause more problems than it solves.

  • Re-trigger failed proxy message after certain time automatically in CRM

    Hi experts,
    Can anyone tell me if we can automate the process of re-triggering failed proxy messages in SAP CRM sxmb_moni, say after a certain period of time.
    Thanks
    Swapna .

    Hi Gigi,
    As stated in one of the blog (/people/sap.user72/blog/2005/11/29/xi-how-to-re-process-failed-xi-messages-automatically):
    For automatic qRfc failure recovery, Schedule the report RSQIWKEX to run periodically. This report enables automatically resets the queues.
    Also, refer the following threads for more information on this topic:
    Re-Process failed XI Messages Automatically
    /people/krishna.moorthyp/blog/2006/04/08/reconciliation-of-messages-in-bpm

  • ITunes opens automatically after file downloads - HOW TO FIX?

    Hi all,
    don't no wether it's my new MacBook or iTunes 10, but every time I download a music file from the internet it automatically opens, and starts playing, in iTunes.
    Even if iTunes is closed it opens it up and starts playing..
    I really want this to stop and just manually add the songs to iTunes.
    Is there a way to fix this?
    Thanks in advance.

    Its not Itunes, its Safari. It has a setting for "automatically open safe files" after download. So it opens them in itunes. If you disable that setting, you should be fine.

  • Itunes wont open after certain point

    okay so i upgraded my itunes and every single time i try to open it, this screen comes up that says itunes setup assistant at the top, and it starts to tell me about how i can download album artwork from the internet and all this, so when i go to click on either ok or cancel, the window freezes there thus resulting in me getting extremely frustrated..PLEASE HELP ME OR TELL ME WHAT TO DO!!!THANKS

    Do you know if you're running the latest iTunes (7.5)?
    These may also help:
    Using MSCONFIG to troubleshoot conflicts in Windows XP
    http://docs.info.apple.com/article.html?artnum=302538
    iTunes for Windows XP: Troubleshooting unexpected quits, freezes, or launch issues
    http://docs.info.apple.com/article.html?artnum=302856
    iTunes for Windows in Windows XP or Windows 2000 doesn't open after upgrading
    http://docs.info.apple.com/article.html?artnum=302386

Maybe you are looking for

  • Oracle8 Enterprise Edition for Windows 8.0.6 - Info reqd.  Pls help !

    I'm a naïve user in Oracle and would like to know the following details from the Gurus. Any information in this regard will be highly appreciated ! We are trying to use Oracle8 Enterprise Edition for Windows 8.0.6 for some specific reason. Some gener

  • JTextPane and HTML rendering

    HAi I have a web page with JApplet in it. I need to get a HTML page from server and display it. I wish to use either JEditorPane or JTextPane. The applet gets the file line by line from the server. I need to append the line by line to the component.

  • Upload internal table data to Application server in Excel Sheet

    Hi All, I have all my data in an internal table.I want to Upload this data to the Application server in the EXCEL sheet with the Column Header. How can i do this.Is there any standarad function module or class to to write in xls format. Can anybody h

  • Sharpening upon jpeg export

    I'm surprised that Aperture does not allow sharpening of jpeg output. Sharpening the master before reduction is not the same. All experienced image makers know that sharpening needs to be applied after resizing. I don't want to sharpen my master. I a

  • Scratch Disk, Media Drive, etc Question.

    I just got a new Seagate 7200.11, 32 mb cache, etc hd for xmas. I have the stock 7200.10 in bay 1. From the readings, I've concluded that the 7200.11 is faster. Should I use the faster HD as my startup disk and run programs; or should I use it as my