by Apopsis » Mon Oct 20, 2003 5:17 am
Help with a script needed !
I have no experience with visual basic
I want to make a simple script to copy the ''media'' field of every song
in the database (or selected songs) to the custom 1 field(s).
I take as a reference the ''SwapTitleArtist'' script, because it looks similar.
Added in the Scripts.ini file the lines :
[CopyMedia2custom1]
FileName=CopyMedia2custom1.vbs
ProcName=CopyMedia2custom1
Order=3
DisplayName=&Copy Media to custom 1
Description=Copy Media content to custom 1 field
Language=VBScript
ScriptType=0
After that, i modified the ''SwapTitleArtist.vbs''
and made the file ''CopyMedia2custom1.vbs'' in the scripts directory.
whith these lines inside :
' A simple script that copy the content of media field to custom 1 field of selected tracks
Sub CopyMedia2custom1
' Define variables
Dim list, itm, i, tmp
' Get list of selected tracks from MediaMonkey
Set list = SDB.SelectedSongList
If list.count=0 Then
Set list = SDB.AllVisibleSongList
End If
' Process all selected tracks
For i=0 To list.count-1
Set itm = list.Item(i)
' copy the fields
itm.Custom 1 = itm.Media
' Update the changes in DB
itm.UpdateDB
Next
End Sub
The script appear now in the scripts menu, but it give me some errors when i run it.
What is wrong ? Am i missing something ?
Thanks, (and sorry for my bad english !)
Help with a script needed !
I have no experience with visual basic
I want to make a simple script to copy the ''media'' field of every song
in the database (or selected songs) to the custom 1 field(s).
I take as a reference the ''SwapTitleArtist'' script, because it looks similar.
Added in the Scripts.ini file the lines :
[color=red][CopyMedia2custom1]
FileName=CopyMedia2custom1.vbs
ProcName=CopyMedia2custom1
Order=3
DisplayName=&Copy Media to custom 1
Description=Copy Media content to custom 1 field
Language=VBScript
ScriptType=0[/color]
After that, i modified the ''SwapTitleArtist.vbs''
and made the file ''CopyMedia2custom1.vbs'' in the scripts directory.
whith these lines inside :
[color=red]' A simple script that copy the content of media field to custom 1 field of selected tracks
Sub CopyMedia2custom1
' Define variables
Dim list, itm, i, tmp
' Get list of selected tracks from MediaMonkey
Set list = SDB.SelectedSongList
If list.count=0 Then
Set list = SDB.AllVisibleSongList
End If
' Process all selected tracks
For i=0 To list.count-1
Set itm = list.Item(i)
' copy the fields
itm.Custom 1 = itm.Media
' Update the changes in DB
itm.UpdateDB
Next
End Sub[/color]
The script appear now in the scripts menu, but it give me some errors when i run it.
What is wrong ? Am i missing something ?
Thanks, (and sorry for my bad english !)