ListManagementHouseCleaning

Discuss and share scripts and script files...
klownboy
Posts: 4146
Joined: 28 Feb 2012 19:27

Re: ListManagementHouseCleaning

Post by klownboy »

I'm not sure if I understand what you're asking. Is the "sticky section" as you called it, somehow flagged when you view the list in "List Management". Can you give me an example or screen capture from a list in "List Management " that contains sticky sections? If there are certain lists that you don't want to touch you could move the list from the automatically clear dialog box (the first one that opens in the script) to the second dialog box which is for editing or clearing the more important list management items (i.e., lists that you probably wouldn't want to clear but possibly edit).
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440

hermhart
Posts: 213
Joined: 13 Jan 2015 18:41

Re: ListManagementHouseCleaning

Post by hermhart »

From the Help file:
Sticky Section: Various most-recently-used (MRU) lists can have an optional Sticky Section. Items in the Sticky Section are permanent members of this list and will never be pushed out when new items are added. You can use this section for your all-time favorite items and carefully crafted patterns. The Sticky Section can be added via List Management, simply add this dummy item as section separator:

-----> mru

So in the example below, any new items I type to do a find for would get added below the "-----> mru" line, and I would only want to get rid of anything below that.
Attachments
ListManagement.jpg
ListManagement.jpg (149.61 KiB) Viewed 2377 times

klownboy
Posts: 4146
Joined: 28 Feb 2012 19:27

Re: ListManagementHouseCleaning

Post by klownboy »

Hi hermhart, thanks now I see what you mean. Obviously I haven't been using Sticky Sections. I'll take a closer look at it, but from my quick look back at the script, it's not currently looking at the details or contents of the individual lists contained in the first [Clear] dialog box. It simply is checking that the "list" has contents (to apply the pre-check) and then using sendkeys to clear the list. To achieve what you want the script would have to obtain the contents of the list (in this case from the "Named" section in XYplore.ini is where it's saved) and see if it contains "-----> mru" and then act appropriately deleting only those items in the list below "-----> mru" which would be a substantial re-write. The script is currently going to XYplorer.ini file using SC getkey, but only to determine if there is any content in a particular list like Find files: Name ["Named"] (i.e., when the count is 1 or greater). I'll take a closer look, but it could be a royal pain.

In the mean time you may want to consider moving list like Find files: Name ["Named"] from the variable $LM_list_1 to variable $LM_list_2 so that the list is simply opened for edit instead of cleared. I can certainly see why you wouldn't want to accidently delete the sticky stuff.

Oh I see Stef123 chimed in with a referral to Sammay's script which does consider the "-----> mru line", but like Stef123 mentioned be careful and read the thread. Its radical in the use of wait periods, etc.
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440

Stef123

Re: ListManagementHouseCleaning

Post by Stef123 »

@hermhart
I've been using this script here - it does what you want:
http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=13704
Make sure you read the instructions, there are some caveats to be observed if you want to fully automate it.

@Ken,
I don't know if your script handles it, too. Tried to test it, but I cannot run it. The XY error dialog comes up and tells me it cannot find D:\Tools\XYplorer\tag.dat

It chokes on line 40:

Code: Select all

elseif(($list_name == "Tagged Items") AND !(gettoken(readfile("D:\Tools\XYplorer\tag.dat", "t", , ,"1"), gettokenindex("*Data:", readfile("D:\Tools\XYplorer\tag.dat", "t", , ,"1"), "<crlf>", "iw")+1, "<crlf>", ,"2"))) {

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

Re: ListManagementHouseCleaning

Post by highend »

Probably:

Code: Select all

elseif(($list_name == "Tagged Items") AND !(gettoken(readfile("<xydata>\tag.dat", "t", , ,"1"), gettokenindex("*Data:", readfile("<xydata>\tag.dat", "t", , ,"1"), "<crlf>", "iw")+1, "<crlf>", ,"2"))) {
One of my scripts helped you out? Please donate via Paypal

Stef123

Re: ListManagementHouseCleaning

Post by Stef123 »

@highend
I replaced all 3 instances of the hardwired path with <xydata> - but now it chokes on this:

Code: Select all

elseif(($list_name == "Servers in Network Folder") AND !(gettoken(readfile("<xydata>\servers.dat", "b", , ,"47"), "2", "\", "t","2"))) {

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

Re: ListManagementHouseCleaning

Post by highend »

Does servers.dat exist?
One of my scripts helped you out? Please donate via Paypal

Stef123

Re: ListManagementHouseCleaning

Post by Stef123 »

Not in my current set

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

Re: ListManagementHouseCleaning

Post by highend »

Then you need a check if (exists("<xydata>\servers.dat")) in front of it to let the script not choke on a non existing file...
One of my scripts helped you out? Please donate via Paypal

Stef123

Re: ListManagementHouseCleaning

Post by Stef123 »

Well, it's not my script, I rather let Ken handle it.
I was just curious to see it in action. Our postings overlapped - mine and Ken's - I was not sure whether or not Ken might have built in the -----> MRU feature requested by hermhart.

I am doing fine with Sammay's version - but like Ken said, one better beware the risks involved and read the instructions.

I cherish my ------> mru sections, wouldn't want them deleted. Not with the info-help texts being so hard to edit (via ITT only). Which reminds me to bump another old wish of mine ... off to search for it .... :wink:

klownboy
Posts: 4146
Joined: 28 Feb 2012 19:27

Re: ListManagementHouseCleaning

Post by klownboy »

Thanks highend and Stef123, I'll take care of those errors you discussed. I haven't had a chance to look at the exclusion of the sticky section yet other than what I mentioned above. It may be a bunch of work especially going the route I mentioned using XYplorer.ini. Maybe using Sammay's method would be better though it looks a bit devilish. :twisted:
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440

Stef123

Re: ListManagementHouseCleaning

Post by Stef123 »

klownboy wrote: Maybe using Sammay's method would be better though it looks a bit devilish. :twisted:
:biggrin: Yeah, but OTOH it works quite well. You become more and more comfortable and .. ahem ... trusting. I take my precautions, though, never run it in busy environments where the many SendKeys could end up in wrong windows that seize the foreground every so often, mail alerts popping up, that sort of thing.

klownboy
Posts: 4146
Joined: 28 Feb 2012 19:27

Re: ListManagementHouseCleaning

Post by klownboy »

Hi Stef123, yes I worry about the use of sendkeys for the reason you mentioned. Though I don't like the idea of going into XYplorer.ini searching for "mru" in a section like "Named" for "Find files: Name" and then deleting everything that follows the mru line...and doing that for quite a few sections that have mru's. That could be just as nasty. In addition I believe the script would have to save the ini file and restart XY. Right now I'm thinking no on that idea, but I'll look into incorporating Sammay's method or something similar only for those situations that have mru's along with keeping my interface. Thanks.
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440

Stef123

Re: ListManagementHouseCleaning

Post by Stef123 »

I fully understand, Ken,
didn't mean to criticise your script because it lacks this feature. I remember you writing it mainly for yourself, then deciding to share it.

To me it's an important feature, though, that's why I had been asking for it, ideally as a built-in XY solution. But that's not likely to happen, so Sammay's script comes as a real boon to me.

hermhart
Posts: 213
Joined: 13 Jan 2015 18:41

Re: ListManagementHouseCleaning

Post by hermhart »

klownboy,

I didn't know that my one question would spark such an interesting conversation with everyone. I like your interface a lot, and fear the harshness of the sendkeys script that you all are talking about. So if you are ever able to incorporate the MRU stuff into what you already have made, I think a ton of people would find your script very useful to keep their sessions clean and free of old non-essential items.

Thanks for your consideration...

Post Reply