Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Paste file
#1
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.
#2
Function FileToClipboard
Code:
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.

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


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

if(!OpenClipboard(0)) ret
EmptyClipboard

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

int r=SetClipboardData(CF_HDROP gh)!0
CloseClipboard
ret r
#3
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...
#4
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.
#5
oh thanks!


Forum Jump:


Users browsing this thread: 1 Guest(s)