Folder sizes calculated on demand with a single click

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Brano
Posts: 38
Joined: 08 Jul 2024 11:52

Folder sizes calculated on demand with a single click

Post by Brano »

What about this:
In the size column, filesizes are calculated automatically as usual but the size of a particular folder would be calculated on demand when the size column for that particular folder is clicked.

It can be done currently with a keyboard shortcut but that requires AFAIK two clicks and two hands (one for the keyboard, one for the mouse). If this was implemented it would be much more comfortable and faster IMO. For example in Custom Event Actions, there could be a "Size column left/right click" for this. I would'n want to use whole row item middle clicks just for this.

I am was trying to script this with Extra columns and Custom columns but I have not found a way. Do you think it could be scripted somehow? Remember, it all needs to be shown within a single column. Or is there actually something like this?

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

Re: Folder sizes calculated on demand with a single click

Post by highend »

If you don't want it as a keyboard shortcut put the script on a button / in the catalog? Requires only one click.

Apart from that a scripted custom column that would execute the recalculation but this can't be combined with the displayment of the size in the same column...
One of my scripts helped you out? Please donate via Paypal

Brano
Posts: 38
Joined: 08 Jul 2024 11:52

Re: Folder sizes calculated on demand with a single click

Post by Brano »

Thanks.

Actually still two clicks: one click to select a folder, the second click to calculate. But it is just one hand so better.

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

Re: Folder sizes calculated on demand with a single click

Post by highend »

Not with a cc column, it's only a single click necessary...
One of my scripts helped you out? Please donate via Paypal

Brano
Posts: 38
Joined: 08 Jul 2024 11:52

Re: Folder sizes calculated on demand with a single click

Post by Brano »

I've made it like this. It is not a click into the very column that shows the sizes but is very good anyway.

Image

A question - how can I change the default green icon? Haven't found anything on this.

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

Re: Folder sizes calculated on demand with a single click

Post by highend »

Probably hardcoded, it doesn't exist in the resource graphic file...
One of my scripts helped you out? Please donate via Paypal

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

Re: Folder sizes calculated on demand with a single click

Post by admin »

It's a live drawing, a circle and a triangle.

GreetingsFromPoland
Posts: 283
Joined: 29 Sep 2022 14:20
Location: Win10 @125%

Re: Folder sizes calculated on demand with a single click

Post by GreetingsFromPoland »

update i was able to get what i wanted using this return formatbytes(foldersize(,"<b>"), "FLEX"); in the column script.
Brano wrote: 13 Jul 2024 13:11 I've made it like this. It is not a click into the very column that shows the sizes but is very good anyway.
hi! this is very cool. currently i have "Folder Sizes" (#487;) in my Hamburger menu but i may try this approach.

would you mind sharing/posting the script commands you used for the sizes ? i can't seem to get the formatting correct using foldersize(), maybe there is another way.
thanks!
Last edited by GreetingsFromPoland on 13 Jul 2024 15:44, edited 1 time in total.

Brano
Posts: 38
Joined: 08 Jul 2024 11:52

Re: Folder sizes calculated on demand with a single click

Post by Brano »

admin wrote: 13 Jul 2024 15:26 It's a live drawing, a circle and a triangle.
And can it be customized somehow? If I put something inside the script it gets ofcourse executed on a click so the green button is there from the start.

Brano
Posts: 38
Joined: 08 Jul 2024 11:52

Re: Folder sizes calculated on demand with a single click

Post by Brano »

GreetingsFromPoland wrote: 13 Jul 2024 15:35would you mind sharing/posting the script commands you used for the sizes ? i can't seem to get the formatting correct using foldersize(), maybe there is another way.
thanks!
Here is the code. It is super simple. The if is there for multiple item selection.

Code: Select all

 if !<cc_isselected> {
   selectitems <cc_item>;
 }
 load "#487",,s; 
 return "";
 
The trick is I am not using this CC for displaying the sizes. I display them in the regular Size column. I just put the CC next to the Size column and make it narrow. I tried showing the sizes in a custom column and this way is better. It keeps a proper formatting, keeps folders+files in the same column and reacts as expected to Refresh.
Last edited by Brano on 13 Jul 2024 15:46, edited 1 time in total.

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

Re: Folder sizes calculated on demand with a single click

Post by admin »

Nope.

Brano
Posts: 38
Joined: 08 Jul 2024 11:52

Re: Folder sizes calculated on demand with a single click

Post by Brano »

admin wrote: 13 Jul 2024 15:44Nope.
So consider it a FR please. One reason is aesthetical. For this particular application if only the button was yellow, the same as the folder icons.

The another reason would be if I have for some reasons many custom columns like this next to each other it gets confusing.

Image

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

Re: Folder sizes calculated on demand with a single click

Post by admin »

Not planned.

Brano
Posts: 38
Joined: 08 Jul 2024 11:52

Re: Folder sizes calculated on demand with a single click

Post by Brano »

I've put some effort to this:

Image

It needs two columns.

One extra column:

Code: Select all

  //a string for a button in the extra column
  $buttonEmpty = "◁";
  $buttonFull = "◀";

  //limit to folders
  if property("#2", <extra_item>)=="File folder" { 
    selectitems <extra_item>;
    load "#487",,s;
    //set extra column label
    extratag(1,"$buttonFull Folder size (right-click to calculate)" );
    return $buttonFull;
  }
and one custom column

Code: Select all

 //a string for a button in the extra column
 $buttonEmpty = "◁";
 $buttonFull = "◀";
 
 $anyChange = FALSE; 

 //run only onece per whole folder
 if <cc_index>==1 {
   
   //reset Ex1---------------------------------------
   //get all subfolders
   $content = folderreport("dirs", "r",,,,"|",);       
   //set extra columns
   foreach ($i, $content) {
     if tagitems("ex1",, $i)!=$buttonEmpty {
       tagitems("ex1", $buttonEmpty, $i);
       $anyChange = TRUE;
     }
   }
   //set extra column label; no use, causes a flick
   extratag(1,"$buttonEmpty Folder size (right-click to calculate)" );

   if $anyChange {
     //refreshlist;        
   }
 }
There is a bit of a problem with a flick each time the list is refreshed and a change is made.

Brano
Posts: 38
Joined: 08 Jul 2024 11:52

Re: Folder sizes calculated on demand with a single click

Post by Brano »

Brano wrote: 14 Jul 2024 14:34 There is a bit of a problem with a flick each time the list is refreshed and a change is made.
I've found this happens when stuff is changed this way, programatically. Would you know about any solution to this?

Post Reply