Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Paste file
Hi guys,

Just wondering how do i paste a common file, say available in my documents folder into any network folder? Sorry for this newbie question, as I have been searching this for weeks. The s_getfile/getclip only copy the text file name and paste but not the file itself. :?

Thanks in advance.
Function FileToClipboard
Copy      Help
function! $fileList

;Stores file path to the clipboard in CF_HDROP clipboard format.
;Returns 1 if successful, 0 if not.

;fileList - file path, or several file paths in multiple lines.

;if(!FileToClipboard("$my qm$\x1.txt[]$my qm$\x2.txt")) end "failed"

str sf sfl
foreach sf fileList
,sfl.fromn(sfl sfl.len sf sf.len+2)

if(!OpenClipboard(0)) ret

int gh=GlobalAlloc(GMEM_MOVEABLE|GMEM_ZEROINIT sizeof(DROPFILES)+sfl.len+2)
DROPFILES* f=+GlobalLock(gh)
memcpy(f+sizeof(DROPFILES) sfl sfl.len)

int r=SetClipboardData(CF_HDROP gh)!0
ret r
Hi Giantaras,

thanks for the prompt reply, and I have tried on my notebook but nothing is happening. I have changed the foreach sf fileList to foreach sf "$my qm$\start.txt". Is there something that i did wrong?...Thanks again...
Don't edit it. Call FileToClipboard like in the EXAMPLE. It works like you would select the file in a folder window and press Ctrl+C. Then you can press Ctrl+V in another folder.
oh thanks!

Forum Jump:

Users browsing this thread: 1 Guest(s)