Если вручную можно скопировать-вставить, тогда проще всего так:
DropFiles(fileList, windowTitle) {
tempClipboard := ClipboardAll
Sleep, 50
ClipboardSetFiles(fileList)
WinActivate, % windowTitle
Send ^v
Sleep, 100
Clipboard := tempClipboard
}
ClipboardSetFiles(FilesToSet, DropEffect := "Copy") {
Static SizeT := A_IsUnicode ? 2 : 1 ; size of a TCHAR
Static PreferredDropEffect := DllCall("RegisterClipboardFormat", "Str", "Preferred DropEffect")
Static DropEffects := {1: 1, 2: 2, Copy: 1, Move: 2}
; -------------------------------------------------------------------------------------------------------------------
; Count files and total string length
TotalLength := 0
FileArray := []
Loop, Parse, FilesToSet, `n, `r
{
If (Length := StrLen(A_LoopField))
FileArray.Push({Path: A_LoopField, Len: Length + 1})
TotalLength += Length
}
FileCount := FileArray.Length()
If !(FileCount && TotalLength)
Return
; -------------------------------------------------------------------------------------------------------------------
; Add files to the clipboard
If DllCall("OpenClipboard", "Ptr", A_ScriptHwnd) && DllCall("EmptyClipboard") {
; hMem format ---------------------------------------------------------------------------------------------------
; 0x42 = GMEM_MOVEABLE (0x02) | GMEM_ZEROINIT (0x40)
hMem := DllCall("GlobalAlloc", "UInt", 0x42, "UInt", 20 + (TotalLength + FileCount + 1) * SizeT, "UPtr")
pMem := DllCall("GlobalLock", "Ptr", hMem)
Offset := 20
NumPut(Offset, pMem + 0, "UInt") ; DROPFILES.pFiles = offset of file list
NumPut(!!A_IsUnicode, pMem + 16, "UInt") ; DROPFILES.fWide = 0 --> ANSI, fWide = 1 --> Unicode
For Each, File In FileArray
Offset += StrPut(File.Path, pMem + Offset, File.Len) * SizeT
DllCall("GlobalUnlock", "Ptr", hMem)
DllCall("SetClipboardData", "UInt", 0x0F, "UPtr", hMem) ; 0x0F = CF_HDROP
; Preferred DropEffect format ------------------------------------------------------------------------------------
If (DropEffect := DropEffects[DropEffect]) {
hMem := DllCall("GlobalAlloc", "UInt", 0x42, "UInt", 4, "UPtr")
pMem := DllCall("GlobalLock", "Ptr", hMem)
NumPut(DropEffect, pMem + 0, "UChar")
DllCall("GlobalUnlock", "Ptr", hMem)
DllCall("SetClipboardData", "UInt", PreferredDropEffect, "Ptr", hMem)
}
DllCall("CloseClipboard")
}
Return
}
Но со скрытым окном вряд ли сработает.
Я бы использовал какую-нибудь AHK-библиотеку для работы с FTP.
Разработка AHK-скриптов:
e-mail
dfiveg@mail.ruTelegram
jollycoder