List Items in a List in Search Tab

Discuss and share scripts and script files...
Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

List Items in a List in Search Tab

Post by Enternal »

Is there anyway you could somehow list all items in a list into a search tab. A sample list:

$List = C:\Text.txt|C:\Audio.mp3|C:\Video.mkv

And a search tab will open up with those items. I tried using goto but it seems to work only with name searches.

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: List Items in a List in Search Tab

Post by Marco »

I guess this will come with Virtual Folders (see roadmap).
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: List Items in a List in Search Tab

Post by highend »

Why do you want to search for items, where you already know their exact location? *confused*

Please elaborate.
One of my scripts helped you out? Please donate via Paypal

Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

Re: List Items in a List in Search Tab

Post by Enternal »

Oh. I was working on a "Selection Clipboard" script that allows you to add items from different places into a temporary "clipboard". You can then paste the contents of it to wherever you want. It's a simple script version of the Virtual Folders or scrap folder (xplorer2). One of the thing I wanted it to do was show the content of the "clipboard" and currently it only lists it in a text window. Was trying to have it listed in a search tab so that you can do more to it like labels, tags, and etc.

Code: Select all

"_Initialize"
	Perm $Selections;

"Add Selected Item(s)"
	End ("<selitems>"==""),"Nothing Is Selected!";
	$Selections = "$Selections"."|".Get("SelectedItemsPathNames","|");
	$Selections = FormatList("$Selections","e");
	Copy $Selections;

"Remove Selected Item(s)"
	End ("<selitems>"==""),"Nothing Is Selected!";
	Global $SelectionsRemove = Get("SelectedItemsPathNames","|");
	ForEach($Item,$SelectionsRemove,"|") {
		$Selections = Replace($Selections,$Item,,1); }
	$Selections = FormatList("$Selections","e");
	Copy $Selections;
	Msg "Selected Item(s) Removed!";

"Clear Selection Clipboard"
	$Clear = Confirm("Are You Sure You Want To Clear Selection Clipboard?");
	End ($Clear == 0);
	$Selections = "";
	Msg "Selection Clipboard Cleared!";

""
"Show Selection Clipboard"
	//Show Items in Search Tab

"Show Selection Clipboard as Text"
	$Show = Replace($Selections,"|","<crlf>");
	Text $Show;

""
"Copy Item(s) to Here"
	Copy $Selections;
	CopyTo <curtab>,$Selections;

"Move Item(s) to Here"
	Copy $Selections;
	MoveTo <curtab>,$Selections;
	$Selections = "";
[/size]

Of course the last two items "Copy" and "Move" is redundant since you can simply use the Edit menu. Just had them there for consistency.
Last edited by Enternal on 04 Apr 2013 04:34, edited 1 time in total.

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: List Items in a List in Search Tab

Post by Marco »

I was close :)
Well, you can still rely on tags. Each item that goes in this scrap folder gets a unique special tag. So you can use a search tab.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

Re: List Items in a List in Search Tab

Post by Enternal »

Marco wrote:I was close :)
Well, you can still rely on tags. Each item that goes in this scrap folder gets a unique special tag. So you can use a search tab.
Lol! I was surprised actually. I was like "you read my mind with such a vague description?!" lol. Oh yeah, I can script it to use tags instead. That is an easier method and is my current method of using something like a scrap container for a long time now.

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: List Items in a List in Search Tab

Post by highend »

Ic,

something like this is already possible (with just one limitation: if one of the files exists in any of the other directories (derived from every other file in the the list), it will be found in all these locations.

Still interested?
One of my scripts helped you out? Please donate via Paypal

Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

Re: List Items in a List in Search Tab

Post by Enternal »

Yes please! I'm still very interested!

EDIT: Hmm... using tags, this works pretty well too:

Code: Select all

Tag SelectionsShowTemp,$Selections,1;
Goto "*?Tags:SelectionsShowTemp /r";
Tag SelectionsShowTemp,$Selections,1,2;
I'm still interested in your code though!

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: List Items in a List in Search Tab

Post by highend »

Code: Select all

	$List = "D:\Text.txt|D:\Audio.mp3|D:\Video.mkv";

	$pathList = "";
	$itemList = "";
	foreach ($item, $List, "|") {
		$pathList = $pathList . replace(regexmatches($item, ".*?\\", "|"), "|") . "|";
		$itemList = $itemList . getpathcomponent($item, "file") . ";";
	}
	$pathList = formatlist($pathList, "d", "|");
	$itemList = regexreplace($itemList, ";$", "");

	$searchTemplate = <<<>>>
[Find]
Version=3
Mode=0
FullPath=0
Case=0
InclSubs=0
Inverted=0
Fuzzy=0
FollowFolderLinks=0
SelectedLocations=0
WholeWords=0
AutoSync=0
IgnoreDiacritics=0
FuzzIndex=0
TypeFilter=0
AttrFindCheck=0
Mind0=1

[Named]
Named=$itemList

[LookIn]
LookIn=$pathList
>>>;

	$searchTemplateIni = "<xydata>\FindTemplates\search_Settings.ini";
	writefile($searchTemplateIni, $searchTemplate);
	loadsearch "search_Settings", "rl";
	delete 1, 0, $searchTemplateIni;
One of my scripts helped you out? Please donate via Paypal

RalphM
Posts: 2042
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: List Items in a List in Search Tab

Post by RalphM »

Did you have a look at the "Item Store" button Don shared on the forum at some stage in the early days of user buttons as an example.
I think it pretty much does what you're looking for.
http://www.xyplorer.com/xyfc/viewtopic. ... 045#p59045
Ralph :)
(OS: W11 24H2 Home x64 - XY: Current x32 beta - Office 2024 32-bit - Display: 1920x1080 @ 125%)

Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

Re: List Items in a List in Search Tab

Post by Enternal »

@highend
Thank you!

@RalphM
Ah. I'm a new member here so I only looked back to around early 2012 so I did not see that. So I ended up making something that Don already made. I'm not too worried since I can possibly add more features to it. Furthermore, he also have some good ideas in that script so I'm going to incorporate that into mine. Thanks!

Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

Re: List Items in a List in Search Tab

Post by Enternal »

So how does this look? Not going to add more than 2 Store containers. Are there ways to optimize it more?

Code: Select all

"_Initialize"
	Perm $Selections;
	Perm $Selections2;
	Perm $SelectionStore;
	If $SelectionStore == "" {
		$SelectionStore = 1; }

"Add Selected Item(s)"
	End ("<selitems>"==""),"Nothing Is Selected!";
	$CountItems = Get("CountSelected");
	If $SelectionStore == 2 {
		$Selections2 = "$Selections2"."|".Get("SelectedItemsPathNames","|");
		$Selections2 = FormatList("$Selections2","ned"); }
	Else {
		$Selections = "$Selections"."|".Get("SelectedItemsPathNames","|");
		$Selections = FormatList("$Selections","ned"); }
	Status "$CountItems Item(s) Added to Selection Store #$SelectionStore.",,"ready";

"Remove Selected Item(s)"
	End ("<selitems>"==""),"Nothing Is Selected!";
	$CountItems = Get("CountSelected");
	Global $SelectionsRemove = Get("SelectedItemsPathNames","|");
	If $SelectionStore == 2 {
		ForEach($Item,$SelectionsRemove,"|") {
			$Selections2 = Replace($Selections2,$Item,,1); }
		$Selections2 = FormatList("$Selections2","ned"); }
	Else {
		ForEach($Item,$SelectionsRemove,"|") {
			$Selections = Replace($Selections,$Item,,1); }
		$Selections = FormatList("$Selections","ned"); }
	Status "$CountItems Item(s) Removed from Selection Store #$SelectionStore.",,"alert";

""
"Edit Selection Store"
	If $SelectionStore == 2 {
		If $Selections2 > 0 {
			$Contents2 = Replace($Selections2,"|","<crlf>");
			$Selections2 = Input("Edit Selection Store #2",,$Contents2,m);
			$Selections2 = Replace($Selections2,"<crlf>","|");
			$Selections2 = FormatList("$Selections2","ned"); }
		Else {
			Status "No Item(s) in Selection Store #$SelectionStore.",,"alert"; } }
	Else {
		If $Selections > 0 {
			$Contents = Replace($Selections,"|","<crlf>");
			$Selections = Input("Edit Selection Store #1",,$Contents,m);
			$Selections = Replace($Selections,"<crlf>","|");
			$Selections = FormatList("$Selections","ned"); }
		Else {
			Status "No Item(s) in Selection Store #$SelectionStore.",,"alert"; } }
	
"Show Selection Store"
	If $SelectionStore == 2 {
		If $Selections2 > 0 {
			Tag SelectionStoreItems,$Selections2,1;
			Goto "*?Tags:SelectionStoreItems /r";
			Tag SelectionStoreItems,$Selections2,1,2; }
		Else {
			Status "No Item(s) in Selection Store #$SelectionStore.",,"alert"; } }
	Else {
		If $Selections > 0 {
			Tag SelectionStoreItems,$Selections,1;
			Goto "*?Tags:SelectionStoreItems /r";
			Tag SelectionStoreItems,$Selections,1,2; }
		Else {
			Status "No Item(s) in Selection Store #$SelectionStore.",,"alert"; } }

"Copy Store Item(s) to Clipboard"
	If $SelectionStore == 2 {
		If $Selections2 > 0 {
			Copy $Selections2; }
		Else {
			Status "No Item(s) in Selection Store #$SelectionStore.",,"alert"; } }
	Else {
		If $Selections > 0 {
			Copy $Selections; }
		Else {
			Status "No Item(s) in Selection Store #$SelectionStore.",,"alert"; } }

""
"Copy Item(s) to Here"
	If $SelectionStore == 2 {
		If $Selections2 > 0 == 1 {
			CopyTo <curtab>,$Selections2; }
		Else {
			Status "No Item(s) in Selection Store #2.",,"alert"; } }
	Else {
		If $Selections > 0 == 1 {
			CopyTo <curtab>,$Selections; }
		Else {
			Status "No Item(s) in Selection Store.",,"alert"; } }

"Move Item(s) to Here"
	If $SelectionStore == 2 {
		If $Selections2 > 0 == 1 {
			MoveTo <curtab>,$Selections2; }
		Else {
			Status "No Item(s) in Selection Store #2.",,"alert"; } }
	Else {
		If $Selections > 0 == 1 {
			MoveTo <curtab>,$Selections; }
		Else {
			Status "No Item(s) in Selection Store.",,"alert"; } }

""
"Clear Selection Store #1"
	$Clear = Confirm("Are You Sure You Want To Clear Selection Store?");
	End ($Clear == 0);
	Unset $Selections;
	Status "Selection Store Cleared!",,"alert";

"Clear Selection Store #2"
	$Clear = Confirm("Are You Sure You Want To Clear Selection Store?");
	End ($Clear == 0);
	Unset $Selections2;
	Status "Selection Store Cleared!",,"alert";

"Clear All Store"
	$Clear = Confirm("Are You Sure You Want To Clear Selection Store?");
	End ($Clear == 0);
	Unset $Selections, $Selections2, $SelectionStore;
	Status "All Cleared! Will Switch Back to Selection Store #1 at Next Start.",,"alert";

""
"Selection Store #1"
	$SelectionStore = 1;
	Msg "Selection Store #1 Selected.";

"Selection Store #2"
	$SelectionStore = 2;
	Msg "Selection Store #2 Selected.";
[/size]
Last edited by Enternal on 04 Apr 2013 04:34, edited 1 time in total.

FluxTorpedoe
Posts: 904
Joined: 05 Oct 2011 13:15

Re: List Items in a List in Search Tab

Post by FluxTorpedoe »

Hi'
Looks like a lot of us couldn't wait for Virtual Folders! ;)
So I thought I'd share the script I made a while back called "Buffer", based on tags too. Maybe a slightly different approach (it doesn't use INI or perms).
I didn't share it before because there's a (current) limitation with tags and search: search tabs refresh on files move/rename/delete, but not on files tag change (I had made a post about it, but it's understandably a rather low priority). Not a big deal, but it doesn't feel clean when you want to "remove" items from your Buffer.
Edit: I hadn't realized Tag-Search Tabs are now refreshed when tags are removed from listed items!!! Great news. :)

Anyway, here it is, as-is
(with the original comments: I use it with a KS and as a catalog item).
I'm gonna try yours. :)
:arrow: Edit (forgot to tell): To visually identify "buffered" items, the script adds a Tag AND a Label of the same name: "¦Buffer¦". So you must have a Label with that name or change the names in the script.

Code: Select all

"Buffer"

/*### Stores items in a temporary 'buffer' ###*/


/*### Instructions ###

• To add items to the Buffer, either:
 - Select the item(s), then press Shift+Z
 - Select the item(s), then click on "Buffer" in the Catalog
 - Drag and drop the item(s) onto "Buffer" in the Catalog

• To open the Buffer:
1. Make sure that nothing is selected, then
2. Click on "Buffer" in the Catalog, or press Shift+Z

• To empty the Buffer:
1. Activate the Buffer window:
 - If it's not opened, open it
 - If it's opened, make sure it's active (click or select anywhere in the Buffer window)
2. Click on "Buffer" in the Catalog, or press Shift+Z

 */


	$searchtab = getkey("SearchResultsTab", "General");

	if (tab(get, caption) == "¦ Buffer ¦") { // If Buffer window opened
		if (get('CountSelected') == 0) {
// --------------------------------------------------------->  ### Purge Buffer
			if (confirm("<crlf><crlf>Purge Buffer ?  <crlf><crlf>")) {
				// Run a new search in case tagged items have been copied or moved
				#351;
				if ($searchtab == 0) {tab("new");}
				Setting('BackgroundFileOps', 0);
				goto "%computer%?tags:¦Buffer¦ /r";
				tab(rename, "¦ Buffer ¦|:queue");
				#250; // Select all
				tag ("¦Buffer¦", , 1, 2); // Remove tag
				#351;
				status(" ¦Buffer¦ purged successfully");
			}
// --------------------------------------------------------->  ###  Remove item from Buffer
		} else {
				tag ("¦Buffer¦", , 1, 2); // Remove tag
				tag ("", , 0); // Remove label
				#351;
				if ($searchtab == 0) {tab("new");}
				Setting('BackgroundFileOps', 0);
				goto "%computer%?tags:¦Buffer¦ /r";
				tab(rename, "¦ Buffer ¦|:queue");
				status("Item(s) removed from Buffer successfully");
		}
	} else {
// --------------------------------------------------------->  ### Send item to Buffer (i.e. Tag)
		if (get('CountSelected') != 0) {
			tag ("¦Buffer¦", , 1, 0); // Tag
			tag ("¦Buffer¦", , 0); // Label
			// Visual indicator
			status " \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \", "FF0000", progress; wait 60;
			status " | | | | | | | | | | | | | | | | | | | |", "FF0000", stop; wait 60;
			status " / / / / / / / / / / / / / / / / / / / /", "FF0000", stop; wait 60;
			status " -- -- -- -- -- -- -- -- -- -- -- -- --", "FF0000", progress; wait 60;
			status " \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \", "FF0000", progress; wait 60;
			status " | | | | | | | | | | | | | | | | | | | |", "FF0000", stop; wait 60;
			status " / / / / / / / / / / / / / / / / / / / /", "FF0000", stop; wait 60;
			status " -- -- -- -- -- -- -- -- -- -- -- -- --", "FF0000", progress; wait 60;
			status " \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \", "FF0000", progress; wait 60;
			status " | | | | | | | | | | | | | | | | | | | |", "FF0000", stop; wait 60;
			status " / / / / / / / / / / / / / / / / / / / /", "FF0000", stop; wait 60;
			status " -- -- -- -- -- -- -- -- -- -- -- -- --", "FF0000", progress; wait 60;
			status " \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \", "FF0000", progress; wait 60;
			status " | | | | | | | | | | | | | | | | | | | |", "FF0000", stop; wait 60;
			status " / / / / / / / / / / / / / / / / / / / /", "FF0000", stop; wait 60;
			status("Item(s) added to Buffer successfully");
		} else {
// --------------------------------------------------------->  ###  Open Buffer window
			if (get("pane") != 1) {#802;} // Activates first pane
			if ($searchtab == 0) {tab("new");}
			Setting('BackgroundFileOps', 0);
			goto "%computer%?tags:¦Buffer¦ /r";
			tab(rename, "¦ Buffer ¦|:queue");
			#250; // Select all
			if (get('CountSelected') != 0) {
				#251; // Deselect all
//        if (get('View')!=2) {#304;} // Switch to List View
				status(" ¦Buffer¦");
			} else {
				#351;
				msg "<crlf><crlf>Buffer is empty.  <crlf><crlf>";
			}
		}
	}
Last edited by FluxTorpedoe on 02 Apr 2013 17:20, edited 1 time in total.

LittleBiG
Posts: 1848
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: List Items in a List in Search Tab

Post by LittleBiG »

FluxTorpedoe wrote:So I thought I'd share the script I made a while back called "Buffer", based on tags too. Maybe a slightly different approach (it doesn't use INI or perms).
I like your solution. And if you change "Buffer" to self("caption"), you can use more than one buffer from the catalog.

FluxTorpedoe
Posts: 904
Joined: 05 Oct 2011 13:15

Re: List Items in a List in Search Tab

Post by FluxTorpedoe »

LittleBiG wrote:if you change "Buffer" to self("caption"), you can use more than one buffer from the catalog
Hmmm, clever one! I gotta try that. ;)

BTW, I'd forgotten to mention that the script is also using a Label (though it could be removed). I edited the previous post.

Post Reply