Always show folders sizes as a script

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
kiwichick
Posts: 648
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

Always show folders sizes as a script

Post by kiwichick »

Is there a way to script "Always show folders sizes" so it can be toggled on and off without having to go to config to do it?
Windows 10 Pro 22H2

klownboy
Posts: 4397
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7171 at 100% 2560x1440

Re: Always show folders sizes as a script

Post by klownboy »

This script will do that, but unless you've had "Always show folder sizes " checked AND have cached the results by having Cache folder sizes" checked and even "Show cached folder sizes only", this will take some time. Not to accomplish the Configuration change (you won't see that) but for obtaining the folder sizes.

For a script or UDC:
sendkeys '{PGUP}%l{ENTER}';#600;

admin
Site Admin
Posts: 64915
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Always show folders sizes as a script

Post by admin »

Possible:

Code: Select all

settingp "showfoldersizeinlist", 1; //Always show folder sizes -> ON

settingp "showfoldersizeinlist", 0; //Always show folder sizes -> OFF

klownboy
Posts: 4397
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7171 at 100% 2560x1440

Re: Always show folders sizes as a script

Post by klownboy »

Hey that works too and better. I don't use Show folder sizes myself. It appears using SC setting, show folder sizes pinpoints to the current drive or folder which is good, whereas changing the setting in Configuration seems to be global (i.e., it appeared to be collecting folder sizes in C: drive when I was currently in E: drive).

admin
Site Admin
Posts: 64915
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Always show folders sizes as a script

Post by admin »

Hmm, probably a bug in settingp "showfoldersizeinlist". It should update both panes, not only the active one.

klownboy
Posts: 4397
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7171 at 100% 2560x1440

Re: Always show folders sizes as a script

Post by klownboy »

I'm not so sure that's a bad thing especially if the user is only using a single pane...and it was a pretty quick as reflected in the status bar whereas the change via Config went on and on and on...

By the way, did you ever see this wish back in July, viewtopic.php?t=27723. Obviously, it wasn't urgent. I figured it might be nice for the user to be able specifically set the Info Tips On/OFF and Hover box ON/OFF for a specific folder(s) if desired as opposed to a more global settings in Configuration.

admin
Site Admin
Posts: 64915
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Always show folders sizes as a script

Post by admin »

klownboy wrote: 06 Dec 2024 18:24 I'm not so sure that's a bad thing especially if the user is only using a single pane...and it was a pretty quick as reflected in the status bar whereas the change via Config went on and on and on...
It may not always be a bad thing, but it's a bug that needs to be fixed.

kiwichick
Posts: 648
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

Re: Always show folders sizes as a script

Post by kiwichick »

admin wrote: 06 Dec 2024 14:57 Possible:

Code: Select all

settingp "showfoldersizeinlist", 1; //Always show folder sizes -> ON

settingp "showfoldersizeinlist", 0; //Always show folder sizes -> OFF
Perfect. Thanks, Don.
Windows 10 Pro 22H2

kiwichick
Posts: 648
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

Re: Always show folders sizes as a script

Post by kiwichick »

admin wrote: 06 Dec 2024 14:57

Code: Select all

settingp "showfoldersizeinlist", 1; //Always show folder sizes -> ON
settingp "showfoldersizeinlist", 0; //Always show folder sizes -> OFF
So this is the code I came up with for my custom button:

Code: Select all

$a = getkey("ShowFolderSizeInList", "Settings"); 
	if ($a == 0) {
		setkey "1", "ShowFolderSizeInList", "Settings";
		settingp "showfoldersizeinlist", 1;
	} 
	else {
		setkey "0", "ShowFolderSizeInList", "Settings";
		settingp "showfoldersizeinlist", 0;
	}
What have I done wrong? It works when I use it in Run Script and Run Script Again but when I use it in a custom button, it displays as a 'menu':
2024-12-08_142420.png
2024-12-08_142420.png (17.87 KiB) Viewed 3051 times
If I add a 'title', it works and also if I comment out the title:

Code: Select all

// "Toggle Always Show Folder Sizes"
  $a = getkey("ShowFolderSizeInList", "Settings"); 
  if ($a == 0) {
    setkey "1", "ShowFolderSizeInList", "Settings";
    settingp "showfoldersizeinlist", 1;
    ctbstate(1);
  } 
  else {
    setkey "0", "ShowFolderSizeInList", "Settings";
    settingp "showfoldersizeinlist", 0;
    ctbstate(0);
  }
Windows 10 Pro 22H2

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

Re: Always show folders sizes as a script

Post by highend »

Missing indentation
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 64915
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Always show folders sizes as a script

Post by admin »

I still wonder why you want to toggle "Always show folder sizes" as a script. You know there is a built-in toolbar button to toggle it for the current list?

kiwichick
Posts: 648
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

Re: Always show folders sizes as a script

Post by kiwichick »

highend wrote: 08 Dec 2024 08:16 Missing indentation
Where? If you look at the first block of code I posted, it is well and truly indented.
Windows 10 Pro 22H2

kiwichick
Posts: 648
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

Re: Always show folders sizes as a script

Post by kiwichick »

admin wrote: 08 Dec 2024 12:14 I still wonder why you want to toggle "Always show folder sizes" as a script. You know there is a built-in toolbar button to toggle it for the current list?
Because, as you said, the toolbar button is only for the current list. So if I then want to view sizes in subfolders, or another folder, or return to the original folder, I have to keep pressing that button. So I temporarily turn always show on for as long as I need it and then turn it off again.
Windows 10 Pro 22H2

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Always show folders sizes as a script

Post by jupe »

Your issue is likely a trailing space on the first line, CTBs support many different things, so to match it as being a script automatically, it needs to follow certain criteria.

kiwichick
Posts: 648
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

Re: Always show folders sizes as a script

Post by kiwichick »

jupe wrote: 08 Dec 2024 22:13 a trailing space on the first line
Yes!!!! That's what it was. Thank you so much 😁👍 Although, it would be nice if it was mentioned in the help file under Custom Toolbar Buttons about trailing spaces. I can't find any mention of it there.
Windows 10 Pro 22H2

Post Reply