Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Javascript - 800A0005 Error.

Options
  • 08-04-2010 3:21pm
    #1
    Registered Users Posts: 3,992 ✭✭✭


    Im working on a bit of Javascript that will create a csv file out of an itunes database.

    I had it running perfectly and it creates the csv file no problem.

    Originally the randsig() method created a random string of 0s and 1s, thet was 20 in length.

    This ran perfectly, now after i extended it to include 2s in the string also, i keep getting the following error. :

    Invalid procedure call or argument
    Code: 800A0005
    Source: MS JScript runtime error.
    var	iTunesApp = WScript.CreateObject('iTunes.Application');
    var	mainLibrary = iTunesApp.LibraryPlaylist;
    var	tracks = mainLibrary.Tracks;
    var	numTracks = tracks.Count;
    WriteFile();
    function WriteFile()
    {
    	var fso  = new ActiveXObject('Scripting.FileSystemObject'); 
    	var fh = fso.CreateTextFile('C:\\\\Users\\\\Derek\\\\College\\\\4th Year\\\\Project\\\\Workspace\\\\Tap Interface 2\\synchiTunesLibrary.csv', true); 
    	fh.WriteLine('SONGNUM,BPM,LOUD,SIG,PLAYCOUNT,GENRE,TITLE,ARTIST,PATH');
    	for(var num = 1; num <= numTracks; num++)
    	{
    		var tr = tracks.Item(num);
    		//BPM,Loudness,Signature,SongName,Artist,Path
    		[B]var str = num + ','+ tr.BPM + ',' + 'L' + ',' + randSig() + ',' + tr.PlayedCount + ',' + tr.genre+ ',' + tr.name + ',' + tr.artist + ',' + tr.location;[/B]
    		fh.WriteLine(str); 
    	}
    	fh.Close();
    }
    function randSig()
    {
    	var rs = '';
    	for(var i = 0; i < 20; i++)
    	{
    		var rNum = Math.floor(Math.random()*999999999); 
    		if((rNum % 3) == 0)
    		{
    			rs = rs + '0';
    		}
    		else if((rNum % 3) == 1)
    		{
    			rs = rs + '1';
    		}
    		else if((rNum % 3) == 2)
    		{
    			rs = rs + '2'; 
    		}
    	}		
    	return rs;
    }
    

    I changed it back to what it was and tried again but still got the same error..

    any ideas???

    EDIT: forgot to mention, its happening on "Line 16, Char 3".

    I also just removed the randSig() function and its not that thats the problem...

    EDIT: It still completes its task perfectly. So why the error?


Advertisement