Page 1 of 1

select items and filter wishes.

Posted: 13 Feb 2011 01:31
by Wanda
i wish XY could report missing files when selecting files via select items. have 12 on clipboard, ask SI to select them but it founds only 10: XY should report the missing 2 entries, by any means (a window I could copy missing file+path from, for instance).
i think that line counters at the selection window would be welcome (so I could easily check if anything is missing in final selection, if the above facility is not possible in any way).
selection filter could behave like select items, too, when i select an item it should bring the first selected item to my visual field. just an idea.

Re: select items and filter wishes.

Posted: 14 Feb 2011 12:44
by admin
I think that would be overkill.

Using scripting something similar is doable.

Re: select items and filter wishes.

Posted: 14 Feb 2011 16:43
by Wanda
how could I do the sripting thing?

Re: select items and filter wishes.

Posted: 14 Feb 2011 17:29
by Stefan
Wanda wrote:how could I do the sripting thing?
Maybe something like this:

Instead of executing "Select Items..." just execute this script.

It will check if the count of file names in clipboard are greater then the
count of selected files and give you an message if YES.
Info about which files are missing from selection is currently not implemented.

If you don't know how to execute this script:
- in XYplorer go to your folder
---------------
- copy the code from here
- open menu "Scripting > Try Script.."
- paste the code in
- press OK
- press Cancel Script
---------------
- copy your file name to the clipboard
- execute "Scripting > Run Script again"

Code: Select all

$ITEMS = "<clipboard>";
  $ITEMAMOUNT = gettoken($ITEMS, "count", "<crlf>") - 1;
  
  if ($ITEMAMOUNT > 0)
  {
     text Try to select this $ITEMAMOUNT items:<crlf>$ITEMS;
     msg "All fine to select? Continue?",1;
     
     $ITEMS = replace($ITEMS, "<crlf>", "|");
     selectitems $ITEMS;
     
     $SELECTEDCOUNT = get("CountSelected");
     $MISSED = $ITEMAMOUNT - $SELECTEDCOUNT;
     if ($MISSED > 0)
     {
      msg "$MISSED files couldn't be selected";
     }
  }
  else
  {
     msg "No items to select found in clipboard";
     text Clipboard content:<crlf>$ITEMS;
  }
EDIT: because how it is coded this code will not work correct if there is only one item name in clipboard. Only for two or more.

HTH?

Re: select items and filter wishes.

Posted: 09 Mar 2011 17:01
by tiago
In fact you can have such report. Here goes a script, basically is a .txt file in disguise so if asked for a program to open it with, point notepad or any other you use to deal with text files. You can add it to a button, as an user defined command which allows assigning hotkeys to it or simply run it via scripting/ run script... on the main interface.

'm looking everywhere but still lost in the forest: does anyone knows of a method to get XY counting and reporting a number of characters available in a string, with and without extensions, if any?
845 = 3
test = 4
text.txt = 4
text.txt = 7 (entension included but with a parameter to ignore "." or any other specified separator, later adding +1 if one needs such a thing)

Re: select items and filter wishes.

Posted: 09 Mar 2011 20:33
by Stefan
tiago wrote: 'm looking everywhere but still lost in the forest: does anyone knows of a method to get XY counting and reporting a number of characters available in a string, with and without extensions, if any?
845 = 3
test = 4
text.txt = 4
text.txt = 7 (entension included but with a parameter to ignore "." or any other specified separator, later adding +1 if one needs such a thing)
If you work with real file you can use something like
$BaseLen = strlen("<curbase>");
$ExteLen = strlen("<curexte>");


If you work with strings you can use something like this:

Code: Select all

global $InStrRev, $FileName;
    
   $FileName = "file name.VBS.bak.ext";
   sub "_InStrRev";

   $Base = substr($FileName, 0, $InStrRev -1);
   $Exte = substr($FileName, $InStrRev);

   $BaseLen = strlen($Base);
   $ExteLen =  strlen($Exte);
   $Sum = eval($BaseLen + $ExteLen);

   text "Original: $FileName          <crlf 2>
          Splitted: $Base <DOT> $Exte  <crlf 2>
          Length of Base: $BaseLen     <crlf>
          Length of Exte: $ExteLen     <crlf>
          Grand: <tab 2>$Sum  (" . eval($Sum+1) . " incl. dot)";


"_InStrRev" //Function
   global $InStrRev, $FileName;
   $Index=0;
   while($Index < strlen($FileName))
   {
     If ($FileName==""){break;}
     $check = strpos( $FileName, ".", strlen($FileName) - $Index );
     If ($check > -1){$InStrRev = $check +1; break;}
     $Index++;
   }
You can also use an code without this InStrRev() function
by using an regex to split the string:

Code: Select all

$FileName = "file name.VBS.bak.ext";

   $Base = regexreplace($FileName, "(.*)\.(.*)", "$1");
   $Exte = regexreplace($FileName, "(.*)\.(.*)", "$2");

   $BaseLen = strlen($Base);
   $ExteLen =  strlen($Exte);
   $Sum = eval($BaseLen + $ExteLen);

   text "Original: $FileName          <crlf 2>
          Splitted: $Base <DOT> $Exte  <crlf 2>
          Length of Base: $BaseLen     <crlf>
          Length of Exte: $ExteLen     <crlf>
          Grand: <tab 2>$Sum  (" . eval($Sum+1) . " incl. dot)";
But regex is by nature slower, but that may not be an issue in this case.


The result with both code is in this case:

Code: Select all

Original: file name.VBS.bak.ext          

Splitted: file name.VBS.bak <DOT> ext  

Length of Base: 17     
Length of Exte: 3     
Grand: 		20  (21 incl. dot)
HTH? :D