Hi,
how is it possible to copy selected tracks to another folder,drive etc.?
I am not talking about the auto organisation but about something, that i can use from within a script.
Thanks for your help
Begges
How to copy a track from a script?
Yes.
You can get the path to the song file from the SDBSongData's property Path.
Like (getting the path to the currently playing song):
Once you know the file name (path), you can do what you want using the "FileSystem Object (FSO)" (move, delete, copy, rename, ...).
Here's the FSO:
Then you can do e.g. (copy song to temporary location):
Cheers
Steegy
You can get the path to the song file from the SDBSongData's property Path.
Like (getting the path to the currently playing song):
Code: Select all
Dim FileName : FileName = SDB.Player.CurrentSong.PathHere's the FSO:
Code: Select all
Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject")Code: Select all
FSO.CopyFile(FileName, "C:\TempSong.dat", true)Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
-
DiddeLeeDoo
- Posts: 1017
- Joined: Wed Mar 01, 2006 1:09 am
- Location: In a jungle down under
- Contact:
Here's a little script example. Adds a copy icon to the standard toolbar and when you hit it the selected files get copied to the folder you choose in the dialog.
Not much error controls and stuff in this one, but may get you going.
Added, I pasted in a 'test code'..... put the right one in just now..
Not much error controls and stuff in this one, but may get you going.
Code: Select all
'----------------------------------------------------------------------
'\Program Files\MediaMonkey\Scripts\Auto\CopyFiles.vbs
' Version: 0.95
' Date: 5 September 2006
' By DiddeLeeDoo
'----------------------------------------------------------------------
Sub OnStartup
Set CFT=SDB.UI.AddMenuItem(SDB.UI.Menu_TbStandard, 0, 0)
CFT.Caption="Copy Files To"
CFT.IconIndex=9
CFT.UseScript=Script.ScriptPath
CFT.OnClickFunc="CopyFiles"
End Sub
Sub CopyFiles(o)
Set FSO=CreateObject("Scripting.FileSystemObject")
Set SHL=CreateObject("Shell.Application")
Set dbT=SDB.CurrentSongList
Set FLD=SHL.BrowseForFolder(0,"Destination:",0,"")
If Not FLD Is Nothing Then
For i = 0 To dbT.Count-1
Set Sng=dbT.Item(i)
CFr=Sng.Path
CTo=FLD.Self.Path & "\" & Right(CFr,Len(CFr)-InStrRev(CFr,"\"))
FSO.CopyFile CFr, CTo
Next
End If
End SubTHANKS!!
Thanks a lot for your help..........
at the end i am trying to get a "replace double tracks with empty mp3file same tags and a link that links to the now not double track"-script.
Sounds strange and i am also not sure if anyone will need it (except of me with my small harddrive......)
Begges
at the end i am trying to get a "replace double tracks with empty mp3file same tags and a link that links to the now not double track"-script.
Sounds strange and i am also not sure if anyone will need it (except of me with my small harddrive......)
Begges
