Why CC may be not auto-refreshed?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
eil
Posts: 1617
Joined: 13 Jan 2011 19:44

Why CC may be not auto-refreshed?

Post by eil »

As topic name states, or in other words how to properly set CC so it auto-refreshs on visiting location.
I have СС with Type = Script, Format = Icon, Item Type = Files and Folders. The script creates a coloured ribbon depending of items size, the size calculation if cached so it's always available. But for some reason no matter if i use Trigger = List or Browse - the column is never fully filled and i have to manually refresh each visit. As Help states Browse should create whole column on visit, List ought to create only for part of items currently visible in List and get filled along the scroll of user - but both don't work fully/properly, so obviously i'm doing smth wrong.
Win 7 SP1 x64 100% 1366x768

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

Re: Why CC may be not auto-refreshed?

Post by jupe »

eil wrote: 28 Mar 2023 00:16 the size calculation if cached so it's always available.
You probably need to post the script. For example how are you only referencing sizes from the cache, because that makes me assume then you are talking about folders only, because filesizes aren't cached, I don't think I understand what you meant though. You'd definitely need to use Browse trigger to have them all returned, not List. Something you could check though is your CEA browse events, they could possibly cause a conflict.

eil
Posts: 1617
Joined: 13 Jan 2011 19:44

Re: Why CC may be not auto-refreshed?

Post by eil »

jupe wrote: 28 Mar 2023 03:10 Something you could check though is your CEA browse events, they could possibly cause a conflict.
I don't recall having any CEA for browsing, but can you pleae be more specific which should be checked for possible conflict?

Here's the CC script:

Code: Select all

$size = "<cc_size>";
  $min = 1;
  switch (true){
  case $size == 0: return ''; // draw nothing
  case $size < 1024: return '>draw.bar ' . 100 * $size \ 1024 + $min . ', E0E2ED'; //smaller 1KB  grey
  case $size < 102400: return '>draw.bar ' . 100 * $size \ 102400 + $min . ', D500FA, E0E2ED'; //smaller 100KB  violet
  case $size < 1048576: return '>draw.bar ' . 100 * $size \ 1048576 + $min . ', 7B20A3, D500FA'; //smaller 1MB  indigo
  case $size < 104857600: return '>draw.bar ' . 100 * $size \ 104857600 + $min . ', 304FFF, 7B20A3'; //smaller 100MB  blue
  case $size < 1073741824: return '>draw.bar ' . 100 * $size \ 1073741824 + $min . ', 13DD17, 304FFF'; //smaller 1GB  green
  case $size < 10737418240: return '>draw.bar ' . 100 * $size \ 10737418240 + $min . ', FFFF01, 13DD17'; //smaller 10GB  yellow
  case $size < 53687091200: return '>draw.bar ' . 100 * $size \ 53687091200  + $min . ', FF7900, FFFF01'; //smaller 50GB  orange
  case $size < 1099511627776: return '>draw.bar ' . 100 * $size \ 1099511627776  + $min . ', FE0000, FF7900'; //smaller 100GB  orange
  ;default: return '>draw.bar ' . 100 * $size \ 1099511627776 + $min . ', FE0000, FF7900'; //from 100GB to 1TB  red
So CC can't work with cached sizes? Then how Refresh on column makes it work, though no recalculation of folders was made?..

The CC settings:
2023-03-28_151054.png
2023-03-28_151054.png (20.65 KiB) Viewed 284 times
When i visit location with this column added, first i see this:
2023-03-28_151225.png
2023-03-28_151225.png (19.2 KiB) Viewed 284 times
after Refresh on column, coloured ribbons appear on folders too.
Win 7 SP1 x64 100% 1366x768

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

Re: Why CC may be not auto-refreshed?

Post by jupe »

I just asked how you were getting sizes, because there are alternate ways that don't read cached sizes, and you made it sound like just random items were returning blank, I inferred it was folders only that weren't working and was checking if I was correct.

When I say CEA Browse I mean any of the 3 CEA Changing Location events, but now after seeing the issue properly, I am skeptical they would have on influence.

Either you just didn't post it, or the script is missing a closing curly brace }, also why has the last default line got a ; prefix?, both could be a factor. If after correcting those it still doesn't work, as a troubleshooting step, try changing the first line to this:

$size = <cc_isfolder> ? foldersize(<cc_item>, "<r>") : <cc_size>;

eil
Posts: 1617
Joined: 13 Jan 2011 19:44

Re: Why CC may be not auto-refreshed?

Post by eil »

jupe wrote: 28 Mar 2023 21:22 When I say CEA Browse I mean any of the 3 CEA Changing Location events, but now after seeing the issue properly, I am skeptical they would have on influence.
Nope, none of that.
jupe wrote: 28 Mar 2023 21:22 Either you just didn't post it, or the script is missing a closing curly brace }, also why has the last default line got a ; prefix?, both could be a factor. If after correcting those it still doesn't work, as a troubleshooting step, try changing the first line to this:

$size = <cc_isfolder> ? foldersize(<cc_item>, "<r>") : <cc_size>;
Indeed closing } was lost and ; probably was a miss-use of commenting a command while experimenting(sometimes a forget which script lang uses what sign for comments). Still after fixing those 2, situation didn't change.
Your code proposition seem to work, bars start to show, but 2 "problems" arise:
1. it involves actual calculation each time location is visited, which not only involves additional I/O, which i try to escape with cached sizes use, but yet the opening of location takes some noticeable time;
2. when i use initial script and bars don't show for folders, a mere use of Refresh on CC gets all bars in a moment = not only that's faster for location opening speed, yet no calculation is involved.
So i'm back to initial "question": why CC doesn't show bars from the start if Refresh doesn't seem to actually do any extra calculations. Feels like XY may have some flaw in co-working of CC and cached sizes, so CC doesn't actually get caches on visit and reads those only on Refresh(maybe smbd can check/prove that).
Win 7 SP1 x64 100% 1366x768

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

Re: Why CC may be not auto-refreshed?

Post by jupe »

I realise all that, that's why I wrote "as a troubleshooting step", not "change the script to this". From your description and the test you just ran, I agree from your symptoms that it looks like cc_size is getting the cached values too late, but I haven't tested it since I don't use folders sizes myself, maybe someone else can, or you could in fresh to see if you get the same result.

eil
Posts: 1617
Joined: 13 Jan 2011 19:44

Re: Why CC may be not auto-refreshed?

Post by eil »

Tried on fresh: added CC with same script, enabled "Cache Folder Sizes" and "Show Folder Sizes Only" options = column works fast and always without Refresh. That proves that XY has no any problem between CC and cached sizes, but sadly doesn't help me to understand what is interfering in my settings.(and finding one by some random tries is almost impossible)
Guess problem will stay unsolved, but still thank you for you time and answers, @jupe.

ADD: Veeery strange, observation. I tried to delete CC from folder view, then added empty one and set CC profile with same script, plus enabled same cache-use setting in right click menu of Size column, lastly saved this as new folder view = and without any explanation it seem to start working.(tried to get in location through different ways, reloaded XY to be sure - ribbons appear in a moment)
But, there is still some bug/inconsistency in this.! If i select other location, set Detailed view, add CC column with already preset script(from that list in menu showing top 5 of all the CCs) = this column will same as before not show ribbons until Refresh is used. Just decided to describe this experiment, as maybe in some future it will become more obvious where is the flaw.
Win 7 SP1 x64 100% 1366x768

Post Reply