TeraCopy Integration

Discuss and share scripts and script files...
Post Reply
Muroph
Posts: 561
Joined: 21 Aug 2007 16:13

TeraCopy Integration

Post by Muroph »

With these scripts you can use Teracopy from XYplorer without having to drag and drop.
To use it, select some items and load the script file to get a menu, or use the commands directly with the labels at the end of the post.
Since v6.8 you can also use other copy handlers that support command line parameters.

Current version: 7.4
Get the latest version in this post
You need at least XYplorer v8.40.0115 and Teracopy v2.0beta3.

Guide to integrate the script in XYplorer (written by fishgod)

Features:
*Move/copy tags along with the items.
Tags inside folders are processed as well.
-3 different paste modes:
---Normal: Tags are always processed. (Label = paste)
---XYplorer style: Tags are moved, but not copied. (Label = _pastexy)
---No tags: Tags are not changed at all. (Label = _pastenotags)
*Support Move/Copy to... operations
*Item collection (inspired by serendipity's script)
*Automatically fall back to normal copy if TeraCopy is not found.
*Custom command lines
Support for other programs besides TeraCopy.
*Easy script configuration using an HTML dialog.

Read before using!
Note 1: You might have to manually select the path to teracopy.exe, especially if you're using a 64bit OS.
To do this just load the script file and click on "Configure Script" in the menu that pops up.

Note 2: Tags won't be changed if the source and target paths are the same.
There are two reasons for that:
1. In a copy operation the items would be renamed, preventing the script from tagging the new items correctly.
2. In a move operation, tags wouldn't be changed anyway.

Note 3: Look out for paths and names conflicts when using the collection.

Labels for normal commands: cut, copy, paste, _pastexy, _pastenotags, moveto, copyto, restore and configure.
Labels for the collection: addcollection, movecollection, copycollection, testcollection, editcollection, clearcollection.
Last edited by Muroph on 03 May 2013 23:06, edited 8 times in total.

admin
Site Admin
Posts: 60289
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: TeraCopy Integration

Post by admin »

Muroph wrote:PS: I don't know if I did something wrong, but I couldn't use 'set $op, <curbase>' and 'set $list, <curitem>'.
The <cur...> variables refer to the current item. In typical usage this is the item that you select by clicking on it with the mouse or by arrow keys; it is always the item that is currently shown on Info Panel and Status Bar, and most of the times it is identical to the item that is focused and selected.

In scripting, the sel command with a numerical position argument will set a new current item, e.g. sel 1.

Muroph
Posts: 561
Joined: 21 Aug 2007 16:13

Re: TeraCopy Integration

Post by Muroph »

admin wrote:In scripting, the sel command with a numerical position argument will set a new current item, e.g. sel 1.
Stupid mistake...
Thanks.

I updated the script.
Now the paste operation won't use the clipboard.

serendipity
Posts: 3358
Joined: 07 May 2007 18:14
Location: NJ/NY

Post by serendipity »

Thanks for the script, I have just started to use Teracopy portable but have not tried huge multiple copy-paste operations.

Anyway, i think since v7.10.0021, 27-may-2008:
"autosynctree 0;" became "setting autosynctree, 0; "

Update:
Just tried it, works great. Thanks!! :D

I modified it a bit to use from Catalog, made a teracopy.xys inside XY's scripts folder and copy pasted below script and included "::loadscriptfile Scripts\teracopy.xys" in catalog:

Code: Select all

"Cut : cut" 
  setting autosynctree, 0; 
  //remember path 
  set $path, <curpath>; 
  //focus list items
  #1016;
  //copy list of items to clipboard 
  #101; 
  //go to the folder used for the list of sources 
  goto "<xypath>\scripts\teracopy\"; 
  //delete all files in the folder 
  //this prevents conflicts with the temp file from previous operations 
  sel a; 
  #1054; 
  //paste the items list into a new txt file 
  #219; 
  //save operation type 
  rename ,move; 
  //go back to the original location 
  goto $path; 
  setting autosynctree, 1 


"Copy : copy"
  setting autosynctree, 0; 
  //remember path 
  set $path, <curpath>;
  //focus list items
  #1016; 
  //copy list of items to clipboard 
  #101; 
  //go to the folder used for the list of sources 
  goto "<xypath>\scripts\teracopy\"; 
  //delete all files in the folder 
  //this prevents conflicts with the temp file from previous operations 
  sel a; 
  #1054; 
  //paste the items list into a new txt file 
  #219; 
  //save type operation type 
  rename ,copy; 
  //go back to the original location 
  goto $path; 
  setting autosynctree, 1 


"Paste : paste"
  setting autosynctree, 0; 
  //remember current path. this will be the target folder 
  set $path, <curpath>;
  //focus list items 
  #1016;
  //go to the folder used for the list of sources 
  goto "<xypath>\scripts\teracopy\"; 
  //set the $op variable to the type of operation to be performed 
  //i use the file name to remember if its a copy or move operation 
  sel 1; 
  set $op, <curbase>; 
  //copy the list path\name to the $list variable 
  set $list, <curitem>; 
  //run teracopy.exe using command line parameters 
  //teracopy.exe [operation] *[list of source files] [target] 
  run ""%programfiles%\TeraCopy\teracopy.exe" $op *"$list" "$path\""; 
  //go back to the target folder 
  goto $path; 
  setting autosynctree, 1 

Last edited by serendipity on 16 Jun 2008 19:45, edited 1 time in total.

Muroph
Posts: 561
Joined: 21 Aug 2007 16:13

Post by Muroph »

serendipity wrote: Anyway, i think since v7.10.0021, 27-may-2008:
"autosynctree 0;" became "setting autosynctree, 0; "
i'm using v7.10.0020.
this is the latest version i have where the mouse wheel works on the catalog.

i'll update the post.
thx.

serendipity
Posts: 3358
Joined: 07 May 2007 18:14
Location: NJ/NY

Post by serendipity »

Muroph wrote:
serendipity wrote: Anyway, i think since v7.10.0021, 27-may-2008:
"autosynctree 0;" became "setting autosynctree, 0; "
i'm using v7.10.0020.
this is the latest version i have where the mouse wheel works on the catalog.

i'll update the post.
thx.
Oh yes, I forgot about your wheel problem. Nice script though, you should tell teracopy guys about it.

Muroph
Posts: 561
Joined: 21 Aug 2007 16:13

Post by Muroph »

I was bored this morning and started messing with some script commands to see how they worked.
When got to setkey and getkey I thought:
'What if I could save variables in the ini file?'

Here is the answer.
TeraCopy Integration v2.0.

It's faster (no delay when pasting) and doesn't mess with your history, but it leaves a file in your temp folder (which you clean regularly, so there's no problem, right?).

I've tested many times, and found only one problem.
When XY saves your settings, any invalid keys in the ini file are deleted.
This means you can't paste after saving your settings, or paste something you copied in another session (you can do both in v1.0).

EDIT:
I've found a real problem.
You can't use them to copy files in read-only drives (cd, dvd, etc.) since the script can't create the file with the items list.
Use v1.0 in this case (this is what I'm doing).
I'll try to fix it if I get the chance.

You need at least XYplorer 7.20.0015 and Teracopy v2.0 beta3.

Copy

Code: Select all

//save current date/time
 set $list, teracopylist_<date yyyymmdd_hhnnss>;
 //copy list of items to clipboard
 #101;
 //paste the list into a new txt file
 #219;
 //rename list using cur. date/time
 rename ,"$list";
 //move list to your user temp folder
 moveto "%temp%";
 //save operation and list name in the ini file
 SetKey copy, teracopyop, general;
 SetKey %temp%\$list.txt, teracopylist, general;
Cut

Code: Select all

//save current date/time
 set $list, teracopylist_<date yyyymmdd_hhnnss>;
 //copy list of items to clipboard
 #101;
 //paste the list into a new txt file
 #219;
 //rename list using cur. date/time
 rename ,"$list";
 //move list to your user temp folder
 moveto "%temp%";
 //save operation and list name in the ini file
 SetKey move, teracopyop, general;
 SetKey %temp%\$list.txt, teracopylist, general;
Paste
Change TeraCopy installation folder if necessary.

Code: Select all

//save current path. this will be the target folder
 set $path, <curpath>;
 //restore operation and list from the ini file
 getkey $op, teracopyop, general;
 getkey $list, teracopylist, general;
 //run teracopy.exe using command line parameters
 //teracopy.exe [operation] *[list of source files] [target]
 run ""%programfiles%\TeraCopy\teracopy.exe" $op *"$list" "$path\"";
Last edited by Muroph on 28 Jun 2008 02:03, edited 1 time in total.

admin
Site Admin
Posts: 60289
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

Muroph wrote:I was bored this morning and started messing with some script commands to see how they worked.
When got to setkey and getkey I thought:
'What if I could save variables in the ini file?'
WOW, what a stroke of genius!! :shock: :D I never thought of writing and reading custom keys! Of course, I could easily add another argument to the command to specify a custom INI filename... just say "Do it!"... :)

I don't use TeraCopy myself but TeraCopy Integration v2.0 looks like something real cute!

Muroph
Posts: 561
Joined: 21 Aug 2007 16:13

Post by Muroph »

admin wrote:Of course, I could easily add another argument to the command to specify a custom INI filename... just say "Do it!"... :)
that'd be nice!
i remember i asked about something like that before and i was told it was planned for the future.
you said it's easy, so the sooner the better.

Muroph
Posts: 561
Joined: 21 Aug 2007 16:13

Post by Muroph »

EDIT: Updated again.

Here's TeraCopy Integration v3.2.

You need at least XYplorer 7.20.0027 and Teracopy v2.0 beta3.

Using custom ini files makes it REALLY fast.
You won't even see it running if you're not looking at the status bar.
And read-only drives are not a problem anymore.
The temp file is still there, but I can't make the script work without it (at least not yet).

Cut

Code: Select all

//copy items to clipboard and save in a variable
 #101;
 set $items, <clipboard>;
 //save temp ini path
 set $list, %temp%\teracopylist_<date yyyymmdd_hhnnss>.tmp;
 //save operation and list path in the ini file
 SetKey move, teracopyop, tc, variables.ini;
 setkey $list, teracopylist, tc, variables.ini;
 //save list in the temp ini
 setkey <crlf>$items, teracopylist, tc, $list;
 status TeraCopy: Cut, , ready;
Copy

Code: Select all

//copy list of items to clipboard and save in a variable
 #101;
 set $items, <clipboard>;
 //save temp ini path
 set $list, %temp%\teracopylist_<date yyyymmdd_hhnnss>.tmp;
 //save operation and list path in the ini file
 SetKey copy, teracopyop, tc, variables.ini;
 setkey $list, teracopylist, tc, variables.ini;
 //save list in the temp ini
 setkey <crlf>$items, teracopylist, tc, $list;
 status TeraCopy: Copy, , ready;
Paste
Change TeraCopy installation folder if necessary.

Code: Select all

//save current path. this will be the target folder
 set $path, <curpath>;
 //restore operation type and temp file path
 getkey $op, teracopyop, tc, variables.ini;
 getkey $list, teracopylist, tc, variables.ini;
 //run teracopy.exe using command line parameters
 //teracopy.exe [operation] *[list of source files] [target]
 run ""%programfiles%\TeraCopy\teracopy.exe" $op *"$list" "$path\"";
 status TeraCopy: Paste, , ready;
Last edited by Muroph on 30 Jun 2008 19:45, edited 2 times in total.
My shared scripts:
TeraCopy Integration, Tag Manager, Comments Menu, Text Replacer, Image and Media Tools, Checksum Calculator, Video Calculator
only 5 URLs are allowed on the sig...

admin
Site Admin
Posts: 60289
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

I don't have teracopy (I guess I should...), but merely looking over your brilliant script, I saw this:

Code: Select all

//this will make the list work with the ini file format 
 copytext <br>; 
 set $lb, <clipboard>; 
I think you could simply use the pretty new constant <crlf> to achieve the same.
Muroph wrote:PS: In v2 I used 'SetKey %temp%\$list.txt, teracopylist, general'.
In v3 I tried 'setkey $lb$items, teracopylist, tc, %temp%\$list.tmp' but it didn't work.
$list value is pretty much the same in both cases.
Quotes didn't help no matter where I put them.
What did I do wrong?
Hmm, not sure what line you mean. Is %temp%\$list.tmp is supposed to be the name of the INI file?? It should work if that's a valid and writable path (which you can check in Step mode). But you used set $list, %temp%\; before?? Then it cannot work, of course...

Muroph
Posts: 561
Joined: 21 Aug 2007 16:13

Post by Muroph »

admin wrote:I don't have teracopy (I guess I should...), but merely looking over your brilliant script, I saw this:

Code: Select all

//this will make the list work with the ini file format 
 copytext <br>; 
 set $lb, <clipboard>; 
I think you could simply use the pretty new constant <crlf> to achieve the same.
yeah, it works. thx.
i'll update.
but i can't find it on the wiki.
admin wrote:
Muroph wrote:PS: In v2 I used 'SetKey %temp%\$list.txt, teracopylist, general'.
In v3 I tried 'setkey $lb$items, teracopylist, tc, %temp%\$list.tmp' but it didn't work.
$list value is pretty much the same in both cases.
Quotes didn't help no matter where I put them.
What did I do wrong?
Hmm, not sure what line you mean. Is %temp%\$list.tmp is supposed to be the name of the INI file?? It should work if that's a valid and writable path (which you can check in Step mode). But you used set $list, %temp%\; before?? Then it cannot work, of course...
i used 'set $list, teracopylist_<date yyyymmdd_hhnnss>' and '%temp%\$list.ext' in both cases.
this should give a valid path, but it didn't work in v3.
only the %temp% part appeared in step mode.
so i changed to 'set $list, %temp%\' and 'addstr $list, teracopylist_<date yyyymmdd_hhnnss>', and put only the variable $list in the setkey command.
by the way, i think using 'set $list, %temp%\teracopylist_<date yyyymmdd_hhnnss> should give the same value, but, again, only the %temp% part works.
is it because of the '\'?
My shared scripts:
TeraCopy Integration, Tag Manager, Comments Menu, Text Replacer, Image and Media Tools, Checksum Calculator, Video Calculator
only 5 URLs are allowed on the sig...

admin
Site Admin
Posts: 60289
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

Muroph wrote:i used 'set $list, teracopylist_<date yyyymmdd_hhnnss>' and '%temp%\$list.ext' in both cases.
this should give a valid path, but it didn't work in v3.
only the %temp% part appeared in step mode.
so i changed to 'set $list, %temp%\' and 'addstr $list, teracopylist_<date yyyymmdd_hhnnss>', and put only the variable $list in the setkey command.
by the way, i think using 'set $list, %temp%\teracopylist_<date yyyymmdd_hhnnss> should give the same value, but, again, only the %temp% part works.
is it because of the '\'?
Confirmed. Will check after football... :wink:

admin
Site Admin
Posts: 60289
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

admin wrote:
Muroph wrote:i used 'set $list, teracopylist_<date yyyymmdd_hhnnss>' and '%temp%\$list.ext' in both cases.
this should give a valid path, but it didn't work in v3.
only the %temp% part appeared in step mode.
so i changed to 'set $list, %temp%\' and 'addstr $list, teracopylist_<date yyyymmdd_hhnnss>', and put only the variable $list in the setkey command.
by the way, i think using 'set $list, %temp%\teracopylist_<date yyyymmdd_hhnnss> should give the same value, but, again, only the %temp% part works.
is it because of the '\'?
Confirmed. Will check after football... :wink:
Okay, it was not the "", it was a bug! :) If the %TEMP% path was returned in short path (8.3) form by the system (XP does this), then one of my functions only returned the part that exists! But your call was before that temp file came to existence, so the file was cropped. Well, it's fixed now! Good find!

Muroph
Posts: 561
Joined: 21 Aug 2007 16:13

Post by Muroph »

Updated to v3.2 after the %temp% bug fix.
My shared scripts:
TeraCopy Integration, Tag Manager, Comments Menu, Text Replacer, Image and Media Tools, Checksum Calculator, Video Calculator
only 5 URLs are allowed on the sig...

Post Reply