Page 1 of 1

ExtensionToLowercase v1.1 [MM2+3]

Posted: Thu Feb 16, 2006 7:19 pm
by Steegy
ExtensionToLowercase forum post.

This script changes the file extension to lowercase for all selected files.

The script consists of 1 script file ("ExtensionToLowercase.vbs").
See How do I install scripts? for more help on installing the script.

ExtensionToLowercase.vbs (for the Scripts folder)

Code: Select all

'====================================================================================
' 
' MEDIAMONKEY SCRIPT: ExtensionToLowercase v1.1 (last updated 2007-01-02)    by   Steegy
'  Initiated on 2006-02-17
'
'  The ExtensionToLowercase script changes the file extension to lowercase for all selected files.
'
' Installation instructions: 
' - Copy this script as plain text file named ExtensionToLowercase.vbs, to the MediaMonkey Scripts folder 
' - Add a script entry to file Scripts.ini (example shown below)
'
'  [ExtensionToLowercase]
'  FileName=ExtensionToLowercase.vbs
'  ProcName=ExtensionToLowercase
'  Order=7
'  DisplayName=ExtensionToLowercase
'  Description=ExtensionToLowercase
'  Language=VBScript
'  ScriptType=0
'
'==========================================================================

Sub ExtensionToLowercase

  Dim mySongList : Set mySongList = SDB.CurrentSongList
  If mySongList.Count = 0 Then
    SDB.MessageBox "Nothing selected!", mtError, Array(mbOK)
    Exit Sub
  End If

  Dim i, mySong, Result
  For i = 0 To mySongList.Count - 1
    Set mySong = mySongList.Item(i)
    Result = FilePathExtensionToLowercase(mySong.Path)
    If Result <> "" Then
      mySong.Path = Result
      mySong.UpdateDB
    End If
  Next

End Sub


Function FilePathExtensionToLowercase(FilePath)
  FilePathExtensionToLowercase = ""

  Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject")

  If FSO.FileExists(FilePath) Then
    Dim File : Set File = FSO.GetFile(FilePath)
    If FSO.GetExtensionName(File) <> LCase(FSO.GetExtensionName(File)) Then
      FilePathExtensionToLowercase = File.ParentFolder.Path & "\" & FSO.GetBaseName(File) & "." & LCase(FSO.GetExtensionName(File))
    End If
  End If

End Function

Posted: Mon Mar 31, 2008 11:21 pm
by nohitter151
Will this script work for MM3?

Posted: Mon Mar 31, 2008 11:57 pm
by MoDementia
I didnt work for MM2 :) but yes it works for both now

Code: Select all

'====================================================================================
'
' MEDIAMONKEY SCRIPT: ExtensionToLowercase v1.1 (last updated 2007-01-02)    by   Steegy
'  Initiated on 2006-02-17
'
'  The ExtensionToLowercase script changes the file extension to lowercase for all selected files.
'
' Installation instructions:
' - Copy this script as plain text file named ExtensionToLowercase.vbs, to the MediaMonkey Scripts folder
' - Add a script entry to file Scripts.ini (example shown below)
'
'  [ExtensionToLowercase]
'  FileName=ExtensionToLowercase.vbs
'  ProcName=ExtensionToLowercase
'  Order=7
'  DisplayName=ExtensionToLowercase
'  Description=ExtensionToLowercase
'  Language=VBScript
'  ScriptType=0
'
'==========================================================================

Sub ExtensionToLowercase

  Dim mySongList : Set mySongList = SDB.CurrentSongList
  If mySongList.Count = 0 Then
    SDB.MessageBox "Nothing selected!", mtError, Array(mbOK)
    Exit Sub
  End If

  Dim i, mySong, Result
  For i = 0 To mySongList.Count - 1
    Set mySong = mySongList.Item(i)
    Result = FilePathExtensionToLowercase(mySong.Path)
    If Result <> "" Then
      mySong.Path = Result
      mySong.UpdateDB
    End If
  Next

End Sub


Function FilePathExtensionToLowercase(FilePath)
  FilePathExtensionToLowercase = ""

  Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject")

  If FSO.FileExists(FilePath) Then
    Dim File : Set File = FSO.GetFile(FilePath)
    If FSO.GetExtensionName(File) <> LCase(FSO.GetExtensionName(File)) Then
      FilePathExtensionToLowercase = File.ParentFolder.Path & "\" & FSO.GetBaseName(File) & "." & LCase(FSO.GetExtensionName(File))
    End If
  End If

End Function

Posted: Tue Apr 01, 2008 12:16 am
by nohitter151
Works great, thanks MoDementia!

Of course, thanks to Steegy as well :D

Posted: Tue Apr 01, 2008 11:40 am
by Steegy
Hah... "Then" was missing... strange error :-?

Posted: Mon Apr 21, 2008 11:46 pm
by Snow123
This script changes the file extension to lowercase for all selected files.
Works great, thanks MoDementia! :D

Posted: Mon Apr 21, 2008 11:53 pm
by MoDementia
Woot I add 1 word and I get all the credit :P

Posted: Tue Apr 22, 2008 10:44 am
by Peke
It feels great, doesn't it?
FYI little bugs are hardest to track ;)

Why?

Posted: Tue May 06, 2008 6:39 pm
by Thanks
I've always wondered why it's desirable not to have upper-case file extensions. Presumably there is some reason?

Assuming there is, is there a script to find all the tracks with an upper case file extension - i.e. before you use this script?

Many thankis. [That was a typo but I think I'll leave it as it is!]

Posted: Tue May 06, 2008 7:30 pm
by Bex
Yes, my Tagging Inconsistencies script has such node. It find tons of other things as well. Link in signature.

just curious why

Posted: Sun May 25, 2008 5:21 am
by thanks
Is it bad to have some e.g. ".MP3" files extensions (instead of ".mp3")?

Is there some case when it's important to have lower case file extensions?

Thanks for the cool TI script, Bex.

Posted: Sun May 25, 2008 5:26 am
by Bex
Thanks!
Not that I know of. It's only for aesthetic reasons.

Posted: Sun May 25, 2008 11:52 am
by thanks
Bex wrote:Thanks!
Not that I know of. It's only for aesthetic reasons.
No, thank you! Tak, to be precise. Or something like that.

Crikey, I've been wondering that for such a long time. I can sleep easy now.

Re: just curious why

Posted: Sun Jun 01, 2008 4:43 pm
by Guest
thanks wrote:Is it bad to have some e.g. ".MP3" files extensions (instead of ".mp3")?

Is there some case when it's important to have lower case file extensions?

Thanks for the cool TI script, Bex.
Actually, I had a big problem once with someone once that would not work with the uppercase file extensions on mp3s. Can't remember what it was now, though--possibly something for my phone.

Posted: Tue Jun 17, 2008 2:19 am
by Snow123
This script changes the file extension to lowercase for all selected files.