TeraCopy problem with integration into toolbar

Discuss and share scripts and script files...
Post Reply
selukwe
Posts: 55
Joined: 02 Apr 2012 14:10

TeraCopy problem with integration into toolbar

Post by selukwe » 08 Jun 2019 18:01

I'm successfully using the following script in a user-created single toolbar button for Copy and Move to other pane:

Code: Select all

"Copy to Other Pane"
 $list = eval('%appdata%')."\TeraCopy\FileList.dat";    
 $teracopy = '"...\TeraCopy\TeraCopy.exe"';  // added real path

 if(getinfo("FocusedControl") == "T"){
   $items="<focitem>";
   $selitems=1
 } else {
   focus l;
   $items=getinfo("SelectedItemsPathNames"); 
   $selitems=getinfo("CountSelected");
 } 

 if($selitems<1){
   status "Nothing selected!", , alert; 
   end 1;
 }

 $files = replace($items, "|", "<crlf>");
 writefile($list, $files);
 
 $copycmd = $teracopy.' copy *"'.$list.'" "<get path i>"';
 open $copycmd,w;

"Move to Other Pane"
 $list = eval('%appdata%')."\TeraCopy\FileList.dat";    
 $teracopy = '"...\TeraCopy\TeraCopy.exe"';

 if(getinfo("FocusedControl") == "T"){
   $items="<focitem>";
   $selitems=1
 } else {
   focus l;
   $items=getinfo("SelectedItemsPathNames"); 
   $selitems=getinfo("CountSelected");
 } 

 if($selitems<1){
   status "Nothing selected!", , alert; 
   end 1;
 }

 $files = replace($items, "|", "<crlf>");
 writefile($list, $files);
 
 $copycmd = $teracopy.' move *"'.$list.'" "<get path i>"';
 open $copycmd,w;
This works OK. But when I break this script into two, separating the Copy part from the Move part and create new separate toolbar buttons, then only the Copy button works OK. The Move button moves the selected files OK, but when moving folders it ends with an error:

Unable to access:
followed by the path of the moved folder.


Ultimately, also the folder gets moved OK, but not without this error.

Why is this so and how to correct the used script:

Code: Select all

"Move to Other Pane"
 $list = eval('%appdata%')."\TeraCopy\FileList.dat";    
 $teracopy = '"...\TeraCopy\TeraCopy.exe"';

 if(getinfo("FocusedControl") == "T"){
   $items="<focitem>";
   $selitems=1
 } else {
   focus l;
   $items=getinfo("SelectedItemsPathNames"); 
   $selitems=getinfo("CountSelected");
 } 

 if($selitems<1){
   status "Nothing selected!", , alert; 
   end 1;
 }

 $files = replace($items, "|", "<crlf>");
 writefile($list, $files);
 
 $copycmd = $teracopy.' move *"'.$list.'" "<get path i>"';
 open $copycmd,w;
Any advice would be most appreciated.

highend
Posts: 8157
Joined: 06 Feb 2011 00:33

Re: TeraCopy problem with integration into toolbar

Post by highend » 08 Jun 2019 21:47

Don't know how this should work at all because <get path i> is never resolved into a path at all.

Apart from that, you get the error when you do it (correctly) from the command line prompt,
in other words: It has nothing to do with XY scripting...
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

selukwe
Posts: 55
Joined: 02 Apr 2012 14:10

Re: TeraCopy problem with integration into toolbar

Post by selukwe » 13 Jun 2019 14:26

I found this script at the XYplorer's site and it works in a customized XYplorer's toolbar button perfectly. But once I "cut it in half" assigning Copy part and Move part to separate buttons, then only the Copy button works smoothly, the Move button ends with error.

Anyone having a clue what's wrong? Maybe it needs just a small tweak at the script's end to prevent the error...(-?)

Post Reply