Page 1 of 1

(Almost) Live Filter

Posted: 31 Jul 2014 14:02
by Marco
"If Mohammed will not go to the mountain, the mountain must come to Mohammed"

Just a very simple code to bring List content somewhere where Live Filter is available.
Multiple selections are possible via checkboxes.
Smartness: if you select only one item you most likely want to open it. Otherwise, the List is just filtered, and further actions are up to you.
Works everywhere.

Code: Select all

 global $items = inputselect( , report("{FullName}<crlf>"), "<crlf>", 67, , "80%", "80%", "(Almost) Live Filter - " . tab("get", "term"));

 if ($items UnLike "*<crlf>*") {
  sub "_Open";
 } else {
  sub "_VF"
 };

"_Open"

 global $items;

 open "$items";

"_VF"

 global $items;

 $visual_filter = "";
 foreach ($item, "$items", "<crlf>");
  $visual_filter = "$visual_filter" . quote(getpathcomponent("$item", "file")) . "|";
 };
 filter '"(Almost) Live Filter" ' . trim("$visual_filter", "|");

 #250; //select all

Re: (Almost) Live Filter

Posted: 31 Jul 2014 14:11
by SkyFrontier
Haha, nice one, Marco!

Except that all boxes should be pre-checked. As if they are liveFiltered, makes sense that everything visible will make into final selection.
Nah. Same problem I had with a previews script, Don's aware of...

Thanks!

Suggestions:
-use "filter;" as first line, thus removing previous filter;
-

Code: Select all

 filter '"(Almost) Live Filter "' . trim("$visual_filter", "|");
could be

Code: Select all

 filter trim("$visual_filter", "|");
as that title tries to make into the filtering terms itself.

Re: (Almost) Live Filter

Posted: 31 Jul 2014 15:49
by Marco
You're welcome!

- the idea is to filter what is visible in the list, that's why I use report and not folderreport. Removing any previous VF would be against this logic.
- fixed, just a matter of moving the double quotes one position on the left!