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

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.
  • Replies are listed 'Best First'.
    Re^14: Move/Copy files using Clipboard!
    by Ace128 (Hermit) on Oct 16, 2005 at 17:52 UTC
      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...