ExtensionToLowercase v1.1 [MM2+3]

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

ExtensionToLowercase v1.1 [MM2+3]

Postby Steegy » Thu Feb 16, 2006 7:19 pm

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
Last edited by Steegy on Tue Apr 01, 2008 11:42 am, edited 2 times in total.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Steegy
 
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium

Postby nohitter151 » Mon Mar 31, 2008 11:21 pm

Will this script work for MM3?
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.
nohitter151
 
Posts: 22942
Joined: Wed Aug 09, 2006 10:20 am
Location: NJ, USA

Postby MoDementia » Mon Mar 31, 2008 11:57 pm

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
MoDementia
 
Posts: 1320
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Postby nohitter151 » Tue Apr 01, 2008 12:16 am

Works great, thanks MoDementia!

Of course, thanks to Steegy as well :D
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.
nohitter151
 
Posts: 22942
Joined: Wed Aug 09, 2006 10:20 am
Location: NJ, USA

Postby Steegy » Tue Apr 01, 2008 11:40 am

Hah... "Then" was missing... strange error :-?
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Steegy
 
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium

Postby Snow123 » Mon Apr 21, 2008 11:46 pm

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

Postby MoDementia » Mon Apr 21, 2008 11:53 pm

Woot I add 1 word and I get all the credit :P
MoDementia
 
Posts: 1320
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Postby Peke » Tue Apr 22, 2008 10:44 am

It feels great, doesn't it?
FYI little bugs are hardest to track ;)
Best regards,
Pavle
MM Core Developer and Admin of free MediaMonkey extensions Hosting
Image
Image
Peke
 
Posts: 8184
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia

Why?

Postby Thanks » Tue May 06, 2008 6:39 pm

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!]
Thanks
 

Postby Bex » Tue May 06, 2008 7:30 pm

Yes, my Tagging Inconsistencies script has such node. It find tons of other things as well. Link in signature.
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
Bex
 
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

just curious why

Postby thanks » Sun May 25, 2008 5:21 am

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.
thanks
 

Postby Bex » Sun May 25, 2008 5:26 am

Thanks!
Not that I know of. It's only for aesthetic reasons.
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
Bex
 
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Postby thanks » Sun May 25, 2008 11:52 am

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.
thanks
 

Re: just curious why

Postby Guest » Sun Jun 01, 2008 4:43 pm

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.
Guest
 

Postby Snow123 » Tue Jun 17, 2008 2:19 am

This script changes the file extension to lowercase for all selected files.
Snow123
 
Posts: 4
Joined: Mon Apr 21, 2008 11:45 pm


Return to Need Help with Addons?

Who is online

Users browsing this forum: No registered users and 19 guests