Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Javascript - 800A0005 Error.

  • 08-04-2010 03:21PM
    #1
    Registered Users, Registered Users 2 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