Page 1 of 2
Always show folders sizes as a script
Posted: 06 Dec 2024 03:35
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?
Re: Always show folders sizes as a script
Posted: 06 Dec 2024 13:59
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;
Re: Always show folders sizes as a script
Posted: 06 Dec 2024 14:57
by admin
Possible:
Code: Select all
settingp "showfoldersizeinlist", 1; //Always show folder sizes -> ON
settingp "showfoldersizeinlist", 0; //Always show folder sizes -> OFF
Re: Always show folders sizes as a script
Posted: 06 Dec 2024 17:22
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).
Re: Always show folders sizes as a script
Posted: 06 Dec 2024 17:55
by admin
Hmm, probably a bug in settingp "showfoldersizeinlist". It should update both panes, not only the active one.
Re: Always show folders sizes as a script
Posted: 06 Dec 2024 18:24
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.
Re: Always show folders sizes as a script
Posted: 07 Dec 2024 10:11
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.
Re: Always show folders sizes as a script
Posted: 08 Dec 2024 00:49
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.
Re: Always show folders sizes as a script
Posted: 08 Dec 2024 02:28
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 (17.87 KiB) Viewed 3058 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);
}
Re: Always show folders sizes as a script
Posted: 08 Dec 2024 08:16
by highend
Missing indentation
Re: Always show folders sizes as a script
Posted: 08 Dec 2024 12:14
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?
Re: Always show folders sizes as a script
Posted: 08 Dec 2024 21:48
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.
Re: Always show folders sizes as a script
Posted: 08 Dec 2024 21:51
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.
Re: Always show folders sizes as a script
Posted: 08 Dec 2024 22:13
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.
Re: Always show folders sizes as a script
Posted: 09 Dec 2024 00:21
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.