Page 1 of 3

Folder sizes calculated on demand with a single click

Posted: 12 Jul 2024 20:12
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?

Re: Folder sizes calculated on demand with a single click

Posted: 12 Jul 2024 20:16
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...

Re: Folder sizes calculated on demand with a single click

Posted: 12 Jul 2024 20:31
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.

Re: Folder sizes calculated on demand with a single click

Posted: 12 Jul 2024 20:38
by highend
Not with a cc column, it's only a single click necessary...

Re: Folder sizes calculated on demand with a single click

Posted: 13 Jul 2024 13:11
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.

Re: Folder sizes calculated on demand with a single click

Posted: 13 Jul 2024 14:57
by highend
Probably hardcoded, it doesn't exist in the resource graphic file...

Re: Folder sizes calculated on demand with a single click

Posted: 13 Jul 2024 15:26
by admin
It's a live drawing, a circle and a triangle.

Re: Folder sizes calculated on demand with a single click

Posted: 13 Jul 2024 15:35
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!

Re: Folder sizes calculated on demand with a single click

Posted: 13 Jul 2024 15:39
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.

Re: Folder sizes calculated on demand with a single click

Posted: 13 Jul 2024 15:43
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.

Re: Folder sizes calculated on demand with a single click

Posted: 13 Jul 2024 15:44
by admin
Nope.

Re: Folder sizes calculated on demand with a single click

Posted: 13 Jul 2024 15:51
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

Re: Folder sizes calculated on demand with a single click

Posted: 13 Jul 2024 18:48
by admin
Not planned.

Re: Folder sizes calculated on demand with a single click

Posted: 14 Jul 2024 14:34
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.

Re: Folder sizes calculated on demand with a single click

Posted: 14 Jul 2024 14:39
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?