Help me with Custom Fields
-
- Posts: 23640
- Joined: Wed Aug 09, 2006 10:20 am
- Location: NJ, USA
- Contact:
Re: Help me with Custom Fields
Options > Appearance
MediaMonkey user since 2006
Need help? Got a suggestion? Can't find something?
Please no PMs in reply to a post. Just reply in the thread.
Need help? Got a suggestion? Can't find something?
Please no PMs in reply to a post. Just reply in the thread.
Re:
I know it's a long time since this was posted, but i was wondering. Is it possible to make it look like YYYY.MM.DD instead of YYYYMMDD ?Guest wrote:Here is my attempt at modifying the script to use YYYYMMDD HH:MM format for improved sorting. I'm learning as I go, so it might be a little clumsy. It also borrows from other examples I found on the net. If the formatting disappears when I post this (as it does in my preview), I apologize. This would be saved as an alternate version of SelectedFilesStoreDate.vbs:
EDIT Peke: Just made it look better.Code: Select all
'Modified 1/3/06 to save date in Custom3 as YYYYMMDD HH:MM format for improved sorting by date created 'To store the DateCreated of a file to field Custom3: ' mySong.Custom3 = GetFileDateCreated(mySong.Path) 'To store the DateLastModified of a file to field Custom3: ' mySong.Custom3 = GetFileDateLastModified(mySong.Path) 'Change the line with "CHANGE HERE IF YOU WANT" according to what you want (from the above possibilities) Function pd(n, totalDigits) if totalDigits > len(n) then pd = String(totalDigits-len(n),"0") & n else pd = n end if End Function Sub SelectedFilesStoreDate Dim mySongList Set mySongList = SDB.SelectedSongList If mySongList.Count = 0 Then Set mySongList = SDB.AllVisibleSongList If mySongList.Count = 0 Then SDB.MessageBox "Nothing selected!", mtError, Array(mbOK) Exit Sub End If End If Dim i, mySong, fd, fdt,fdtyyyymmd For i = 0 To mySongList.Count - 1 Set mySong = mySongList.Item(i) fdt = GetFileDatecreated(mysong.path) 'CHANGE HERE IF YOU WANT if isdate(fdt) then fd = cDate(fdt) fdtyyyymmdd=Year(fd)&pd(month(fd),2)&pd(day(fd),2)&" "&formatdatetime(fd,vbShortTime) ' msgbox(fdtyyyymmdd) mySong.Custom3 = fdtyyyymmdd mySong.UpdateDB end if Next End Sub Function GetFileDateCreated(FilePath) Dim FSO Set FSO = CreateObject("Scripting.FileSystemObject") Dim File Set File = FSO.GetFile(FilePath) GetFileDateCreated = File.DateCreated End Function Function GetFileDateLastModified(FilePath) Dim FSO Set FSO = CreateObject("Scripting.FileSystemObject") Dim File Set File = FSO.GetFile(FilePath) GetFileDateLastModified = File.DateLastModified End Function
Also is it possible to make Mediamonkey run this script on all new songs added?
-
- Posts: 2
- Joined: Fri May 01, 2015 7:24 pm
Re: Re:
Not sure about your first question, but see this post for your second one: http://www.mediamonkey.com/forum/viewto ... 85#p407310bambinn wrote:I know it's a long time since this was posted, but i was wondering. Is it possible to make it look like YYYY.MM.DD instead of YYYYMMDD ?Guest wrote:Here is my attempt at modifying the script to use YYYYMMDD HH:MM format for improved sorting. I'm learning as I go, so it might be a little clumsy. It also borrows from other examples I found on the net. If the formatting disappears when I post this (as it does in my preview), I apologize. This would be saved as an alternate version of SelectedFilesStoreDate.vbs:
EDIT Peke: Just made it look better.Code: Select all
'Modified 1/3/06 to save date in Custom3 as YYYYMMDD HH:MM format for improved sorting by date created 'To store the DateCreated of a file to field Custom3: ' mySong.Custom3 = GetFileDateCreated(mySong.Path) 'To store the DateLastModified of a file to field Custom3: ' mySong.Custom3 = GetFileDateLastModified(mySong.Path) 'Change the line with "CHANGE HERE IF YOU WANT" according to what you want (from the above possibilities) Function pd(n, totalDigits) if totalDigits > len(n) then pd = String(totalDigits-len(n),"0") & n else pd = n end if End Function Sub SelectedFilesStoreDate Dim mySongList Set mySongList = SDB.SelectedSongList If mySongList.Count = 0 Then Set mySongList = SDB.AllVisibleSongList If mySongList.Count = 0 Then SDB.MessageBox "Nothing selected!", mtError, Array(mbOK) Exit Sub End If End If Dim i, mySong, fd, fdt,fdtyyyymmd For i = 0 To mySongList.Count - 1 Set mySong = mySongList.Item(i) fdt = GetFileDatecreated(mysong.path) 'CHANGE HERE IF YOU WANT if isdate(fdt) then fd = cDate(fdt) fdtyyyymmdd=Year(fd)&pd(month(fd),2)&pd(day(fd),2)&" "&formatdatetime(fd,vbShortTime) ' msgbox(fdtyyyymmdd) mySong.Custom3 = fdtyyyymmdd mySong.UpdateDB end if Next End Sub Function GetFileDateCreated(FilePath) Dim FSO Set FSO = CreateObject("Scripting.FileSystemObject") Dim File Set File = FSO.GetFile(FilePath) GetFileDateCreated = File.DateCreated End Function Function GetFileDateLastModified(FilePath) Dim FSO Set FSO = CreateObject("Scripting.FileSystemObject") Dim File Set File = FSO.GetFile(FilePath) GetFileDateLastModified = File.DateLastModified End Function
Also is it possible to make Mediamonkey run this script on all new songs added?
Re: Help me with Custom Fields
Man I really need this field for my spotify to mediamonkey workflow. Other than this one important issue Mediamonkey is 100x better than Itunes
http://imgur.com/a/qjNyj
i'm getting some vb errors. the funny version is that the old version of that script loads, but doesn't work correctly (ie doens't get the same date created dates as I would have off the files in Windows File explorer)
http://imgur.com/a/qjNyj
i'm getting some vb errors. the funny version is that the old version of that script loads, but doesn't work correctly (ie doens't get the same date created dates as I would have off the files in Windows File explorer)