Posts: 9
Threads: 3
Joined: Jan 2008
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.
Posts: 12,074
Threads: 141
Joined: Dec 2002
Function
FileToClipboard
;/
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
Posts: 9
Threads: 3
Joined: Jan 2008
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...
Posts: 12,074
Threads: 141
Joined: Dec 2002
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.
Posts: 9
Threads: 3
Joined: Jan 2008