Page 1 of 1
Move Selected Files from Inactive Pane to Active.
Posted: 20 Nov 2010 01:50
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!"
Re: Move Selected Files from Inactive Pane to Active.
Posted: 20 Nov 2010 09:17
by admin
Why change focus? Ever heard of
listpane?
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");
Re: Move Selected Files from Inactive Pane to Active.
Posted: 20 Nov 2010 13:49
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...
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!