Page 1 of 1

TeraCopy problem with integration into toolbar

Posted: 08 Jun 2019 18:01
by selukwe
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.

Re: TeraCopy problem with integration into toolbar

Posted: 08 Jun 2019 21:47
by highend
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...

Re: TeraCopy problem with integration into toolbar

Posted: 13 Jun 2019 14:26
by selukwe
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...(-?)