Unicode To Ascii 1.0 [MM2+3]

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

Moderators: Peke, Gurus

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Unicode To Ascii 1.0 [MM2+3]

Post by trixmoto »

This script (as requested) converts the text fields of the selected tracks from Unicode to ASCII. If the tags are already in ASCII, it will still convert them, but will obviously remain the same.

Code: Select all

'
' MediaMonkey Script
'
' NAME: UnicodeToAscii 1.0
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 06/01/2006
'
' INSTALL: Copy to Scripts directory and add the following to Scripts.ini 
'          Don't forget to remove comments (') and set the order appropriately
'
' [UnicodeToAscii]
' FileName=UnicodeToAscii.vbs
' ProcName=UnicodeToAscii
' Order=16
' DisplayName=Unicode To Ascii
' Description=Convert Unicode To Ascii
' Language=VBScript
' ScriptType=0 
'

Option Explicit   

Sub UnicodeToAscii 
  Dim tracks,itm,prog
  Dim res, i

  Set tracks = SDB.SelectedSongList 
  If tracks.count = 0 Then 
     Set tracks = SDB.AllVisibleSongList 
  End If 
  If tracks.count = 0 Then 
    res = SDB.MessageBox("Select tracks to be converted", mtError, Array(mbOk)) 
    Exit Sub 
  End If 
  
  Set prog = SDB.Progress
  prog.MaxValue = tracks.count

  For i = 0 to tracks.count-1
    prog.Value = i
    prog.Text = "Converting track "&(i+1)&" of "&tracks.count&"..."
    Set itm = tracks.Item(i)
    
    itm.Title = SDB.toASCII(itm.Title)
    itm.ArtistName = SDB.toASCII(itm.ArtistName)
    itm.AlbumName = SDB.toASCII(itm.AlbumName)
    itm.AlbumArtistName = SDB.toASCII(itm.AlbumArtistName)
    itm.Genre = SDB.toASCII(itm.Genre)
    itm.Comment = SDB.toASCII(itm.Comment)
    itm.Author = SDB.toASCII(itm.Author)
    '.....
    
    itm.UpdateDB
    If prog.Terminate Then Exit For
  Next
  
  Set prog = Nothing
  res = SDB.MessageBox(tracks.count&" tracks successfully converted", mtInformation, Array(mbOk))
   
End Sub 

Sub Install()
  Dim inip : inip = SDB.ApplicationPath&"Scripts\Scripts.ini"
  Dim inif : Set inif = SDB.Tools.IniFileByPath(inip)
  If Not (inif Is Nothing) Then
    inif.StringValue("UnicodeToAscii","Filename") = "UnicodeToAscii.vbs"
    inif.StringValue("UnicodeToAscii","Procname") = "UnicodeToAscii"
    inif.StringValue("UnicodeToAscii","Order") = "16"
    inif.StringValue("UnicodeToAscii","DisplayName") = "UnicodeToAscii"
    inif.StringValue("UnicodeToAscii","Description") = "Convert Unicode To Ascii"
    inif.StringValue("UnicodeToAscii","Language") = "VBScript"
    inif.StringValue("UnicodeToAscii","ScriptType") = "0"
    SDB.RefreshScriptItems
  End If
End Sub
Last edited by trixmoto on Wed Nov 07, 2007 12:07 pm, edited 1 time in total.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

There is now an MM3 installation package available from my website for this script.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Macarena
Posts: 642
Joined: Mon Oct 15, 2007 5:39 am
Location: Prague, Czech republic

Post by Macarena »

Is there any way how to do this only for auto-organize procedure? I would not like to save my filenames with unicode characters as
a) some programs does not support them
b) I have fat32 file system and when later changing OS, it can cause some problems in reading -- definitely it's some uncertainty for me and I would like to get rid off it.

Thanks upfront
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

No, I don't think so, sorry.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Post Reply