Playlist-script: Alias doesn't work

With help from Kundal in German forum I have following jsscript, which creates a playlist and add it to a player.

var cmd = DOpus.Create.Command var jsFilter = ""+ "if (item.metadata == 'audio'){ "+ "var genre = new String(item.metadata.audio['mp3year']);"+ "if (genre.indexOf('198')!=-1) return false; /*do not filter*/"+ "}"; cmd.RunCommand('Delete "coll://Musik Playlist" REMOVECOLLECTION=auto QUIET') cmd.RunCommand('SelectEx LINEAR '+ 'PATH="/Media\\Musik\\Singles" RECURSE JSFILTER="'+jsFilter+'" '+ 'ITEMCOUNTPERC=100 '+ 'COPYTOCOLL="Musik Playlist" '+ 'TOFILE="E:\\Media\\Musik\\Playlisten\\Musik 1980s.m3u" '+ 'COMMANDS=Go "coll://Musik Playlist"') cmd.RunCommand('/Programme\\AIMP\\AIMP.exe "/Media\\Musik\\Playlisten\\Musik 1980s.m3u"')

It's working fine, except that following line will only work when using full path or Windows-paths (e.g. %temp%), but not when using the DO-alias (which is working in all other cases):

'TOFILE="/Media\\Musik\\Playlisten\\Musik 1980s.m3u" '+

Try changing it to:

'TOFILE="'+DOpus.FSUtil.Resolve('/Media\\Musik\\Playlisten\\Musik 1980s.m3u')+'" '+

The "issue" here is that SelectEx does not resolve what's given for the TOFILE parameter.
Which is something probably worth doing by default. o)

Ah, that did it... my skills are sooo bad.

Thanks.

@tbone: Could you please help me changing above code not to search for all songs from the 80's, but all songs which are older than 1980? Thanks.

Try this:var cmd = DOpus.Create.Command var jsFilter = ""+ "if (item.metadata == 'audio'){ "+ "var year = new String(item.metadata.audio['mp3year']);"+ "var int = parseInt(year);"+ "if (int < 1980) return false;"+ "}"; cmd.RunCommand('Delete coll://Oldies REMOVECOLLECTION=auto QUIET') cmd.RunCommand('SelectEx LINEAR '+ 'PATH="'+DOpus.FSUtil.Resolve('/mymusic')+'" RECURSE JSFILTER="'+jsFilter+'" '+ 'ITEMCOUNTPERC=100 '+ 'COPYTOCOLL=Oldies '+ 'TOFILE="'+DOpus.FSUtil.Resolve('/temp\\Oldies.m3u')+'" '+ 'COMMANDS=Go coll://Oldies') cmd.RunCommand('Set SORTBY=+mp3year(0)') cmd.RunCommand('"/programfilesx86\\AIMP\\AIMP.exe" /ADD_PLAY "/temp\\Oldies.m3u"')

Works perfect, thanks!