Import tag info (track titles) from .txt files?

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Re: Import tag info (track titles) from .txt files?

Postby joshb » Fri Dec 30, 2011 3:57 pm

Please, how can this script be bound to a shortcut key, and/or added to the right-click context menu? I need to use this script on many, many folders of untagged .flacs!
This was asked by several earlier posters. I have tried a few things in the scripts.ini file, but I don't know scripting and I'm just fumbling around, and I get VBS runtime error 13 when I try to run it via the shortcut key.

Also, IMHO this script needs to be more visible. I've been looking for this functionality for YEARS and only found it yesterday, after hours of searching the forum. Can a final (with keyboard shortcuts) version be posted in a more prominent place?

thanks, Josh
joshb
 
Posts: 1
Joined: Fri Dec 30, 2011 3:34 pm

Re: Import tag info (track titles) from .txt files?

Postby r4pr0r » Mon Jun 04, 2012 3:07 pm

Is there anywhere where this complete updated script is available?
r4pr0r
 

Import Tags From Text File [MM3+]

Postby Eyal » Fri Jun 08, 2012 3:25 am

This is a complete working version of the script I have on my computer.

- Copy the code below to a TEXT file named ImportTagsFromText.vbs (or get the file from here)
- Save that file in Mediamonkey\Scripts\Auto folder.
- Restart MediaMonkey.

-> Select the tracks to tag, Run the script through Tools|Auto-Tag from Tag-List menu.

Code: Select all
'Forum: http://mediamonkey.com/forum/viewtopic.php?f=2&t=8882&st=0&sk=t&sd=a&start=15#p71332
'Modified by Eyal 2008-09-15, 2011-03-05 & 2011-07-04.
Option Explicit

Sub OnStartUp
      Dim MenuItem
      Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Tools, 1, -3)
         MenuItem.Caption = "Auto-Tag from Tag-List..."
         MenuItem.IconIndex = 26
         MenuItem.UseScript = Script.ScriptPath
         MenuItem.OnClickFunc = "TagFromTagList"
      Set MenuItem = Nothing
End Sub

Sub TagFromTagList(MenuItem)
   Dim Form, Label, Button, Dialog, DropDownMask
   Dim EditPath, DropDownMaskMask
   Dim FileSys, File
   Set FileSys = CreateObject("Scripting.FileSystemObject")
   Dim Content
   Dim a
   
   Set Form = SDB.UI.NewForm
   Form.Common.SetRect 0, 0, 310, 180
   Form.FormPosition = 4   ' Screen Center
   Form.BorderStyle = 3    ' Dialog
   Form.Caption = "Auto-Tag from Tag-List"
   
   Set Label = SDB.UI.NewLabel(Form)
   Label.Common.SetRect 10, 15, 280, 18
   Label.Caption = "Tag-List File:"
   
   Set EditPath = SDB.UI.NewEdit(Form)
   EditPath.Common.SetRect 10, 30, 280, 18
   EditPath.Text = SDB.SelectedSongList.Item(0).Path      'Mod by Eyal: use path of first selected track.
   
   Set Dialog = SDB.CommonDialog
   Dialog.InitDir = EditPath.Text
   Dialog.Filter = "*.txt|*.txt|*.csv|*.csv|*.*|*.*"
   Dialog.ShowOpen
   if Dialog.OK then
      EditPath.Text = Dialog.Filename
     
      'show first line of file
      Set File = FileSys.OpenTextFile(EditPath.Text, 1, False)
         Set Label = SDB.UI.NewLabel(Form)
        Label.Common.SetRect 10, 94, 280, 18
        Content   = File.ReadLine
         If Left(Content, 3) = "" Then Content = Mid(Content, 4)
         Label.Caption = Content
      Set File = Nothing
   end if
   Set Dialog = Nothing
   
   Set Label = SDB.UI.NewLabel(Form)
  Label.Common.SetRect 10, 54, 280, 18
  Label.Caption = "Mask:"
   
   Set DropDownMask = SDB.UI.NewDropDown(Form)
  DropDownMask.Common.SetRect 10, 69, 280, 18
   DropDownMask.Common.Hint = "<Tabulator>" & Chr(13)
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & "<Return>" & Chr(13)
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%T") & Chr(13) '<Track#>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%S") & Chr(13) '<Title>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%A") & Chr(13) '<Artist>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%R") & Chr(13) '<Album Artist>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%L") & Chr(13) '<Album>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%Y") & Chr(13) '<Year>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%G") & Chr(13) '<Genre>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%B") & Chr(13) '<Bitrate>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%M") & Chr(13) '<BPM>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%C") & Chr(13) '<Composer>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%P") & Chr(13) '<Folder>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%F") & Chr(13) '<Filename>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%X") & Chr(13) '<Skip>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%ZH") & Chr(13) '<Original Artist>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%ZD") & Chr(13) '<Comment>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%U") & Chr(13) '<Custom1>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%V") & Chr(13) '<Custom2>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%W") & Chr(13) '<Custom3>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%J") & Chr(13) '<Custom4>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%K")           '<Custom5>
   
     
   for a = 1 to 10
      Content = SDB.INIFile.StringValue("TagsFromFileList", "LastMask" & a)
      if Content <> "" then
         DropDownMask.AddItem(Content)
         if a = 1 then DropDownMask.Text = Content
      end if
   next

  Set Button = SDB.UI.NewButton( Form)
  Button.Caption = SDB.Localize("&Ok")
  Button.Common.SetRect 115, 110, 75, 25
  Button.ModalResult = 1
  Button.Default = True

  Set Button = SDB.UI.NewButton( Form)
  Button.Caption = SDB.Localize("&Cancel")
  Button.Common.SetRect 215, 110, 75, 25
  Button.ModalResult = 2
  Button.Cancel = True

  if Form.ShowModal = 1 then
     Dim Tracks, Track
     Dim FileListPos
     Dim Mask, MaskLines
     Dim TagListContent, TagListLines, LastFileListPos
     Dim intTemp
   
     Set Tracks = SDB.SelectedSongList
     
      for a = 1 to 10
         SDB.INIFile.DeleteKey "TagsFromFileList", "LastMask" & a
      next
      for a = 0 to DropDownMask.ItemCount
         if a = 0 then
            Content = DropDownMask.Text
         else
            Content = DropDownMask.ItemText(a - 1)
         end if
         if Content <> "" then SDB.INIFile.StringValue("TagsFromFileList", "LastMask" & (a + 1)) = Content
         
         'clear Duplicates in DropDownList
         for intTemp = a to DropDownMask.ItemCount - 1
            if DropDownMask.ItemText(intTemp) = Content then DropDownMask.DeleteItem(intTemp)
         next
      next
   
      if not SDB.Tools.FileSystem.FileExists(EditPath.Text) then
         SDB.MessageBox "File " & EditPath.Text & " not found!", mtError, Array(mbOK)
         Exit Sub
      end if
   
     Set File = FileSys.OpenTextFile(EditPath.Text, 1, False)
   
     Mask = SDB.Tools.UFText2Mask(DropDownMask.Text)
     Mask = Replace(Mask, "<Tabulator>", Chr(9))
      Mask = Replace(Mask, "<Return>", Chr(13))
     MaskLines = Count(Mask, Chr(13))
   
     TagListContent = File.ReadAll
     
    'modified by MJM 01-05-2007
    TagListLines = Count(TagListContent, Chr(13)) - 1
   
    'MsgBox "Int(TagListLines / MaskLines): " & Int(TagListLines / MaskLines)
    'MsgBox "TagListLines / MaskLines: " & TagListLines / MaskLines
   
     If (TagListLines / MaskLines) <> Int(TagListLines / MaskLines) Then
         if TagListLines <> (Int(TagListLines / MaskLines)*MaskLines + 1) then
            SDB.MessageBox "Number of Lines in Tag-List and Mask doesn't fit!", mtError, Array(mbOK)
          Exit Sub
         end if
     End If
     If Tracks.Count <> Int(TagListLines / MaskLines) Then
         SDB.MessageBox "Number of Lines in Tag-List and Track-List doesn't fit!", mtError, Array(mbOK)
       Exit Sub
     End If
   
     FileListPos = 0
     LastFileListPos = 0
     TagListContent = TagListContent + Chr(13)
     For intTemp = 1 To (TagListLines / MaskLines) 'soviele Tracks
         Set Track = Tracks.Item(intTemp - 1)
     
       For a = 1 To MaskLines
         FileListPos = InStr(FileListPos + 1, TagListContent, Chr(13))
       Next
       Content = Trim(Mid(TagListContent, LastFileListPos + 1, FileListPos - LastFileListPos-1))
         If Left(Content, 3) = "" Then Content = Mid(Content, 4)
         'necessary for ParseText:
         if InStr(Mask, "%A") then Track.ArtistName = ""
         if InStr(Mask, "%L") then Track.AlbumName = ""
         if InStr(Mask, "%R") then Track.AlbumArtistName = ""
         if InStr(Mask, "%G") then Track.Genre = ""

         Track.ParseText Content, Mask

       LastFileListPos = FileListPos + 1
         Set Track = Nothing
     Next
     
      'Refresh Screen
      SDB.MainTracksWindow.RemoveSelectedTracks
      for a = 0 to Tracks.Count - 1
         SDB.MainTracksWindow.AddTrack(Tracks.Item(a))
      next
      SDB.MainTracksWindow.FinishAdding
   
     If SDB.MessageBox("Correct?", mtConfirmation, Array(mbYes, mbNo)) = mrYes Then
       Tracks.UpdateAll
     Else
       SDB.MainTracksWindow.Refresh
     End If
  End if
End Sub

Function Count(Text, Seperator)
   Dim intTemp
   Count = 0
   intTemp = 1
   Do
     Count = Count + 1
     intTemp = InStr(intTemp + 1, Text, Seperator)
   Loop While intTemp > 0
End Function


Cheers!

Eyal :~)
Skins for MediaMonkey: Cafe, Carbon, Helium, Spotify, Zekton. [ Wiki Zone ].
Eyal
 
Posts: 3052
Joined: Sun Jun 26, 2005 9:27 am
Location: Québec

Re: Import tag info (track titles) from .txt files?

Postby Nanya » Thu Oct 18, 2012 2:17 pm

Thanks for the awesome script, I use this all the time. I wanted it to support Unicode so I added a "-1" to lines 45 and 136. They should now read:

Code: Select all
Set File = FileSys.OpenTextFile(EditPath.Text, 1, False, -1)


Additionally, in order to prevent the script from continuing, it's necessary to add

Code: Select all
   Else
     Exit Sub


...between lines 51 & 52 so the result is:

Code: Select all
      Set File = Nothing
   Else
     Exit Sub
   End If
   
Nanya
 
Posts: 21
Joined: Wed Oct 03, 2012 8:04 pm

Re: Import tag info (track titles) from .txt files?

Postby rozzah » Fri Mar 01, 2013 5:02 pm

I presume - you don't have to 'wrap' the numbered song name in a <Title>

e.g.
1. songname A
2. songname B
...

is
fine
it DOESN'T have to be <Title>1. songname A</Title>

I've tried both anyway.. no joy

I saved the latest vbs code and the above edits (last 2 posts) - I'm still getting the error
'Number of Lines in Tag-List and Track-List doesn't fit'

Can anyone confirm this working in latest Media Monkey 4.0.7.1511
I'm going try on an older Windows machine

To be honest I don't know why this is not a FEATURE - you should be able to paste from the web or into a dialouge box - the suggestion of a context menu for scripts extra would also be useful but want to getting it working first - I have Mozart x 40CD to tag !

Anyway - fair play to the original vbs writer

RoZZaH
rozzah
 
Posts: 1
Joined: Fri Mar 01, 2013 2:05 pm

Re: Import tag info (track titles) from .txt files?

Postby Peke » Fri Mar 01, 2013 8:54 pm

If there is need for MMIP hosting I'll be glad to provide one.
Best regards,
Pavle
MM Core Developer and Fan (check HAPPYMONKEYING Site)
Image
Image
Peke
 
Posts: 7551
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia

Re: Import Tags From Text File [MM3+]

Postby Janderia » Sat Mar 30, 2013 1:20 am

Eyal wrote:This is a complete working version of the script I have on my computer.

- Copy the code below to a TEXT file named ImportTagsFromText.vbs (or get the file from here)
- Save that file in Mediamonkey\Scripts\Auto folder.
- Restart MediaMonkey.

-> Select the tracks to tag, Run the script through Tools|Auto-Tag from Tag-List menu.

Code: Select all
'Forum: http://mediamonkey.com/forum/viewtopic.php?f=2&t=8882&st=0&sk=t&sd=a&start=15#p71332
'Modified by Eyal 2008-09-15, 2011-03-05 & 2011-07-04.
Option Explicit

Sub OnStartUp
      Dim MenuItem
      Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Tools, 1, -3)
         MenuItem.Caption = "Auto-Tag from Tag-List..."
         MenuItem.IconIndex = 26
         MenuItem.UseScript = Script.ScriptPath
         MenuItem.OnClickFunc = "TagFromTagList"
      Set MenuItem = Nothing
End Sub

Sub TagFromTagList(MenuItem)
   Dim Form, Label, Button, Dialog, DropDownMask
   Dim EditPath, DropDownMaskMask
   Dim FileSys, File
   Set FileSys = CreateObject("Scripting.FileSystemObject")
   Dim Content
   Dim a
   
   Set Form = SDB.UI.NewForm
   Form.Common.SetRect 0, 0, 310, 180
   Form.FormPosition = 4   ' Screen Center
   Form.BorderStyle = 3    ' Dialog
   Form.Caption = "Auto-Tag from Tag-List"
   
   Set Label = SDB.UI.NewLabel(Form)
   Label.Common.SetRect 10, 15, 280, 18
   Label.Caption = "Tag-List File:"
   
   Set EditPath = SDB.UI.NewEdit(Form)
   EditPath.Common.SetRect 10, 30, 280, 18
   EditPath.Text = SDB.SelectedSongList.Item(0).Path      'Mod by Eyal: use path of first selected track.
   
   Set Dialog = SDB.CommonDialog
   Dialog.InitDir = EditPath.Text
   Dialog.Filter = "*.txt|*.txt|*.csv|*.csv|*.*|*.*"
   Dialog.ShowOpen
   if Dialog.OK then
      EditPath.Text = Dialog.Filename
     
      'show first line of file
      Set File = FileSys.OpenTextFile(EditPath.Text, 1, False)
         Set Label = SDB.UI.NewLabel(Form)
        Label.Common.SetRect 10, 94, 280, 18
        Content   = File.ReadLine
         If Left(Content, 3) = "" Then Content = Mid(Content, 4)
         Label.Caption = Content
      Set File = Nothing
   end if
   Set Dialog = Nothing
   
   Set Label = SDB.UI.NewLabel(Form)
  Label.Common.SetRect 10, 54, 280, 18
  Label.Caption = "Mask:"
   
   Set DropDownMask = SDB.UI.NewDropDown(Form)
  DropDownMask.Common.SetRect 10, 69, 280, 18
   DropDownMask.Common.Hint = "<Tabulator>" & Chr(13)
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & "<Return>" & Chr(13)
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%T") & Chr(13) '<Track#>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%S") & Chr(13) '<Title>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%A") & Chr(13) '<Artist>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%R") & Chr(13) '<Album Artist>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%L") & Chr(13) '<Album>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%Y") & Chr(13) '<Year>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%G") & Chr(13) '<Genre>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%B") & Chr(13) '<Bitrate>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%M") & Chr(13) '<BPM>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%C") & Chr(13) '<Composer>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%P") & Chr(13) '<Folder>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%F") & Chr(13) '<Filename>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%X") & Chr(13) '<Skip>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%ZH") & Chr(13) '<Original Artist>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%ZD") & Chr(13) '<Comment>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%U") & Chr(13) '<Custom1>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%V") & Chr(13) '<Custom2>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%W") & Chr(13) '<Custom3>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%J") & Chr(13) '<Custom4>
   DropDownMask.Common.Hint = DropDownMask.Common.Hint & SDB.Tools.Mask2UFText("%K")           '<Custom5>
   
     
   for a = 1 to 10
      Content = SDB.INIFile.StringValue("TagsFromFileList", "LastMask" & a)
      if Content <> "" then
         DropDownMask.AddItem(Content)
         if a = 1 then DropDownMask.Text = Content
      end if
   next

  Set Button = SDB.UI.NewButton( Form)
  Button.Caption = SDB.Localize("&Ok")
  Button.Common.SetRect 115, 110, 75, 25
  Button.ModalResult = 1
  Button.Default = True

  Set Button = SDB.UI.NewButton( Form)
  Button.Caption = SDB.Localize("&Cancel")
  Button.Common.SetRect 215, 110, 75, 25
  Button.ModalResult = 2
  Button.Cancel = True

  if Form.ShowModal = 1 then
     Dim Tracks, Track
     Dim FileListPos
     Dim Mask, MaskLines
     Dim TagListContent, TagListLines, LastFileListPos
     Dim intTemp
   
     Set Tracks = SDB.SelectedSongList
     
      for a = 1 to 10
         SDB.INIFile.DeleteKey "TagsFromFileList", "LastMask" & a
      next
      for a = 0 to DropDownMask.ItemCount
         if a = 0 then
            Content = DropDownMask.Text
         else
            Content = DropDownMask.ItemText(a - 1)
         end if
         if Content <> "" then SDB.INIFile.StringValue("TagsFromFileList", "LastMask" & (a + 1)) = Content
         
         'clear Duplicates in DropDownList
         for intTemp = a to DropDownMask.ItemCount - 1
            if DropDownMask.ItemText(intTemp) = Content then DropDownMask.DeleteItem(intTemp)
         next
      next
   
      if not SDB.Tools.FileSystem.FileExists(EditPath.Text) then
         SDB.MessageBox "File " & EditPath.Text & " not found!", mtError, Array(mbOK)
         Exit Sub
      end if
   
     Set File = FileSys.OpenTextFile(EditPath.Text, 1, False)
   
     Mask = SDB.Tools.UFText2Mask(DropDownMask.Text)
     Mask = Replace(Mask, "<Tabulator>", Chr(9))
      Mask = Replace(Mask, "<Return>", Chr(13))
     MaskLines = Count(Mask, Chr(13))
   
     TagListContent = File.ReadAll
     
    'modified by MJM 01-05-2007
    TagListLines = Count(TagListContent, Chr(13)) - 1
   
    'MsgBox "Int(TagListLines / MaskLines): " & Int(TagListLines / MaskLines)
    'MsgBox "TagListLines / MaskLines: " & TagListLines / MaskLines
   
     If (TagListLines / MaskLines) <> Int(TagListLines / MaskLines) Then
         if TagListLines <> (Int(TagListLines / MaskLines)*MaskLines + 1) then
            SDB.MessageBox "Number of Lines in Tag-List and Mask doesn't fit!", mtError, Array(mbOK)
          Exit Sub
         end if
     End If
     If Tracks.Count <> Int(TagListLines / MaskLines) Then
         SDB.MessageBox "Number of Lines in Tag-List and Track-List doesn't fit!", mtError, Array(mbOK)
       Exit Sub
     End If
   
     FileListPos = 0
     LastFileListPos = 0
     TagListContent = TagListContent + Chr(13)
     For intTemp = 1 To (TagListLines / MaskLines) 'soviele Tracks
         Set Track = Tracks.Item(intTemp - 1)
     
       For a = 1 To MaskLines
         FileListPos = InStr(FileListPos + 1, TagListContent, Chr(13))
       Next
       Content = Trim(Mid(TagListContent, LastFileListPos + 1, FileListPos - LastFileListPos-1))
         If Left(Content, 3) = "" Then Content = Mid(Content, 4)
         'necessary for ParseText:
         if InStr(Mask, "%A") then Track.ArtistName = ""
         if InStr(Mask, "%L") then Track.AlbumName = ""
         if InStr(Mask, "%R") then Track.AlbumArtistName = ""
         if InStr(Mask, "%G") then Track.Genre = ""

         Track.ParseText Content, Mask

       LastFileListPos = FileListPos + 1
         Set Track = Nothing
     Next
     
      'Refresh Screen
      SDB.MainTracksWindow.RemoveSelectedTracks
      for a = 0 to Tracks.Count - 1
         SDB.MainTracksWindow.AddTrack(Tracks.Item(a))
      next
      SDB.MainTracksWindow.FinishAdding
   
     If SDB.MessageBox("Correct?", mtConfirmation, Array(mbYes, mbNo)) = mrYes Then
       Tracks.UpdateAll
     Else
       SDB.MainTracksWindow.Refresh
     End If
  End if
End Sub

Function Count(Text, Seperator)
   Dim intTemp
   Count = 0
   intTemp = 1
   Do
     Count = Count + 1
     intTemp = InStr(intTemp + 1, Text, Seperator)
   Loop While intTemp > 0
End Function


Cheers!

Eyal :~)


I'm using MM 4.0.7.1511 and am trying to use this script but I'm not seeing the menu item under tools or tools --> scripts. I've tried saving the .vbs file with both notepad and with wordpad but neither seem to work. I've also tried removing the -1 from this line:

TagListLines = Count(TagListContent, Chr(13)) - 1

The version seems to be a couple years old so I'm wondering if it just won't work with the version of MM I have. Is anyone able to use it with ver 4.0.7.1511?

Thanks!
Janderia
 

Re: Import tag info (track titles) from .txt files?

Postby Eyal » Sat Mar 30, 2013 2:22 am

In MM4 scripts are saved to the user folder. So it might be one of these folders:

nohitter151 wrote:If you installed the script for a single user it would be at:

Windows 7 / Vista:
C:\Users\_your username_\AppData\Roaming\MediaMonkey\Scripts\Auto

Win XP:
C:\Documents and Settings\_your username_\Application Data\Roaming\MediaMonkey\Scripts\Auto
Skins for MediaMonkey: Cafe, Carbon, Helium, Spotify, Zekton. [ Wiki Zone ].
Eyal
 
Posts: 3052
Joined: Sun Jun 26, 2005 9:27 am
Location: Québec

Re: Import tag info (track titles) from .txt files?

Postby janderia » Sat Mar 30, 2013 3:22 pm

Eyal wrote:In MM4 scripts are saved to the user folder. So it might be one of these folders:



I moved the .vbs file to C:\Users\<username>\AppData\Roaming\MediaMonkey\Scripts\Auto but I'm still not seeing anything in the Tools --> Scripts menu. I know that this script doesn't need an entry in scripts.ini but just to test things, I tried putting an entry in the scripts.ini anyway. There are two scripts.ini files on my computer, one is in the C:\Program Files (x86)\MediaMonkey\Scripts that was installed with Media Monkey. The other is in C:\Users\<username>\AppData\Roaming\MediaMonkey\Scripts\Auto and was installed with another script that seems to work ok (DiscogsAutoTagWeb.vbs). I added the ImportTagsFromText section after the DiscogsAutoTagWeb section.

Code: Select all
[ImportTagsFromText]
FileName=ImportTagsFromText.vbs
ProcName=TagFromTagList
Order=20
DisplayName=Import Tags From Text...
Description=Tags based on input from a text file
Language=VBScript
ScriptType=0


So at this point, I can start MM 4 and I do see a menu item with the scripts.ini section added. :)
The problem from here is that I get an error when I try to start the script by clicking on it from the menu. :(
This is the error I'm getting:

Code: Select all
Error #450 - Microsoft VBScript runtime error
Wrong number of arguments or invalid property assignment "TagFromTagList"
File: "C:\Users\<username>\AppData\Roaming\MediaMonkey\Scripts\ImportTagsFromText.vbs", Line: 1, Column: 0


I've since removed the extra section in scripts.ini and moved the script back to the Auto folder but unfortunately I'm still not able to see the script from the menu. I'm a systems type and not a developer so it wouldn't surprise me if its just something simple. Could there be something I'm missing?
janderia
 

Re: Import tag info (track titles) from .txt files?

Postby janderia » Mon Apr 01, 2013 10:32 pm

I've determined that the problem may reside in the menuitem options or something related. With my limited programing knowledge, that may not be correct but what I did find was that adding a shortcut option allows me to run the script without incident. My .mov files were re-tagged properly from my input file. The shortcut option was the only change I made. I'm still not seeing the menu item though. It would be nice to have it around so that I'm not relying on my memory to recall that I set CTRL-1 to run the script so if anyone has any ideas, please let me know. Could MM 4 handle the menuitems differently than MM3?

Here's the top portion of the script with my change...

Code: Select all
Option Explicit

Sub OnStartUp
      Dim MenuItem
      Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Tools, 1, -3)
         MenuItem.Caption = "Auto-Tag from Tag-List..."
         MenuItem.IconIndex = 26
         MenuItem.UseScript = Script.ScriptPath
         MenuItem.OnClickFunc = "TagFromTagList"
         MenuItem.Shortcut = "Ctrl+1"
      Set MenuItem = Nothing
End Sub


Thanks!
janderia
 
Posts: 1
Joined: Sat Mar 30, 2013 3:26 pm

Re: Import tag info (track titles) from .txt files?

Postby Eyal » Wed Apr 03, 2013 12:20 am

That's really strange that it doesn't appear in the menu. Adding the shortcut to this menu item means it's must be there and working. Otherwise the shortcut won't work. Are you sure you're looking in the TOOLS menu?

MM3 and MM4 handle the menus the same way.

:~)
Skins for MediaMonkey: Cafe, Carbon, Helium, Spotify, Zekton. [ Wiki Zone ].
Eyal
 
Posts: 3052
Joined: Sun Jun 26, 2005 9:27 am
Location: Québec

Previous

Return to Need Help with Addons?

Who is online

Users browsing this forum: Bing [Bot] and 10 guests