Page 3 of 16

Re: TeraCopy Integration

Posted: 16 Sep 2008 00:38
by Muroph
i put the script for xy 7.60.0010 on my previous post.

Re: TeraCopy Integration

Posted: 19 Sep 2008 14:15
by Muroph
script changed for XYplorer 7.60.0017

Cut

Code: Select all

//copy list of items to a variable
  $items = getinfo("SelectedItemsPathNames");
  //set list path
  $list = "<xypath>\teracopylist.tmp";
  //delete old list
  setkey avoid possible, error, message, "$list";
  delete 0,0, "$list";
  //save operation and list of items
  setkey move, teracopyop, tc, "$list";
  setkey "<crlf>$items", teracopylist, tc, "$list";
  status TeraCopy: Cut, 84C400, ready;
Copy

Code: Select all

//copy list of items to a variable
  $items = getinfo("SelectedItemsPathNames");
  //set list path
  $list = "<xypath>\teracopylist.tmp";
  //delete old list
  setkey avoid possible, error, message, "$list";
  delete 0,0, "$list";
  //save operation and list of items
  setkey copy, teracopyop, tc, "$list";
  setkey "<crlf>$items", teracopylist, tc, "$list";
  status TeraCopy: Copy, 84C400, ready;
Paste (same as previous version)

Code: Select all

//save current path. this will be the target folder
  set $path, "<curpath>";
  //restore operation type
  getkey $op, teracopyop, tc, "<xypath>\teracopylist.tmp";
  //run teracopy.exe using command line parameters
  //teracopy.exe [operation] *[list of source files] [target]
  run """%programfiles%\TeraCopy\teracopy.exe"" $op *""<xypath>\teracopylist.tmp"" ""$path\""";
  status TeraCopy: Paste, 84C400, ready;

Re: TeraCopy Integration

Posted: 17 Oct 2008 12:36
by kawds
I have placed all three scripts from the last post in seperate script files (tc_copy.xys, tc_cut.xys, tc_paste.xys) and loaded them via "Load Script File" but i still get the standard copy/move-operator.

All i did was changing the last script to:

Code: Select all

run """E:\_backup_\_profiles\TeraCopyPortable\teracopy.exe"" $op *""<xypath>\teracopylist.tmp"" ""$path\""";
BTW: I am using v7.70

Re: TeraCopy Integration

Posted: 17 Oct 2008 17:05
by kawds
Now i understood the integration with CTRL+X/C/V.

But if I cancel the file-transfer with TeraCopy the destination file is not deleted, so there is a broken file in the destination with a size smaller than the original.

Re: TeraCopy Integration

Posted: 17 Oct 2008 21:29
by Muroph
hmm...
i don't get any broken files here.
if a file is not completely copied/moved TC deletes it when the operation is canceled. :?

i'm running xy v7.70 too.

Re: TeraCopy Integration

Posted: 21 Oct 2008 18:37
by Muroph
TeraCopy Integration v5.0

EDIT: Updated "writefile" to v7.70.0007 syntax.

Needs XYplorer 7.70.0007 and TeraCopy 2.0b3 or later.

This is what i wanted from the begining.
The new script writes the items and the variables in separate files, fixing this bug.
And there's a bit more info on the statusbar message now.

Cut

Code: Select all

// save list of items
  writefile("<xypath>\teracopylist.tmp", getinfo("SelectedItemsPathNames"));
  // get number of items
  $num = getinfo("CountSelected");
  // save operation and $num
  setkey move, operation, tc, "<xypath>\teracopyvars.tmp";
  setkey $num, number, tc, "<xypath>\teracopyvars.tmp";
  // finished
  status "TeraCopy: Cut ($num item".(($num > 1)?"s":"").")", 78FF00, ready;
Copy

Code: Select all

// save list of items
  writefile("<xypath>\teracopylist.tmp", getinfo("SelectedItemsPathNames"));
  // get number of items
  $num = getinfo("CountSelected");
  // save operation and $num
  setkey copy, operation, tc, "<xypath>\teracopyvars.tmp";
  setkey $num, number, tc, "<xypath>\teracopyvars.tmp";
  // finished
  status "TeraCopy: Copy ($num item".(($num > 1)?"s":"").")", 78FF00, ready;
Paste

Code: Select all

//save current path. this will be the target folder
  set $path, "<curpath>";
  //get operation and number of items
  getkey $op, operation, tc, "<xypath>\teracopyvars.tmp";
  getkey $num, number, tc, "<xypath>\teracopyvars.tmp";
  //run teracopy.exe using command line parameters
  //teracopy.exe [operation] *[list of source files] [target]
  run """%programfiles%\TeraCopy\teracopy.exe"" $op *""<xypath>\teracopylist.tmp"" ""$path\""";
  status "TeraCopy: Paste ($num item".(($num > 1)?"s ":" ").(($op == copy)?"copied":"moved").")", 78FF00, ready;

Re: TeraCopy Integration

Posted: 22 Oct 2008 18:07
by admin
Muroph wrote:TeraCopy Integration v5.0...

Code: Select all

writefile("<xypath>\teracopylist.tmp", getinfo("SelectedItemsPathNames"), o, u);
In the upcoming version I add autodetection of ASCII/UNICODE for mode "t" so no need for "u" anymore which then will be called "tu". Since "t" and "o" are the defaults you can just leave out the arguments then:

Code: Select all

writefile("<xypath>\teracopylist.tmp", getinfo("SelectedItemsPathNames"));

Re: TeraCopy Integration

Posted: 24 Oct 2008 00:52
by lukescammell
Thanks for all the hard work on this - the latest version works just great for me now :) (and with those tweaks Don mentioned as well).

Now I wonder if it's possible to make it so that the script can automatically/silently fall back to standard Cut/Copy/Paste if TeraCopy is not found? This way we could just remap CTRL+X/C/V to these scripts instead of the defaults and not have to worry about a target computer having TC installed or not. Possible?

Re: TeraCopy Integration

Posted: 24 Oct 2008 22:01
by Muroph
updated for xy 7.70.07.
lukescammell wrote:Now I wonder if it's possible to make it so that the script can automatically/silently fall back to standard Cut/Copy/Paste if TeraCopy is not found? This way we could just remap CTRL+X/C/V to these scripts instead of the defaults and not have to worry about a target computer having TC installed or not. Possible?
hmm...
how can i check if a file exists without having to go to that file's path and without an error message if the file is not there?

Re: TeraCopy Integration

Posted: 25 Oct 2008 06:19
by serendipity
I use teracopy a lot because I handle some really huge files and thanks to Muroph for updating this script which I heavily use.
Now, regarding what lukescammell asked, I became curious and found a (not so elegant) way to check if teracopy exists.
How it works: It goes to "Program files" directory and copies the Teracopy path to clipboard, obviously if it doesnt exist then clipboard is empty. Later the script chooses what to do based on the clipboard content. I know its not that cool, but it works. :)

To be frank I wont use it myself because i know all my computers have Teracopy, but I have this on my USB.

CUT

Code: Select all

   set $curpath, <curpath>;
   $selected=getinfo("SelectedItemsPathNames", "|");
   replace $selected, $selected, "<curpath>\","";
   goto %programfiles%;
   filter "Teracopy";
   sel 1;
   focus;
   copytext <curitem>;
   filter;
   goto $curpath;
   filter "$selected";
   sel a;
   sub choose

"_choose : choose"
   set $clip, <clipboard>;
   $choose= $clip > 1 ? "teracopy" : "wincopy";
   sub "$choose";

"_Teracopy : teracopy"
  // save list of items
  writefile("<xypath>\teracopylist.tmp", getinfo("SelectedItemsPathNames"));
  // get number of items
  $num = getinfo("CountSelected");
  // save operation and $num
  setkey move, operation, tc, "<xypath>\teracopyvars.tmp";
  setkey $num, number, tc, "<xypath>\teracopyvars.tmp";
  // finished
  status "TeraCopy: Cut ($num item".(($num > 1)?"s":"").")", 0000FF, ready;
  filter

"_WindowCopy : wincopy"
   //Cut selected files;
   #200;
   filter 
COPY

Code: Select all

   set $curpath, <curpath>;
   $selected=getinfo("SelectedItemsPathNames", "|");
   replace $selected, $selected, "<curpath>\","";
   goto %programfiles%;
   filter "Teracopy";
   sel 1;
   focus;
   copytext <curitem>;
   filter;
   goto $curpath;
   filter "$selected";
   sel a;
   sub choose

"_choose : choose"
   set $clip, <clipboard>;
   $choose= $clip > 1 ? "teracopy" : "wincopy";
   sub "$choose";

"_Teracopy : teracopy"
  // save list of items
  writefile("<xypath>\teracopylist.tmp", getinfo("SelectedItemsPathNames"));
  // get number of items
  $num = getinfo("CountSelected");
  // save operation and $num
  setkey copy, operation, tc, "<xypath>\teracopyvars.tmp";
  setkey $num, number, tc, "<xypath>\teracopyvars.tmp";
  // finished
  status "TeraCopy: Copy ($num item".(($num > 1)?"s":"").")", 0000FF, ready;
  filter

"_WindowCopy : wincopy"
   //Copy selected files;
   #201;
   filter
PASTE

Code: Select all

   set $curpath, <curpath>;
   goto %programfiles%;
   filter "Teracopy";
   sel 1;
   focus;
   copytext <curitem>;
   filter;
   goto $curpath;
   sub choose

"_choose : choose"
   set $clip, <clipboard>;
   $choose= $clip > 1 ? "teracopy" : "wincopy";
   sub "$choose";

"_Teracopy : teracopy"
  //save current path. this will be the target folder
  set $path, "<curpath>";
  //get operation and number of items
  getkey $op, operation, tc, "<xypath>\teracopyvars.tmp";
  getkey $num, number, tc, "<xypath>\teracopyvars.tmp";
  //run teracopy.exe using command line parameters
  //teracopy.exe [operation] *[list of source files] [target]
  run """%programfiles%\TeraCopy\teracopy.exe"" $op *""<xypath>\teracopylist.tmp"" ""$path\""";
  status "TeraCopy: Paste ($num item".(($num > 1)?"s ":" ").(($op == copy)?"copied":"moved").")", 0000FF, ready;
  filter

"_WindowCopy : wincopy"
   //Paste files;
   #202;
   filter

Re: TeraCopy Integration

Posted: 25 Oct 2008 06:40
by Muroph
i just remembered that there's a free portable version of teracopy.
it shouldn't be hard to find.
i used it together with xy in my pendrive some time ago.
this way you can just change the script to use the portable exe and you'll *always* have tc installed.

Re: TeraCopy Integration

Posted: 12 Nov 2008 11:39
by JohnM
Hi all,

I've been playing about with these scripts, they are great. I have set them up as UDC->run script and given them the CKS Ctrl-X/Ctrl-C.

However, did I miss something or does the "cut" and "copy" scripts not work when used on a TV item (ie folder) as opposed to a LV item (file)? More specifically, it appears that getinfo("SelectedItemsPathNames") does not return anything if used on a folder in the tree view. Is this correct?

Keep up the good work!

Cheers
JohnM

Re: TeraCopy Integration

Posted: 25 Nov 2008 20:39
by Muroph
this is a modified version that works on the tree.
i don't like it because it uses the clipboard (the "normal" version doesn't), and i always use RMB drag-n-drop when using teracopy on the tree.
the normal version is here.

so, here's the mod:

Cut

Code: Select all

//copy list of items to a variable
  #101;
  $items = "<clipboard>";
  // save list of items
  writefile("<xypath>\teracopylist.tmp", $items);
  //save operation
  setkey move, teracopyop, tc, "<xypath>\teracopyvars.tmp";
  status TeraCopy: Cut, , ready;
Copy

Code: Select all

//copy list of items to a variable
  #101;
  $items = "<clipboard>";
  // save list of items
  writefile("<xypath>\teracopylist.tmp", $items);
  //save operation
  setkey copy, teracopyop, tc, "<xypath>\teracopyvars.tmp";
  status TeraCopy: Copy, , ready;
Paste

Code: Select all

//save current path. this will be the target folder
  $path = "<curpath>";
  //restore operation
  getkey $op, teracopyop, tc, "<xypath>\teracopyvars.tmp";
  //run teracopy.exe using command line parameters
  //teracopy.exe [operation] *[list of source files] [target]
  run """%programfiles%\TeraCopy\teracopy.exe"" $op *""<xypath>\teracopylist.tmp"" ""$path\""";
  status TeraCopy: Paste, , ready;

Re: TeraCopy Integration

Posted: 16 Jan 2009 17:50
by kartal
Hi

I am having problems with teracopy script in latest xyplorer(7.90.0050)

"getinfo" is not a valid command

Re: TeraCopy Integration

Posted: 19 Jan 2009 18:58
by Muroph
kartal wrote:I am having problems with teracopy script in latest xyplorer(7.90.0050)

"getinfo" is not a valid command
hmm...
i'm used the script just a few seconds ago on 7.90.0050 and it was normal.
no idea what it might be.
i'm currently using the script from this post.