From MediaMonkey Wiki
Revision as of 12:56, 31 March 2014 by Ludek (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

CoClass SDBDevice, Interface ISDBDevice

Sub CopyFile(DeviceHandle As Long, Source As String, Destination as String)


Name Type Description
DeviceHandle Long Handle of the device
Source String Source file path on PC
Destination String Destination file path on the device

Method description

Copies file to device.

Introduced in MediaMonkey version 4.1.1.


Option Explicit
Dim UI  : Set UI = SDB.UI
Sub OnStartUp()
    Dim mnuTest
    Set mnuTest = SDB.UI.AddMenuItem(SDB.UI.Menu_Edit, 0, 0)
    mnuTest.Caption = SDB.Localize("Copy file to iPhone")
    mnuTest.OnClickFunc = "SDBOnClick"
    mnuTest.UseScript = Script.ScriptPath
    Script.RegisterEvent SDB, "OnDeviceFileCopied", "SDBDeviceFileCopied"    
End Sub
Dim DeviceHandle : DeviceHandle = -1   
Sub SDBOnClick(Item)     
  Dim Devices : Set Devices = SDB.Device.ActiveDeviceList("VID_05AC&PID_129E")
  Dim i : i = 0 
  For i = 0 To Devices.Count-1
	   If Devices.DeviceHandle(i) <> -1 Then
		   DeviceHandle = Devices.DeviceHandle(i)
	   End If
  SDB.Device.CopyFile DeviceHandle, "C:\Temp\MyFile.wmv", "/Temp/MyFile.wmv"
End Sub

Sub SDBDeviceFileCopied( DeviceHandle, Src, Dest, Success)
    if Success then
      MsgBox("File copied successfuly from "&Src&" to "&Dest)
      MsgBox("File failed to copy from "&Src&" to "&Dest)
    end if    
End Sub