Results 1 to 2 of 2
  1. #1
    allawyg is offline Member
    Join Date
    Mar 2009
    Posts
    1
    Rep Power
    0

    Default Itunes playlist script

    I have this script that automatically creates playlists on itunes, you run the script, you select the folder that contains the mp3s and the M3u playlist file and will create the playlist on itunes according to the m3u file name.

    there is an issue with this script. It creates the playlist but adds the tunes twice (duplicates), so if there is a playlist with 10 tracks it will add the 10 tracks twice in the playlist.

    Could anyone suggest a fix for this please

    the code of the .js file is

    // Add a series of artis/album directories to iTunes as playlists


    var shell = WScript.CreateObject("Shell.Application");

    var folder = shell.BrowseForFolder(0, "Select the folder containing your album/artist directories:", 512);

    if(folder == null) WScript.Quit();

    var iTunes = WScript.CreateObject("iTunes.Application");

    var fso = WScript.CreateObject("Scripting.FileSystemObject") ;


    var artists = new Enumerator(fso.GetFolder(folder.Self.Path).SubFold ers);

    while(!artists.atEnd()) {

    var albums = new Enumerator(fso.GetFolder(folder.Self.Path+"\\"+fso .GetBaseName(artists.item())).SubFolders);

    while(!albums.atEnd()) {
    var listname = fso.GetBaseName(artists.item())+" - "+fso.GetBaseName(albums.item());
    iTunes.CreatePlaylist(listname).AddFile(albums.ite m());
    albums.moveNext();
    }

    artists.moveNext();
    }

    WScript.Echo("Finished.");

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    This unfortunately has nothing to do with Java. Your best bet is to find a Javascript forum and ask this question there. Best of luck.

Similar Threads

  1. Need Java Script Installed
    By billaaa777 in forum Jobs Offered
    Replies: 0
    Last Post: 09-04-2008, 05:37 PM
  2. Running a script within IE
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-25-2008, 03:33 PM
  3. Sample ANT Script
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-24-2008, 04:22 PM
  4. JSP redirection script
    By ravian in forum New To Java
    Replies: 1
    Last Post: 01-07-2008, 11:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •