Move Selected Files from Inactive Pane to Active.

Discuss and share scripts and script files...
Post Reply
SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Move Selected Files from Inactive Pane to Active.

Post by SkyFrontier »

Code: Select all

//Files to be moved must be on inactive pane, selected.
//The active pane is the target folder.

//target folder path:
   $targets = "<curpath>", "|";

   //get selected item(s) on inactive pane:
   focus "pi";
   $source = getinfo("SelectedItemsPathNames", "|"); //"<curitem>";

   //act on target folder:
   $Loop=1;
   while(1){
      $target = gettoken($targets, $Loop, "|");
      if ($target==""){break;}

      //copy source to current selected target:
      //copyto location, source
      moveto $target, $source;

   incr $Loop;
   }

   focus "pi";
//   goto gettoken($targets, 1, "|");
   status "Files moved. Thanks!"
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

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

Re: Move Selected Files from Inactive Pane to Active.

Post by admin »

Why change focus? Ever heard of listpane? :roll:

And ever heard of this (v9.70.0004 - 2010-11-09 13:27):

Code: Select all

    + Also the following variables now support the optional "pane" 
      argument (syntax see above):
        <get countitems [pane]>
        <get focusedpos [pane]>
        <get countselected [pane]>
        <get sort [pane]>
        <get view [pane]>
        <get selecteditemsnames [separator=CRLF] [pane]>
        <get selecteditemspathnames [separator=CRLF] [pane]>
      Note that you can omit the "separator" argument, which then leads 
      to two adjacent spaces. For example this script line lists all 
      selected item names of the inactive pane, one per line:
        text <get selecteditemsnames  i>;

      As always, SC get supports the same argument. For example the 
      above line using SC get:
        text get("selecteditemsnames", , "i");

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Move Selected Files from Inactive Pane to Active.

Post by SkyFrontier »

Code: Select all

//Files to be moved must be on inactive pane, selected.
//The active pane is the target folder.

//   $p = <get pane i>;
   focus "pi"; //disable if <get pane i> is available
   $p = <get pane>; //disable if <get pane i> is available
   focus "pi"; //disable if <get pane i> is available
   end(getinfo("CountSelected", "i") < 1), "At least one file must be selected on pane $p.";
   $target = "<curpath>";

   //get selected item(s) on inactive pane:
   $source = get("selecteditemspathnames", "|", "i");
   $dest = get("selecteditemsnames", "|", "i");

      //copyto location, source
      moveto $target, $source;

   selfilter $dest;
   #1048; //focus 1st selected
   status "Files moved. Thanks!"
Well... now, the flash-annoying-jumping-thing-o'mine shows its ugly head with the error checking code... :wink:

Code: Select all

<get pane i> - not available

Help:
get()
Returns various information.
...
"Pane", [(unused)]
Returns "1" if the first pane is active, "2" if the second pane is active.
Thanks for the tips, on the other script too, Don!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Post Reply