Create Original Date

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

kiwichick
Posts: 331
Joined: Tue Jul 21, 2009 6:35 am

Create Original Date

Post by kiwichick »

Hi there, I know next to nothing about script writing but I recently managed to alter the SwapArtistTitle script so that I could copy Artist name to AlbumArtist name. I created the following vbs file:

Sub CreateAlbumArtist
' Define variables
Dim list, itm, i

' Get list of selected tracks from MediaMonkey
Set list = SDB.CurrentSongList

' Process all selected tracks
For i=0 To list.count-1
Set itm = list.Item(i)

' Copy the fields
itm.AlbumArtistName = itm.ArtistName
Next

' Write all back to DB and update tags
list.UpdateAll
End Sub

And I added the following to scripts.ini:

[CreateAlbumArtist]
FileName=CreateAlbumArtist.vbs
ProcName=CreateAlbumArtist
Order=6
DisplayName=Create AlbumArtist
Description=Copies Artist to AlbumArtist
Language=VBScript
ScriptType=0

It works perfectly. Now I'm trying to alter the script again to copy Date to OriginalDate but I can't get it to work. I have created the following vbs file:

Sub CreateOriginalDate
' Define variables
Dim list, itm, i

' Get list of selected tracks from MediaMonkey
Set list = SDB.CurrentSongList

' Process all selected tracks
For i=0 To list.count-1
Set itm = list.Item(i)

' Copy the fields
itm.OriginalDate = itm.Date
Next

' Write all back to DB and update tags
list.UpdateAll
End Sub

And I added the following to scripts.ini:

[CreateOriginalDate]
FileName=CreateOriginalDate.vbs
ProcName=CreateOriginalDate
Order=7
DisplayName=Create OriginalDate
Description=Copies Date to OriginalDate
Language=VBScript
ScriptType=0

But when I run the script I get the following error:

Error #438 - Microsoft runtime error
Object doesn't support this property or method 'itm.OriginalDate'
File: "C:\Program Files\MediaMonkey\Scripts\CreateOriginalDate.vbs, Line:13, Column :0

I'm guessing that OriginalDate should read something else. Any help would be greatly appreciated. Cheers.
kiwichick
Posts: 331
Joined: Tue Jul 21, 2009 6:35 am

Re: Create Original Date

Post by kiwichick »

Never mind. I got it fixed. It was a bit confusing when the MM column names are Date and Original Date but the required script names are Year and Original Year. I just changed Date for Year across the board and now it works.
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Create Original Date

Post by ZvezdanD »

You could write that as some kind of programing exercise, but also you could use the RegExp Find and Replace add-on to copy fields e.g. Year to Original Year or Date to Original Date or whatever to whatever - after the installation just choose Edit/Tag Manipulation Presets/Copy <From Field> to <Into Field> and select your source and destination fields.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
bakker_be
Posts: 25
Joined: Fri Apr 16, 2010 8:06 am

Re: Create Original Date

Post by bakker_be »

Thanks a lot for this nugget. It's just what I needed right now!!
Post Reply