Find by List.

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

Re: Find by List.

Post by SkyFrontier »

Thanks for the tip, nas8e9.
The problem is: I had bad experiences editing .dats in the past. Perhaps the editor involved in the task, silent codification changes/wrong codification in edition itself or whatever. I'm trying to avoid this at all costs, in other words, and get the job done the easiest way possible - it's a hell of a... non-existing feature. :D
(I should had the idea earlier, I always missed something like that but just recently I found this workaround, I badly need such a thing since ages ago!)
---
Some collected Find by Tags references.
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...

nas8e9
Posts: 2232
Joined: 21 Jun 2008 14:50

Re: Find by List.

Post by nas8e9 »

SkyFrontier wrote:Thanks for the tip, nas8e9.
The problem is: I had bad experiences editing .dats in the past. Perhaps the editor involved in the task, silent codification changes/wrong codification in edition itself or whatever. I'm trying to avoid this at all costs, in other words, and get the job done the easiest way possible - it's a hell of a... non-existing feature. :D
Do you mean XYplorer's .dat files or .dat files in general? The help file specifically mentions the encoding (UTF-16); any decent editor should be able to explicitly save in that format. As for manually editing tag.dat being supported, in XYplorer terms you don't get more supported than it being in the help file.

I don't mean to minimise the impact of data loss, but given a good backup it might be worth a try?

(Edited for spelling.)
Last edited by nas8e9 on 29 Oct 2010 01:32, edited 2 times in total.

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

Re: Find by List.

Post by SkyFrontier »

:!: I'm not aware that XY can sort <clipboard> content via script. If only the Database Cleanup could have a CKS attached to it, I could try to write a tags.dat editor that could read opened tabs at least (perhaps <curitem> having the target folders) and append that info into current tags.dat, then DB Cleanup doing the required/recommended sort order. :wink:
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...

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

Re: Find by List.

Post by SkyFrontier »

nas8e9 wrote: Do you mean XYplorer's .dat files or .dat files in general? The help file specifically mentions the encoding (UTF-16); any decent editor should be able to explicitly save in that format. As for manually editing tag.dat being supported, in XYplorer terms you don't get more supported that it being in the help file.
I don't mean to minimise the impact of data loss, but given a good backup it might be worth a try?
.dats in general.
However I've opened other XY.dat months ago and didn't like what I saw, too, so completely discarded editing them since then - despite knowing about the tags.dat statement (better safe than sorry - in some systems, I have hundreds of tags and had a very bad experience when the feature arrived by then not knowing how it work, "better not to mess with the thing", I tend to think...).

But I'm so in love for the multi-locations propagation trick that I'm considering to take the chances (granted I'll write a backup feature for the scripted solution, just in case... :wink: ).
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...

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Find by List.

Post by serendipity »

SkyFrontier wrote:
serendipity wrote:
SkyFrontier wrote:I'm pretty sure that the new listfolder thing may help me, but... have to play with.
Well, Listfolder will not allow multiple folders, so that won't work for you. However, if you just need to select one folder for some purpose, then use inputselect instead:

Code: Select all

inputselect ("Select a folder", "C:\Temp\|C:\Test\|Q:\Searches\|S:\Backup\|S:\Burn\Today\", "|");
Thanks, Serendipity.
But the thing is to have those folders displayed in List so I can propagate files across them all at once - or throw different stuff to different folders listed on a single tab at the opposite pane.
I realized that I misunderstood the listfolder/NoFiles command, after some tests.
I'm dealing with the usage you suggested via the Simple file-based favorites, which is pretty flexible.
OK, but why don't you want search templates? You can easily build them.

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

Re: Find by List.

Post by SkyFrontier »

Serendipity wrote:OK, but why don't you want search templates? You can easily build them.
As far as I know they will involve searching the whole drives, and speed is everything to me in this case.
---
Raw code (tested a bit and works hmmmmm... fine, despite the tons of duplicates and not handling the required sorting).

Code: Select all

//Tags Handler - based off Stefan's Save Sessions script, desperately revamped by SkyFrontier.
//needs latest XYplorer BETA version (v9.30.0014, 25-jul-2010) or newer
//Note: depending on your XY settings something may not work as indented.
// save an list of current open Tabs from current pane to an file:

"Add Focused Folder to TargetFolders.ini|:showfolders"
   $b = report("{fullname}|2|<crlf>", 1);
   writefile("<xydata>\Sessions\MultiTargets\TargetFolders.ini", "$b", a, ta);

"Store Tabs into TargetFolders.ini|:go"
   $TabCount = tab(,"c"); //how many tabs are open?
   $Pane = getinfo("Pane"); //which pane is active?
   $Loop = 1;
   $Tabs = "";
   while ($Loop<$TabCount+1) //for each tab do
   {
     //if (strlen(tab("get","name") < 1)
     $IFTabNameSet = strlen(tab("get","name",$Loop));
     if ($IFTabNameSet < 1)
     {
     $Tabs = $Tabs . tab("get", "data", $Loop) . "|2|<crlf>"; //save the path in array "$Tabs" with | as delimiter
     }else{
     $Tabs = $Tabs . tab("get", "data", $Loop) . "?" . tab("get", "name", $Loop) . "|"; //save the tab caption too
     }
     incr $Loop;
    }
    //save the array to an file:
    //$folder = inputfolder("<xydata>\sessions", "Select Folder");
    IF (exists("<xydata>\Sessions\MultiTargets")==0) {new "<xydata>\Sessions\MultiTargets", dir;}
    $DefaultFileName = "<xydata>\Sessions\MultiTargets\TargetFolders" . ".ini";
    //
    $SessionFile = Input("Save Session", "Save list of tabs as: (avoid saving it externally to XYpath)", $DefaultFileName);
    writefile($SessionFile, "$Tabs", "a", "u");

"Add Inactive Pane's Folder to Focused Generic .ini|:showfolders"
   $c = <get item>;
   $b = "<get item i>|";
   writefile("$c", "$b", a, ta);

"Load Tabs from Focused Generic .ini and Save them Into TargetFolders.ini|:undo"
    //read session file into array "$Tabs":
    $SessionFile = inputfile("<curitem>", "ini", "Load list of tabs");
    $Tabs = readfile($SessionFile);
    $Loop = 1;
    //a little bit clean up first?
    $CloseCurrentOpenTabs = confirm("Close current open tabs first?");
    if ($CloseCurrentOpenTabs==0) { ;} elseif (tab(,"c")>1) {#353;} //close all "other" tabs
    $Loop = 1;
    While(1)
    {
      $NewTab = gettoken($Tabs,$Loop,"|");
      if ($NewTab==""){break;}
      if (strpos($NewTab,"?") == -1)
      {
         tab("new", $NewTab); //open new tab with next token from array
      }else{
         tab("new",    gettoken($NewTab,1,"?"));
         tab("rename", gettoken($NewTab,2,"?"));
      }
    incr $Loop;
    }
    if ($CloseCurrentOpenTabs==1){seltab 1;#351;} //close last "old" tab too
//Writing starts here:
   $TabCount = tab(,"c"); //how many tabs are open?
   $Pane = getinfo("Pane"); //which pane is active?
   $Loop = 1;
   $Tabs = "";
   while ($Loop<$TabCount+1) //for each tab do
   {
     //if (strlen(tab("get","name") < 1)
     $IFTabNameSet = strlen(tab("get","name",$Loop));
     if ($IFTabNameSet < 1)
     {
     $Tabs = $Tabs . tab("get", "data", $Loop) . "|2|<crlf>"; //save the path in array "$Tabs" with | as delimiter
     }else{
     $Tabs = $Tabs . tab("get", "data", $Loop) . "?" . tab("get", "name", $Loop) . "|"; //save the tab caption too
     }
     incr $Loop;
    }
    //save the array to an file:
    //$folder = inputfolder("<xydata>\sessions", "Select Folder");
    IF (exists("<xydata>\Sessions\MultiTargets")==0) {new "<xydata>\Sessions\MultiTargets", dir;}

    $DefaultFileName = "<xydata>\Sessions\MultiTargets\TargetFolders" . ".ini";
    //
    $SessionFile = Input("Save Session", "Save list of tabs as: (avoid saving it externally to XYpath)", $DefaultFileName);
    //$SessionFile = $DefaultFileName;
    writefile($SessionFile, "$Tabs", "a", "u");

"Write TargetFolders.ini into Tag.dat|:udc"
   $a = readfile("<xydata>\Sessions\MultiTargets\TargetFolders.ini");
   copytext $a;
   writefile("<xydata>\tag.dat", "$a", a, tu);

"Edit this Script|:paste"
    self $ScriptFile, file;
    //OpenWith "<xypath>\Tools\NotePad2\Notepad2.exe", ,$ScriptFile;
    OpenWith "Notepad", ,$ScriptFile;
-you do have a better idea an can do it better?
OF COURSE YOU'RE WELCOME TO DO THIS!!! :mrgreen:

EDIT:
-better wording;
-cleaner coding;
-writing ability expanded (now works with a generic text/.ini file or hardcoded TargetFolders.ini, using them both to store and load tabs info);
-small bug fixes related to appending functions;
-"tu" mode set to write tag.dat.
Unable to do: I saw a regEx based solution which could collapse all duplicates to single instances, but was unable to find it anywhere (here on forums or external sites). Any help on this...?
(Manual) cleaning database doesn't solve this... :(
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...

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

Re: Find by List.

Post by SkyFrontier »

Help... :(
-any regexreplace I could use to eliminate duplicates in tag.dat?
-if not, any possible problem using Cream/VIM to edit tag.dat? How can I correctly open it, since it's not just a mere matter of pointing to an .exe?
Reference:
Cream/VIM CTB entry:

Code: Select all

"Cream/VIM|D:\Programs\Cream0_42Vim7_2TextEditor\vim72\gvim.exe" open """D:\Programs\Cream0_42Vim7_2TextEditor\vim72\gvim.exe"" -u ""d:\Programs\Cream0_42Vim7_2TextEditor\vim72\cream\creamrc"" -U NONE --servername CREAM";
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...

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Find by List.

Post by serendipity »

SkyFrontier wrote:
Serendipity wrote:OK, but why don't you want search templates? You can easily build them.
As far as I know they will involve searching the whole drives, and speed is everything to me in this case.
not true, you can create search templates to search only in the folders you know where your folders are. Later when you can load this search, only those locations will be searched.

Steps:
1) Create a new ini file using write file.
2) Use couple of setkeys to write keys to this ini file.
3) Use loadsearch to load your results in search tab.

its very easy if you ask me. i can write one if you are interested.

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

Re: Find by List.

Post by SkyFrontier »

serendipity wrote:
SkyFrontier wrote:
Serendipity wrote:OK, but why don't you want search templates? You can easily build them.
As far as I know they will involve searching the whole drives, and speed is everything to me in this case.
not true, you can create search templates to search only in the folders you know where your folders are. Later when you can load this search, only those locations will be searched.

Steps:
1) Create a new ini file using write file.
2) Use couple of setkeys to write keys to this ini file.
3) Use loadsearch to load your results in search tab.

its very easy if you ask me. i can write one if you are interested.
Oh, yes, please!
Not that I am lazy, but I'm being almost crazy trying to wrokaround this and achieve what I want (and my previous experience with search templates resulted in no great stuff, as you can infer...).
>.ini based? That means I could easily edit such .ini and add/remove as many paths I need... sounds great to me!
Thanks, Serendipity!
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...

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Find by List.

Post by serendipity »

Try this example and see if something like this would work for you.
Below script creates a template named Mysearch which lists only 4 folders FindTemplates, NewItems,Panes and XYplorer from two different paths:

Code: Select all

//Enter folders to be listed here
 $lookfor= ""FindTemplates";"NewItems";"Panes";"XYplorer"";
 $lookfor = substr ($lookfor, 1, -1);
//Enter the paths where these folders exist
 $lookin="%programfiles%\XYplorer\;E:\Program Files\";
//Setkey to apply "Name" filter in search
 setkey 1, "Mind0", "Find", "<xypath>\FindTemplates\Mysearch.ini";
//Setkey folders to look for
 setkey $lookfor, "Named", "Named", "<xypath>\FindTemplates\Mysearch.ini";
//Setkey paths where to look for folders listed above
 setkey $lookin, "LookIn", "LookIn", "<xypath>\FindTemplates\Mysearch.ini";
//load search
 loadsearch "Mysearch", rl;

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

Re: Find by List.

Post by SkyFrontier »

:shock:
:x
:oops:
:roll:
:?
:(
:|
:o
:P
:)
:D
:mrgreen:
Sorry. Only those stupid emoticons could (imperfectly) describe how I feel...
Problem solved. Now I can easily open that .ini, add new location/search patterns and such. I just had to adjust <xypath> to <xydata> to get it working as intended. Later I'll post a custom version containing any improvements I may find necessary, being the "edit .ini" the only thing that comes to mind as for now.
>Is there any key there which is checking whether or not the results will always be folders only, Serendipity? If not, drop me a hint on how to do that. I'd say that "Mind0=1" is doing the job, but can't say for sure.
>If you don't bother in dropping a hint on how to enter that value to open a file via Cream/VIM, that would be great for learning purposes, too.
Thanks, many thanks!!!
:!: 8) :D :wink: :!:
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...

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Find by List.

Post by serendipity »

SkyFrontier wrote::shock:
:x
:oops:
:roll:
:?
:(
:|
:o
:P
:)
:D
:mrgreen:
Sorry. Only those stupid emoticons could (imperfectly) describe how I feel...
Problem solved. Now I can easily open that .ini, add new location/search patterns and such. I just had to adjust <xypath> to <xydata> to get it working as intended. Later I'll post a custom version containing any improvements I may find necessary, being the "edit .ini" the only thing that comes to mind as for now.
>Is there any key there which is checking whether or not the results will always be folders only, Serendipity? If not, drop me a hint on how to do that. I'd say that "Mind0=1" is doing the job, but can't say for sure.
>If you don't bother in dropping a hint on how to enter that value to open a file via Cream/VIM, that would be great for learning purposes, too.
Thanks, many thanks!!!
:!: 8) :D :wink: :!:
You can dissect the structure of a template file (.ini) by playing with find files options and saving it as template and looking into that template file.
Hint: The "folder only" option should be in the attribute tab in find files.

PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Find by List.

Post by PeterH »

serendipity wrote:

Code: Select all

//Enter folders to be listed here
 $lookfor= ""FindTemplates";"NewItems";"Panes";"XYplorer"";
 $lookfor = substr ($lookfor, 1, -1);
 ...
Sorry: the syntax with respect to quoting seems to be wrong here?
As I understand this is one quoted string inside double-quotes. (From very first to very last double quote.) And inside all double-quotes must be doubled. So this *should* only produce a syntax error. If it doesn't the result is unpredictable.

I'm afraid this unpredictability is the reason for the last refered line, where you have to strip the first and last character of the result string, which shouldn't exist at all...

If I understand right what should be the result it could be:
$lookfor= """FindTemplates"";""NewItems"";""Panes"";""XYplorer""";
or, if none of the words in the string is a variable:
$lookfor= '"FindTemplates";"NewItems";"Panes";"XYplorer"';
that is: make it a single-quoted string.

(I hope I got it right?)

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

Re: Find by List.

Post by SkyFrontier »

Following PeterH's guidelines plus adapting <xypath> to <xydata>, this is what I have:

Code: Select all

//Enter folders to be listed here
//   new "<xydata>\FindTemplates\Mysearch.ini", file;
   $lookfor= '"Phase7_New";"_Newest"';
//   $lookfor = substr ($lookfor, 1, -1);
//Enter the paths where these folders exist
   $lookin="C:\Programs\XYscripts\All440XYscripts\;Q:\Programs\xyplorer\xyScriptsLibrary\_FILT\;Q:\Programs\xyplorer\xyScriptsLibrary\_FULL\;E:\Programs\_xyplorer_PERM\Data\_RES\Scripts\";
//Setkey to apply "Name" filter in search
   setkey 1, "Mind0", "Find", "<xydata>\FindTemplates\Mysearch.ini";
//Setkey folders to look for
   setkey $lookfor, "Named", "Named", "<xydata>\FindTemplates\Mysearch.ini";
//Setkey paths where to look for folders listed above
   setkey $lookin, "LookIn", "LookIn", "<xydata>\FindTemplates\Mysearch.ini";
//load search
   loadsearch "Mysearch", rl;
>but I'm trying to clone my franskenscript's functionality to both read <curitem> (a list containing paths, anything goes*) or get <curpath> of a single folder/file (has extension? grab its dir; no extension? assume it's a dir!) and import that info into $lookin, and getting nowhere. Menu driven? I don't care.

Code: Select all

"Find by List"
"Import CURITEM into MySearch" >> will read .txt based list of paths;
"Import CURPATH into MySearch"
"Check MySearch" >> "Edit Search|:udc" open "E:\Programs\_xyplorer_PERM\Data\FindTemplates\Mysearch.ini";
"Edit this Script"
Please.
Thank you!
---
References:
*Whatever it's easier:

Code: Select all

C:\Programs\XYscripts\All440XYscripts\;Q:\Programs\xyplorer\xyScriptsLibrary\_FILT\;Q:\Programs\xyplorer\xyScriptsLibrary\_FULL\;E:\Programs\_xyplorer_PERM\Data\_RES\Scripts\

Code: Select all

C:\Programs\XYscripts\All440XYscripts\
Q:\Programs\xyplorer\xyScriptsLibrary\_FILT\
Q:\Programs\xyplorer\xyScriptsLibrary\_FULL\
E:\Programs\_xyplorer_PERM\Data\_RES\Scripts\
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...

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

Re: Find by List.

Post by SkyFrontier »

My problems with this are:
>How to deal with the $lookin=" * " or .ini's

Code: Select all

[LookIn]
LookIn=path1\;path 2\
It seems to be simple, but actually...

>How to deal with duplicates on .ini template?
Thank you!
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