Occasionally I want to temporarily resize a Lister but revert back to the previous size. To make this simpler (not having to manually resize) I've written a couple of very basic script buttons to assist.
The first button copies the current Lister's dimensions (storing the data as a global variable) and the second resizes the last active Lister to those stored dimensions.
Because these scripts work on the last active Lister and the dimensions are stored globally within Opus you could also use them to copy the dimensions of one Lister and change the size of another Lister to match it.
The first button sends the Width and Height to the Script Log - in case you just want to see the results.
Store Lister Size
function OnClick(clickData)
{
listers = DOpus.Listers;
lister = listers.lastactive;
left = lister.left;
right = lister.right;
top = lister.top;
bottom = lister.bottom;
width = right - left;
height = bottom - top;
DOpus.ClearOutput();
DOpus.Output('Width : ' + width);
DOpus.Output('Height : ' + height);
DOpus.Vars.Set('width') = width;
DOpus.Vars.Set('height') = height;
}
Recall Lister Size
function OnClick(clickData)
{
if (!DOpus.Vars.Exists('width') || !DOpus.Vars.Exists('height'))
{
mtVariables();
return;
}
cmd = clickData.func.command;
width = DOpus.Vars.Get('width');
height = DOpus.Vars.Get('height');
cmd.RunCommand('Set LISTERSIZE=' + width + ',' + height);
}
function mtVariables()
{
listers = DOpus.Listers;
lister = listers.lastactive;
dlg = DOpus.Dlg;
dlg.window = lister;
dlg.message = "You need to run the Store Lister Size button first!";
dlg.title = "No Stored Lister Size";
dlg.Buttons = "Ok";
dlg.Show;
}
This additional script may be of use to some. Add it to Prefs/Toolbars/Scripts. Then open the Script Log - whenever you resize the Lister the dimensions will be shown in the Log.
Just re-read your reply and I think I misunderstood what you wanted. It's possible to store the lister location and set another lister to that location I think. Will have a play later.
Here are two new copies of the buttons which should do what you want. As before, the first button stores the Lister (now with position) and the second will resize and relocate the current Lister.
May I ask if there is a possibility for Dopus to retain the "store lister" script at shutdown?
Form the moment I have to run it every time I shutdown Dopus or the computer.
Thanks
Vitor
Not sure why you'd need that, doesn't the normal saving of default listers and layouts do that for you?
I'm curious, could you explain why it's needed to survive a reboot? My thought was that it's occasionally useful to copy/reuse a listers dimensions temporarily but for anything permanent a saved layout is much better.
Here's a replacement for the store button which will survive a reboot: