Question: Button for "Automated Folder Size"

Ditto. And I hope to see many more interesting ideas posted to the Scripting forum. I have been doing a bit of experimenting too and except to have something in a fit state (i.e. properly documented) to add soon. I'm sure we can all learn a lot from each other.

Regards, AB

I've got a few sample script ready to share - but would like to package into an OSP. Just wondering about how to specify the icon for a .OSP archive.

thx @ leo + steje

Dumb question: how can I use the new switch ?

Set CALCFOLDERSIZES=toggle seems to do nothing here (actually no parameter seems to change anything)

thanks,
t.

How strange - confirmed. Seems to be busted now in a quick test, but I could have sworn it worked when I tried it immediately after Beta 5 released.

At any rate, my version works :slight_smile:

Toggle by itself doesn't work, because if the option is turned off Opus doesn't know what setting you want to toggle it on to. You need so specify toggle in conjunction with one of the other keywords (e.g. Set CALCFOLDERSIZES=local,toggle).

I tried some variations, including the one from the helpfile (Set CALCFOLDERSIZES=local,toggle,skipjunctions) without luck.
Even CALCFOLDERSIZES=local does not work here.

How are you determining that it doesn't work? (i.e. what are you expecting to see?)

Neither the calculation starts nor the prefs setting change.

It's working fine here. (I tried Set CALCFOLDERSIZES=local,toggle.)

Note that you will not see folder sizes calculated until you refresh or change folders (since that is when automatic calculation happens, if it is on).

Also note that you won't see the Preferences option change if the Preferences dialog is open when you change it. (Cancel the dialog and re-open Prefs, and you should see it has changed. OTOH, if you click OK then you will overwrite the setting with what's shown in the Preferences dialog.) This is the same for most commands which toggle Preferences settings. The Preferences dialog takes a snapshot of the configuration, which you can then edit in the dialog, and finally either cancel (throwing away the snapshot) or apply (saving the snapshot over what the main program actually uses).

ok, that probably bluffed me. It is working now, thanks.
Is there a way to refresh the folder by script ?

Go REFRESH=source or similar.

But you could just run GetSizes if that's your aim.

A few comments... and one question:

@Leo / Jon: For some reason, doing a 'Go REFRESH' after toggliing this option on doesn't work in [u]THE DEFAULT FOLDER [/u] opened when opening a new tab. Maybe that is something you'd consider a small bug? Also, what's the local option intended to do? I though maybe it was to operate only in the lister in which the option is toggled on on like my script or something, but that doesn't seem to be the case? I didn't have access to a network share in case it's for 'local' drives and not remote...?

@FunTanK: Leo's spot on, but depending on what their opinion on this is one potential drawback in doing a 'go refresh' is that it will lose whatever folder selection you may have made. Doing an explicit 'GetSizes' would also only calculate the 'selected' folders size.

In my script-based solution for this, I expected that most people who were turning the option on probably wanted all folders in the current folder to be calculated (at the moment the button is pressed to toggle auto sizing on). So in my version, I've implemented a variation on Jon's 'SmartGetSizes' command as a raw command that gets added to Opus which allows a GETALL option so that all folder sizes are calculated, regardless of any folders being selected or not, and also carried the NODESELECT option into this command so you don't lose whatever folder selection might be in effect when you run the command.

If that's of interest to you, I've attached here only the portion of my full solution which adds that new raw command (SmartGetSizes - all credit to Jon for the working code and name of the command :wink:). You can then create your toggle button, and end the button with the command SmartGetSizes GETALL NODESELECT. To install the new command, just drag and drop the script OSP file attached to this post from a lister to the Preferences / Toolbars / Scripts page. After hitting Ok, you should then see 'SmartGetSizes' as an available command in the button editor and Customize->Commands dialog:

ScriptCommand_smartgetsizes.osp (1.8 KB)

I'm not sure exactly what you mean, but I opened a new tab, ran the command (without changing to a second folder), and it worked fine.

The command is for setting these options and specifying local selects one of the modes from the drop-down:

Ah, yeah ok - made sense and figured it was for local drives. Just couldn't test to verify it when I posted.

Anyway, I did some more testing - and it's obviously got nothing to do with the 'Set' command itself so much as the Prefs option it toggles. It looks like Opus treats the root of a library as a 'network' folder, at least - the only way I can get the sizes auto-calculated when I am listing the root of a lib, is to set the option to include network drives... If I set the default folder to anything else, it works on open with the option on. So there seems to be an issue - just not specific to "default folder" like I thought.

When toggling to on, no folders will be calculated until folder-change (bug or by design?). Adding Getfoldersize to the command doesn't work for all folders if you have one selected.

All it does is change the Prefs option.

Could you add an automatic calc when toggling on? Normally you activate it when you want to calc the current folders, not before changing to them.

This was explained, and a method to do that if it's what you want, earlier in the thread.

Ah, to be honest, I did not read all, so I missed that. Sorry.