Tagged everything but does not reflect in ITunes / else

No, a DOS command shell does not do a lot with dragging and dropping and other fancy mouse stuff. You have to type it in.

So please look for the drvie and path (e.g. in explorer)
Then open the command shell.
To switch to the correct drive type in the drive letter plus the colon, e.g.
D:
for drive d:
then press enter
The command prompt should now show the drive letter.
now have a look at the path. You may copy this part from the address bar in explorer - but only the part after the colon to the end.
Now type in at the command prompt:
cd
leave a blank behind cd, do not press enter.
Open the System menu of the command shell window and select Edit>insert
The path from the clipboard should be pasted.
Now press enter.
You should no see in the command prompt that you have reached the correct path.
Now type in the name of the .js files including .js.
That should do it.
If still Dreamweaver opens then check your Windows installation or refer to a Microsoft page
http://msdn.microsoft.com/de-de/library/ms950396.aspx
to get the scripting host.
As you requested I included my file with all its garbled messages - please replace the txt-extension with js.

Orphan_Killer_and_Updater.txt (940 Bytes)

Thanks. I've got it to work but it's driving me potty trying to get it working like you say.

It was a simple matter of changing the default app to WScript (which I had all along) by right clicking on the file and changing its properties.

Opened the command Prompt and done everything you said.

Press return and a confirmation dialog box comes up like to said only if I double click it which I didn't.

I have no right click context menu for open in command prompt now either after I changed the default application for .js files! Beginning to think this script is cursed.


I've noticed these lines of code in the script:

var currTrack = tracks.Item(numTracks);

WScript.Echo(numTracks + " of " + alltracks);
// is this a file track?
if (currTrack.Kind == ITTrackKindFile)
{

Is it possible to delete the echo lines so that I don't get a pop up on screen but yet do the work? Read somewhere about that echo thing in my search to fix this

EDIT: hallelujah (deleted these lines and no annoying pop ups now)

It took approx 10mins for 10K tracks with no deadtracks found.

var ITTrackKindFile = 1;

var iTunesApp = WScript.CreateObject("iTunes.Application");
var deletedTracks = 0;
var mainLibrary = iTunesApp.LibraryPlaylist;
var tracks = mainLibrary.Tracks;
var alltracks = tracks.Count;
var numTracks = alltracks;
var i;

while (numTracks != 1)
{
var currTrack = tracks.Item(numTracks);
WScript.Echo(numTracks + " of " + alltracks);
// is this a file track?
if (currTrack.Kind == ITTrackKindFile)
{
// yes, does it have an empty location?
if (currTrack.Location == "")
{
// yes, delete it
currTrack.Delete();
deletedTracks++;
WScript.Echo("Geloescht " + deletedTracks);
}
else
{
currTrack.UpdateInfoFromFile();
WScript.Echo("Updated " + numTracks);
}
}

numTracks--;<!--sizec--></span><!--/sizec-->	<!--sizeo:1--><span style="font-size:8pt;line-height:100%"><!--/sizeo-->

}

if (deletedTracks > 0)
{
if (deletedTracks == 1)
{
WScript.Echo("Removed 1 dead track.");
}
else
{
WScript.Echo("Removed " + deletedTracks + " dead tracks.");
}
}
else
{
WScript.Echo("No dead tracks were found.");
}




I can only repeat:
you do not simply "Open" the file (by double-click or by context menu "opne" but you have to open it with the command shell (which is an extra item in the explorer context menu).
I described this in post #17 ...

Anyway, if you are satisfied now.
I added the lines with the ouput as you sometimes do not really know how long it may take, so that some progress indicator could be helpful. If you feel in need to add these lines as your library grows, you know where to do it.
iTunes slows down to almost unusability if the library exceeds some 70000 entries. It then takes almost 15 seconds to delete a single track. It is then quite helpful to see that the script is still alive.

I fully understood that. See the pic I posted above, I don't have that option unfortunately.

Thanks for this script ohrenkino! I encountered this issue after spending hours cleaning up my wifes iTunes library after the update to v11.0 hosed the album art. Your script saved the day! Oh, it also increased the WAF around here...

I registered just to say thanks!