[REQ] Level column for items

Can you add a new "Column" to display items levels ?
Why ? I often use flat view grouped and need to know items level.

Look at this...

Now that is possible to create custom column, I try to do this with script.
But I have a first problem, how i can determinate the current path, tab.path do nothing :blush: ?

Try this Custom Column - Flat folder level.

I try to convert my script to the new OnAddColumns method.

So I have...

option explicit

Function OnInit(initData)
        initData.name = "ColonneNiveau"
        initData.desc = "Ajoute une colonne 'Niveau' pour afficher la
profondeur des dossiers."
        initData.copyright = "2014 Albator V (Michiels Thomas)"
        initData.min_version = "11.5.1" 
        initData.version = "v1.0"
        initData.default_enable = false
        initData.config.PremierNiveau = "1"

        Dim col

        Set col = initData.AddColumn
        col.name = "Niveau"
        col.method = "OnNiveau"
        col.label = "Niveau"
        col.header = "##"
        col.justify = "right"
        col.type = "number"
        col.autogroup = true
End Function

Function OnNiveau(scriptColData)
        scriptColData.value =
(ubound(split(replace(scriptColData.item.realpath,
scriptColData.tab.path, ""),"\"))) + (script.config.PremierNiveau - 1)
End Function

I write this...

option explicit

Function OnInit(initData)
        initData.name = "ColonneNiveau"
        initData.desc = "Ajoute une colonne 'Niveau' pour afficher la
profondeur des dossiers."
        initData.copyright = "2014 Albator V (Michiels Thomas)"
        initData.min_version = "11.5.7" 
        initData.version = "v2.0"
        initData.default_enable = false
        initData.config.PremierNiveau = "1"
End Function

Function OnAddColumns(addColData)
        Dim col

        Set col = addColData.AddColumn
        col.name = "Niveau"
        col.method = "OnNiveau"
        col.label = "Niveau"
        col.header = "##"
        col.justify = "right"
        col.type = "number"
        col.autogroup = true
        
        addColData.value =
(ubound(split(replace(addColData.item.realpath, addColData.tab.path,
""),"\"))) + (script.config.PremierNiveau - 1)
        
End Function

But I have error with addColData.item.realpath :frowning:

You still need to do that in the OnNiveau function.

Sorry Jon but I don't understand...

I want to convert my script because of this...

I understand that disable script in Prefs hide column in folders options list.

In your bottom script, in the OnAddColumns function, you have col.method = "OnNiveau", but the script does not have an OnNiveau function, so that isn't going to work.

You are telling Opus to use a function for that column but the function does not exist in your script

ok, I understand now...

option explicit

Function OnInit(initData)
	initData.name = "ColonneNiveau"
	initData.desc = "Ajoute une colonne 'Niveau' pour afficher la profondeur des dossiers."
	initData.copyright = "2014 Albator V (Michiels Thomas)"
	initData.min_version = "11.5.7"	
	initData.version = "v2.0"
	initData.default_enable = false
	initData.config.PremierNiveau = "1"
End Function

Function OnAddColumns(addColData)
	Dim col

	Set col = addColData.AddColumn
	col.name = "Niveau"
	col.method = "OnNiveau"
	col.label = "Niveau"
	col.header = "##"
	col.justify = "right"
	col.type = "number"
	col.autogroup = true
End Function

Function OnNiveau(scriptColData)
	scriptColData.value = (ubound(split(replace(scriptColData.item.realpath, scriptColData.tab.path, ""),"\"))) + (script.config.PremierNiveau - 1)
End Function

I'm back with this script...

I try to understand why OnScriptConfigChange method doesn't update my
column after changing script option.

I have 2 issues...

  • If column is display (left align) then change option 'Decalage' from
    "false" to "true", nothing happen. If I press F5, new values are display
    in column (right align).
  • Now, go back to "false", hide column then add it again, nothing has
    changed until I press F5.
    ColonneNiveau.vbs.txt (1.4 KB)