Difference between revisions of "ISDBDevice::CopyFile"

From MediaMonkey Wiki
Jump to: navigation, search
(Created page with "{{MethodDeclaration|SDBDevice|ISDBDevice|Sub CopyFile(DeviceHandle As Long, Source As String, Destination as String)}} ===Parameters=== {{MethodParameters |DeviceHandle |Long...")
Line 11: Line 11:
Copies file to device.
Copies file to device.

Latest revision as of 12:56, 31 March 2014

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