I would like to suggest an extension to the ScriptColumn feature. Being able to dynamically assign configuration values.
There are a few ScriptColumn that have been created that contain configuration on a per column basis. For example one of the many regexp columns regex columns reloaded, and custom-text. These scrips are all configurable in that extra custom columns can be added by editing the script config, often stored in the script file.
Adding a new type of ScriptColumn that supported assigning configuration values would make these easier to create in a flexible way and easier to use. The column could be configured via customised Script Dialogs.
For example the user selects the newest file column. They display the columns script dialog, where they select recursive and some other setting, like a filter and how to output the results.
Or I might add two regexp columns and similarly configure them as needed. Displaying columns script dialog and entering the regexp and other settings.
I think configuring script columns at the moment you turn them on (vs configuring which columns the script provides in advance, e.g. from the script's Config dialog) would make things complicated for both users and script authors.
It needs to be possible to turn columns on and off (without a dialog appearing every time) via commands. The commands would need a way to pass the custom configuration to the script in text format, and the user and script would need a way to get the text version of the configuration.
When config wasn't passed, I think this idea would end up triggering a dialog in unexpected places.
You might be able to make a script that has a toolbar button (or menu item etc.) you can click to add new columns. That could show a custom dialog, then save the details of the column, add the column to Opus (via Script.InitColumns), and even turn the column on as the last step. I think that would be a better way to do what you're looking for.
I had some success getting this to work.
I adapted a script that supports custom xml-and-xpath-columns. I moved the column config from being hard coded in the script to a script-defined variable. I would have preferred using the ScriptConfig but I think this is readonly to the script?
This dialog configures the columns, it is triggered by a button. The Apply Changes button saves the changes (to a variable) and triggers a refresh of the ** custom column**. This makes testing column configurations pretty easy.
A little drawback is the lose coupling between a button somewhere and a mystic script variable.
Well, the script var is not that mystic anymore once you know about it, but some people might wonder where their configuration is stored. It would be nice though, if a script could write into its own (or others) ScriptConfig items.
To get some tighter relation between script and button:
The external toolbar button which brings up your custom dialog to edit the columns could also be launched by the "i" icon in the scripts section of the prefs (OnAbout() functionality), but the "i" is actually still not the right place. A custom "gear" icon in the script prefs to trigger custom config dialogs would be best. o)
To a user, it won't matter if the config is stored in a ScriptConfig object or a Var object. It's all mystic behind-the-scenes details that they won't even be aware of.
Allowing scripts to display their own dialogs in place of the generic script config dialog might make sense, though. I think we'd need to see more than one script that could benefit from it for it to be worth implementing, but it's something we should keep in mind and is certainly a good idea.