Page 1 of 1

trying to add scripts to MM error 13

Posted: Thu Feb 14, 2008 2:09 pm
by duckcubbie
I am trying to add Tempo.vbs to my scripts.ini file.

[Tempo]
FileName=Tempo.vbs
ProcName=Tempo
Order=50
DisplayName=Tempo...
Description=adds tempo to songs
Language=VBScript
ScriptType=0


This shows up in the Scripts in MM so I chose "Tempo" and it gives me an error:
error #13 Microsoft VBScript Runtime error, Type Mismatch 'Tempo'

I added it in the .ini file the way the other scripts are and they run fine.
HELP please.

Posted: Thu Feb 14, 2008 4:47 pm
by Steegy
Is there a procedure "Tempo" in your script? It should be as you specified this using ProcName (as starting point of your script).

where would i put ProcName

Posted: Thu Feb 14, 2008 9:06 pm
by duckcubbie
where would i put the ProcName in the script:

Sub OnStartup
Dim Song
' Set Tempo for non-podcasts, where BPM is known and the Tempo has not already been set.
SDB.Database.BeginTransaction
Dim SongIter : Set SongIter = SDB.Database.QuerySongs("")
Do While Not SongIter.EOF
Set Song = SongIter.Item
if UCase(Song.Genre) <> UCase("Podcast") And UCase(Song.Tempo) = UCase("None") or Song.Tempo = "" And Song.BPM >= 0 Then
if Song.BPM <= 56 then
Song.Tempo = "Very Slow"
elseif Song.BPM <= 82 then
Song.Tempo = "Slow"
elseif Song.BPM <= 145 then
Song.Tempo = "Moderate"
elseif Song.BPM <= 200 then
Song.Tempo = "Fast"
Else
Song.Tempo = "Very Fast"
end if
Song.UpdateDB
Song.WriteTags
end if
SongIter.Next
Loop
Set SongIter = Nothing
SDB.Database.Commit
end sub

Re: where would i put ProcName

Posted: Thu Feb 14, 2008 10:30 pm
by Teknojnky
duckcubbie wrote:where would i put the ProcName in the script:

Code: Select all

Sub Tempo 
   Dim Song 
   ' Set Tempo for non-podcasts, where BPM is known and the Tempo has not already been set. 
   SDB.Database.BeginTransaction 
   Dim SongIter : Set SongIter = SDB.Database.QuerySongs("") 
   Do While Not SongIter.EOF 
      Set Song = SongIter.Item 
      if UCase(Song.Genre) <> UCase("Podcast") And UCase(Song.Tempo) = UCase("None") or Song.Tempo = "" And Song.BPM >= 0 Then 
         if Song.BPM <= 56 then 
            Song.Tempo = "Very Slow" 
         elseif Song.BPM <= 82 then 
            Song.Tempo = "Slow" 
         elseif Song.BPM <= 145 then 
            Song.Tempo = "Moderate" 
         elseif Song.BPM <= 200 then 
            Song.Tempo = "Fast" 
         Else 
            Song.Tempo = "Very Fast" 
         end if 
         Song.UpdateDB 
         Song.WriteTags 
      end if 
      SongIter.Next 
   Loop 
   Set SongIter = Nothing 
   SDB.Database.Commit 
end sub
instead of using onstartup you want to use whatever proc name that you want to put in the scripts ini file.

YEAH !!!!!!!

Posted: Thu Feb 14, 2008 10:38 pm
by duckcubbie
Got it thank you mates for replying. I will get the hang of this scripts thing yet !

:D

Sub SetTempo
Dim Song
' Set Tempo for non-podcasts, where BPM is known and the Tempo has not already been set.
SDB.Database.BeginTransaction
Dim SongIter : Set SongIter = SDB.Database.QuerySongs("")
Do While Not SongIter.EOF
Set Song = SongIter.Item
if UCase(Song.Genre) <> UCase("Podcast") And UCase(Song.Tempo) = UCase("None") or Song.Tempo = "" And Song.BPM >= 0 Then
if Song.BPM <= 56 then
Song.Tempo = "Very Slow"
elseif Song.BPM <= 82 then
Song.Tempo = "Slow"
elseif Song.BPM <= 145 then
Song.Tempo = "Moderate"
elseif Song.BPM <= 200 then
Song.Tempo = "Fast"
Else
Song.Tempo = "Very Fast"
end if
Song.UpdateDB
Song.WriteTags
end if
SongIter.Next
Loop
Set SongIter = Nothing
SDB.Database.Commit
end sub