So I poked around and figured out there is a type on the comments to put in the scripts.ini... below is the corrected code, the only modification is the commented out script ini info "'ProcName=AlbumVolumeLeveler ' CORRECTED PROCNAME".
Code: Select all
Option Explicit
'1. Create a file AlbumVolumeLeveler.vbs in MediaMonkey\Scripts and paste these lines
'2. Add this Section to Scripts.ini
'[AlbumVolumeLeveler]
'FileName=AlbumVolumeLeveler.vbs
'ProcName=AlbumVolumeLeveler ' CORRECTED PROCNAME
'Order=1
'DisplayName=Album Volume Leveler
'Description=Album Volume Leveler
'Language=VBScript
'ScriptType=0
'3. restart MediaMonkey
'4. you'll find "Album Volume Leveler" in Tools\Scripts
sub AlbumVolumeLeveler
dim list
dim song
dim result
dim i
dim albumVolume
dim albumId
dim albumLength
dim level
dim length
dim form
dim btn1
dim btn2
dim btn3
dim btn4
Set list = SDB.CurrentSongList
Set albumVolume = CreateObject( "Scripting.Dictionary" )
Set albumLength = CreateObject( "Scripting.Dictionary" )
if list.Count = 0 then
set list = SDB.AllVisibleSongList
if list.Count = 0 then
SDB.MessageBox "No songs selected", mtError, Array(mbOK)
exit sub
end if
end if
Set Form = SDB.UI.NewForm
Form.Common.SetRect 100, 100, 400, 170
Form.BorderStyle = 3
Form.FormPosition = 4
Form.Caption = "Album Volume Leveler"
Set Btn1 = SDB.UI.NewButton(Form)
Btn1.Caption = "Analyze album volume and modify the MediaMonkey leveling field"
Btn1.Common.SetRect 10, 10, 370, 25
Btn1.ModalResult = 1
Btn1.Default = True
Set Btn2 = SDB.UI.NewButton(Form)
Btn2.Caption = "Restore the original MediaMonkey leveling field"
Btn2.Common.SetRect 10, 40, 370, 25
Btn2.ModalResult = 4
Set Btn3 = SDB.UI.NewButton(Form)
Btn3.Caption = "Reset the MediaMonkey leveling field"
Btn3.Common.SetRect 10, 70, 370, 25
Btn3.ModalResult = 3
Set Btn4 = SDB.UI.NewButton(Form)
Btn4.Caption = "Close without any modification"
Btn4.Common.SetRect 10, 100, 370, 25
Btn4.ModalResult = 2
Btn4.Cancel = true
result = Form.showModal
if result = 1 then
for i = 0 to list.Count - 1
set song = list.Item(i)
albumId = song.Album.ID
level = song.Leveling
length = song.SongLength
if level <> -999999 and albumId > 0 then
if albumVolume.exists( albumId ) then
albumVolume.Item( albumId ) = albumVolume.Item( albumId ) + level*length
albumLength.Item( albumId ) = albumLength.Item( albumId ) + length
else
albumVolume.add albumId, level*length
albumLength.add albumId, length
end if
end if
next
for i = 0 to list.Count - 1
set song = list.Item(i)
albumId = song.Album.ID
if albumId > 0 and albumVolume.exists( albumId ) then
song.Custom1 = song.Leveling
song.Leveling = albumVolume.Item(albumId)/albumLength.Item(albumId)
song.UpdateDB
end if
next
SDB.MessageBox "Volume level has been modified.", mtInformation, Array(mbOK)
end if
if result = 4 then
for i = 0 to list.Count - 1
set song = list.Item(i)
song.Leveling = song.Custom1
song.UpdateDB
next
SDB.MessageBox "Volume level has been restored.", mtInformation, Array(mbOK)
end if
if result = 3 then
for i = 0 to list.Count - 1
set song = list.Item(i)
song.Leveling = -999999
song.UpdateDB
next
SDB.MessageBox "Volume level has been reseted.", mtInformation, Array(mbOK)
end if
if result = 2 then
exit sub
end if
end sub

