Ignore articles when sorting

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
kiwichick
Posts: 557
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Ignore articles when sorting

Post by kiwichick »

I have a question regarding sorting and ignoring articles.

Is it possible to use a script to "get" the current sort state (ie: column and ascending/descending), including if the sort is ignoring articles?

Thanks in advance for any help :)
Windows 10 Pro 22H2

highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Re: Ignore articles when sorting

Post by highend »

Sure, the get command knows the sort state and savesettings (to a temp .ini file to not overwrite the current one) updates the pane.ini file(s) which you can get the key Style in the section ListBrowse from via getkey and then you only need to look at viewtopic.php?t=12999 and use its "expand" part to check if the bit flag for 32768 (= Ignore Articles When Sorting) is set...
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

kiwichick
Posts: 557
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Ignore articles when sorting

Post by kiwichick »

highend wrote: 14 Oct 2021 09:27 Sure, the get command knows the sort state and savesettings (to a temp .ini file to not overwrite the current one) updates the pane.ini file(s) which you can get the key Style in the section ListBrowse from via getkey and then you only need to look at viewtopic.php?t=12999 and use its "expand" part to check if the bit flag for 32768 (= Ignore Articles When Sorting) is set...
Thanks a lot highend, I've gotten this far:

"the get command knows the sort state"
My code:
get("Sort", [pane=a]);

"savesettings (to a temp .ini file to not overwrite the current one) updates the pane.ini file(s)"
My code:
savesettings, "xyplorer_temp.ini";

"get the key Style in the section ListBrowse from via getkey"
My code:
getkey("Style", "ListBrowse", "<xypane>\pane.ini");

"then you only need to look at viewtopic.php?t=12999 and use its "expand" part to check if the bit flag for 32768 (= Ignore Articles When Sorting) is set"
I'm sorry but I don't understand how to "use its "expand" part". In fact, I confess I barely understand any of that script.

Followup questions:
1. What am I supposed to do with the result of getkey?
2. Is there any way to do this without saving the settings? Yes, it updates the pane.ini files but that overwrites saved tabsets and changes their settings.
Windows 10 Pro 22H2

highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Re: Ignore articles when sorting

Post by highend »

Code: Select all

get("Sort", [pane=a]);
That's nonsense... Menu - Scripting - [x] Syntax checking^^

Code: Select all

getkey("Style", "ListBrowse", "<xypane>\pane.ini");
What's the use of both of these if you don't assign the result to a variable to be able to do something with them?
In fact, I confess I barely understand any of that script
The last part of it isn't that hard to understand. It's only two loops. One to find the maximum number of bits and the second one that checks if a specific bit is set or not. The dereferencing (to create variables out of the values) isn't necessary. And you need the "is bit 16 (= 32768) set or not", otherwise you don't know if "Ignore Articles When Sorting" is active or not...
Is there any way to do this without saving the settings?
If you don't do it, you won't get the current value of "Ignore Articles When Sorting" so it's your decision if you do it like this or not
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

kiwichick
Posts: 557
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Ignore articles when sorting

Post by kiwichick »

highend wrote: 15 Oct 2021 01:06

Code: Select all

get("Sort", [pane=a]);
That's nonsense... Menu - Scripting - [x] Syntax checking^^

Code: Select all

getkey("Style", "ListBrowse", "<xypane>\pane.ini");
What's the use of both of these if you don't assign the result to a variable to be able to do something with them?
In fact, I confess I barely understand any of that script
The last part of it isn't that hard to understand. It's only two loops. One to find the maximum number of bits and the second one that checks if a specific bit is set or not. The dereferencing (to create variables out of the values) isn't necessary. And you need the "is bit 16 (= 32768) set or not", otherwise you don't know if "Ignore Articles When Sorting" is active or not...
Is there any way to do this without saving the settings?
If you don't do it, you won't get the current value of "Ignore Articles When Sorting" so it's your decision if you do it like this or not
"That's nonsense... Menu - Scripting - [x] Syntax checking^^"
Not really nonsense. I just hadn't gotten around to removing the unnecessary code and it worked so I wasn't too bothered for now. But here ya go, just for you:

Code: Select all

$a = get("Sort");
"What's the use of both of these if you don't assign the result to a variable to be able to do something with them?"
No, I hadn't gotten around to that either but, again, here ya go, just for you:

Code: Select all

$b = getkey("Style", "ListBrowse", "<xypane>\pane.ini");
"The last part of it isn't that hard to understand."
Maybe not hard for you but it's not helpful to assume it shouldn't be hard for someone else.

"It's only two loops. One to find the maximum number of bits and the second one that checks if a specific bit is set or not. The dereferencing (to create variables out of the values) isn't necessary. And you need the "is bit 16 (= 32768) set or not", otherwise you don't know if "Ignore Articles When Sorting" is active or not..."
Sorry, still don't understand any of that.

"If you don't do it, you won't get the current value of "Ignore Articles When Sorting"
I thought that might be the case.

It's all irrelevant now, anyway. I can't do what I was hoping to do. I hadn't looked into it enough and it doesn't work the way I thought it would. But at least I learnt a little bit about get() and getkey() so thanks for that.
Windows 10 Pro 22H2

highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Re: Ignore articles when sorting

Post by highend »

Maybe post a feature request for savesettings to allow it to save the panes in the folder of the [ini] file?

Ofc in a subfolder named "Panes" relative to the path of [ini] (internally resolved).

This wouldn't break existing behavior and should be fairly easy to add / accomplish by Don...
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

Post Reply