in reply to Re^11: Move/Copy files using Clipboard!
in thread Move/Copy files using Clipboard!

Alrighty! Check this out:
C:\Clipboard\Win32-Clipboard-0.52>perl Makefile.PL + Writing Makefile for Win32::Clipboard + + C:\Clipboard\Win32-Clipboard-0.52>nmake + + Microsoft (R) Program Maintenance Utility Version 1.50 + Copyright (c) Microsoft Corp 1988-94. All rights reserved. + + cp Clipboard.pm blib\lib\Win32\Clipboard.pm + C:\Perl\bin\perl.exe -IC:\Perl\lib -IC:\Perl\lib C:\Perl\lib\E +xtUtils/xs ubpp -typemap C:\Perl\lib\ExtUtils\typemap Clipboard.xs >xstmp.c && C +:\Perl\bin \perl.exe -MExtUtils::Command -e mv xstmp.c Clipboard.cpp + cl -c -nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSO +LE -DNO_ST RICT -DHAVE_DES_FCRYPT -DBUILT_BY_ACTIVESTATE -DNO_HASH_SEED -DUSE_SIT +ECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCR +T_READFIX -MD -Zi -DNDEBUG -O1 -DVERSION=\"0.52\" -DXS_VERSION=\"0.52\" "-I +C:\Perl\li b\CORE" Clipboard.cpp + Clipboard.cpp + Clipboard.xs(470) : warning C4018: '<' : signed/unsigned mismatch + Clipboard.xs(539) : warning C4018: '<' : signed/unsigned mismatch + Running Mkbootstrap for Win32::Clipboard () + C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 644 Clipboar +d.bs C:\Perl\bin\perl.exe -MExtUtils::Mksymlists -e "Mksymlists('N +AME'=>\"Wi n32::Clipboard\", 'DLBASE' => 'Clipboard', 'DL_FUNCS' => { }, 'FUNCLI +ST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);" + link -out:blib\arch\auto\Win32\Clipboard\Clipboard.dll -dll -n +ologo -nod efaultlib -debug -opt:ref,icf -libpath:"C:\Perl\lib\CORE" -machine:x +86 Clipboa rd.obj C:\Perl\lib\CORE\perl58.lib "C:\Program\Microsoft Visual Stud +io\VC98\li b\user32.lib" "C:\Program\Microsoft Visual Studio\VC98\lib\oldnames.li +b" "C:\Pro gram\Microsoft Visual Studio\VC98\lib\kernel32.lib" "C:\Program\Micros +oft Visual Studio\VC98\lib\user32.lib" "C:\Program\Microsoft Visual Studio\VC98\ +lib\gdi32. lib" "C:\Program\Microsoft Visual Studio\VC98\lib\winspool.lib" "C:\Pr +ogram\Micr osoft Visual Studio\VC98\lib\comdlg32.lib" "C:\Program\Microsoft Visua +l Studio\V C98\lib\advapi32.lib" "C:\Program\Microsoft Visual Studio\VC98\lib\she +ll32.lib" "C:\Program\Microsoft Visual Studio\VC98\lib\ole32.lib" "C:\Program\Mi +crosoft Vi sual Studio\VC98\lib\oleaut32.lib" "C:\Program\Microsoft Visual Studio +\VC98\lib\ netapi32.lib" "C:\Program\Microsoft Visual Studio\VC98\lib\uuid.lib" " +C:\Program \Microsoft Visual Studio\VC98\lib\ws2_32.lib" "C:\Program\Microsoft Vi +sual Studi o\VC98\lib\mpr.lib" "C:\Program\Microsoft Visual Studio\VC98\lib\winmm +.lib" "C:\ Program\Microsoft Visual Studio\VC98\lib\version.lib" "C:\Program\Micr +osoft Visu al Studio\VC98\lib\odbc32.lib" "C:\Program\Microsoft Visual Studio\VC9 +8\lib\odbc cp32.lib" "C:\Program\Microsoft Visual Studio\VC98\lib\msvcrt.lib" -de +f:Clipboar d.def + Creating library blib\arch\auto\Win32\Clipboard\Clipboard.lib and o +bject blib \arch\auto\Win32\Clipboard\Clipboard.exp + C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 755 blib\arc +h\auto\Win 32\Clipboard\Clipboard.dll + C:\Perl\bin\perl.exe -MExtUtils::Command -e cp Clipboard.bs bl +ib\arch\au to\Win32\Clipboard\Clipboard.bs + C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 644 blib\arc +h\auto\Win 32\Clipboard\Clipboard.bs + + C:\Clipboard\Win32-Clipboard-0.52>nmake test + + Microsoft (R) Program Maintenance Utility Version 1.50 + Copyright (c) Microsoft Corp 1988-94. All rights reserved. + + C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harn +ess(0, 'bl ib\lib', 'blib\arch')" t\test.t + t\test....ok + All tests successful. + Files=1, Tests=9, 0 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 C +PU)
Now, this is what I find cool! :)

Replies are listed 'Best First'.
Re^13: Move/Copy files using Clipboard!
by BrowserUk (Patriarch) on Oct 16, 2005 at 13:19 UTC

    Okay.

  • First you need the patching program. Download this zip of unix tools for win32. unizip them in to a subdirectory and add that directory to your system path.
  • Then download the patch. Click here, select the whole page, and past it into notepad or your favorite text editor (not WORD!!)

    At this point, you may need to edit 10 lines of the patch file manually :(

    When I just c&p'd the patch from the link above, every line that should look like these

    --- Win32-Clipboard-0.52\Clipboard.pm Fri Sep 10 16:05:35 2004 +++ Win32-Clipboard-0.53-saved\Clipboard.pm Fri Oct 14 07:01:43 200 +5

    Looked like these (note the missing whitespace between the filename and the date!)

    --- Win32-Clipboard-0.52\Clipboard.pmFri Sep 10 16:05:35 2004 +++ Win32-Clipboard-0.53-saved\Clipboard.pmFri Oct 14 07:01:43 2005

    So, check these after you paste and if the whitespace is missing insert a space or tab after the filename and before the date. Check all 10 lines (in five groups of 2).

    I'm not sure what PM is doing with these line that causes this?

    Then save it as C:\Clipboard\Win32-Clipboard-0.52\53.patch.

  • Then do the patching by running the command: patch -p 1 -i 53.patch
    Win32-Clipboard-0.53>patch -p 1 -i 53.patch patching file `Clipboard.pm' patching file `Clipboard.xs' patching file `Makefile' Hunk #2 succeeded at 239 (offset -6 lines). Hunk #3 FAILED at 490. Hunk #4 FAILED at 812. 2 out of 4 hunks FAILED -- saving rejects to Makefile.rej patching file `META.yml' patching file `t\test.t'

    Ignore the "Hunk#3 FAILED at 490" and "Hunk #4 FAILED at 812", they are not critical to your installation. (I don't understand why they fail at this point, the patch seems to correspond to the file perfectly, but patch doesn't give any useful reasons).

    Final step. Re-build the package using nmake test. The last couple of lines of output should read:

    ... All tests successful. Files=1, Tests=10, 1 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 +CPU)

    The number of tests has gone from 9 to 10 and your ready to install it using nmake install

    Assuming no errors, you should be able to type:

    perl -MWin32::Clipboard -wle" print $Win32::Clipboard::VERSION" 0.53

    And you are ready to try it. Run a script like this:

    #! perl -w use strict; use Win32::Clipboard; my $clip = Win32::Clipboard(); ## If you use double quotes, double your backslashes \\. ## Don't use forward slashes as Exploerer won't like em. $clip->SetFiles( 'c:\Clipboard\Win32-Clipboard-0.53\53.patch' );

    Then go to the explorer and paste into wherever you want the file copied.

    Note that you can place as many files into the clipboard as you want copied; the paths must be fully qualified; when you paste in explorer, the file is always copied, even if you hold the control key--I haven't worked out how to make it move (yet).


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
      Ok, runing that and pasting works! However, I had this error:
      C:\Clipboard\Win32-Clipboard-0.52>patch.exe -p 1 -i 53.patch patching file `Clipboard.pm' patching file `Clipboard.xs' patching file `Makefile' Hunk #2 succeeded at 239 (offset -6 lines). Hunk #3 FAILED at 490. Hunk #4 FAILED at 812. 2 out of 4 hunks FAILED -- saving rejects to Makefile.rej patching file `META.yml' patching file `t\test.t' patch unexpectedly ends in middle of line patch: **** malformed patch at line 218:
      But, that just affected the test, so not that big of a deal...

      Now, a few things needs to be done in C :)
      • Making move work
      • Making copy/move work and not ask for overwrite, but save as "Copy of 53.patch"


      Nice that:
      my @files = ('c:\Clipboard\Win32-Clipboard-0.52\53.patch', 'c:\Clipboa +rd\Win32-Clipboard-0.52\Clipboard.bs'); $clip->SetFiles( @files );
      works! :)

      I can also point out that it would be possible to do this with Win32::API. You have to deepdive into http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_programming/transferring/clipboard.asp and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/dragqueryfile.asp and use that with http://perlmonks.com/?node_id=386530 . But, I guess you have to dive to MSDN aswell doing it the .xs (C) way, but here you have to do C code...