Script to close curent and open new specified lister

Herewith a script which will pop up a dialogbox prompting for a lister name.
Upon entry of the new lister name the current lister is closed and that new specificed lister is opened
With thanks for inspiration from yonder, aussieboykie and leo in this post:

@script vbscript
Function OnClick(ByRef clickData)

  Set dlg = DOpus.Dlg
  ' Initialise the object to display a message with three buttons, one of which is a drop-down with multiple choices
  ' This dialog also has a warning icon, a text field allowing the user to enter a line of text,
  ' and two checkboxes which the user can turn on or off.
  dlg.window = DOpus.Listers(0)
  dlg.message = "You have to have this" & vbCrLf & "second line is optional"
  dlg.title = "Enter Lister Name"
'  dlg.buttons = "First Choice|Second Choice+Third Choice+Fourth Choice|Cancel"
'  dlg.icon = "warn"
  dlg.max = 128  ' enable the text field
'  dlg.options(0).label = "Checkbox option 1"
'  dlg.options(1).label = "Checkbox option 2"
' Show the dialog and print the results to the script log
  ret = dlg.Show
  DOpus.Output "Dialog.Show returned " & ret
  DOpus.Output "The string you entered was " & dlg.input
'  DOpus.Output "The two checkboxes were set to " & dlg.options(0).state & " and " & dlg.options(1).state

    Dim cmd
    set cmd = clickData.Func.command
    cmd.RunCommand("Prefs LAYOUT " & dlg.input)

End Function
1 Like

You may not scripting for this, depending on exactly what you want to do.

This is why I was asking what you want to do in the other thread.

For example, this will open a named layout and close all other listers on its own:


OTOH, if you only want to close the active window and leave others alone, you may be able to apply the desired changes to that window instead of closing it and opening a new one (which takes longer and doesn't look as nice). But it depends on what you want this for, which we still don't know.

Hi Leo
Sorry to an extent I do not know what I want either :slight_smile:
An easy life!!
I had been using the switch to close all listers when opening a new one but that was not what I wanted.
I know that Styles repesent a possible alternative but I have not had time to research them yet.
I have many layouts predefined over many months/years so I have some momentum with them.
I guess I could state me objective like this:
I want to change from one lister setup with several tabs displaying specific locations to another lister with it's own tabs and locations displayed easily, quickly.
I have other attributes associated with my named listers e.g. filters but mostly it is an orderd set of tabs named and displaying defined folder locations.
I became aware from a post of yours recently that Styles were a possible alternative.
Looking at Help > Preferences > Preferences Categories > Layouts and Styles it does seem that I can do this with Styles.
Maybe I should have paid more attention to your question!!!
Leo I appreciate your endless contibution to these forums I have had so much help form you for many years now thank you sir.

Use Folder Tab Groups for that. Layouts and Styles are overkill if you just want to change which folders the lister is showing.

Thanks Leo
What would the raw command be to open a tab group?

Would the raw command to load a tab group be...?


It would see so from the Go raw command reference...