OverrideFormats - an event based DO extension, which allows to override the folder format chosen by DO (or switch viewmode and columns only).
Since v0.3, the expression syntax has changed. Now functions are used to set view/format etc.
This extends the currently available content-type detection in DO by also taking the number of folders and files into account (e.g.). You can configure simple expressions (rules), to define when to use what viewmode or folder-format. So in case you always want folders containing more than 1000 files to use details mode, here you go.
- Black listing of folders (regex based)
- White listing of folders (regex based)
- Call additional commands after folderchange
- Debug output (to help nail down any problems with black/white lists and your expressions)
The most important thing to know is, how to setup things in the scripts config section under "Expressions". There, you have predefined getter-variables to check the situation. These are "data" (=OnBeforeFolderChangeData), "folderCount", "fileCount", "curView" and "curPath" (which is the DO path object). There's an ifPath() and ifLabel() function as well to tests for paths and drive labels easily (watch default expression for example).
To override a format, there are several function available to modifiy the lister appearance since v0.3:
addCol() - to add a column
remCol() - to remove a column
setView() - to set a view mod (accepts any option of the "Set VIEW" command)
setFormat() - to set a folder format (accepts any option of "Set FORMAT" or "Set CONTENTFORMAT")
setPat() - to switch a path
noQuit() - to not quit on evaluation
Watch these two examples..
[code]//use details view, if more than 3 folders)
folderCount>3 && setView('details')
//switch path to C:\ for empty folders o)
folderCount==0 && fileCount==0 && setPath('C:\')[/code]
I won't go into details on how to setup the black and whitelists for folders, you can disable these lists completly or simply put regular expressions in there to restrict the overrider to special locations. There are some sensible regular expressions already included. In case you mess up an expression or folderlist, you'll find errors in the console if debug output is enabled. So go and check this place in case things do not work as expected. If enabled, the whitelist is going to override the blacklist.
Demo-Output - showing all crucial details and expression evaluation results:
To install the script, download the *.js.txt file below and drag it to Preferences / Toolbars / Scripts.
Comments and bug reports welcome. o)
[ul][li]Latest: v0.3.2 - prevent exception for "empty" command object, ifPath() method non-casesensitive:
Event.GUI_OverrideFormats.js.txt (37.7 KB)
[li]v0.3.1 - added ifLabel() to enable format/column/viewmode changes for specific drivelabels:
Event.GUI_OverrideFormats.js.txt (36.9 KB)
[li]v0.3 - usage of data.tab.format.locked, supports onafterfolderchange event, allows adding/removing of columns, supports updates/scriptwizard:
Event.GUI_OverrideFormats.js.txt (18.1 KB)[/li][/ul]