I was away from dopus for a long time and it would take me a while to figure out the whole scripting stuff myself hence I'm asking for a ready solution.
if lister height > lister width then open Viewer Pane in vertical layout (Viewer under lister)
else horizontal layout (viewer to the right)
Option Explicit
Function OnClick(ByRef clickData)
Dim lister
Set lister = clickData.func.sourcetab.lister
if lister.viewpane > 0 then
clickData.func.command.RunCommand "Set VIEWPANE=off"
else
Dim w, h
w = lister.right - lister.left
h = lister.bottom - lister.top
if w > h then
clickData.func.command.RunCommand "Set VIEWPANE=vert"
else
clickData.func.command.RunCommand "Set VIEWPANE=horiz"
end if
end if
End Function