[DO.11] need help with internal commands

Hi,

by default, my DO lister opens in lower right corner of the screen (near half of the screen).
I set a keyboard shortcut to toggle its size between original (my default) and full height (the width is not changing - still occupies only right half of the screen).
The code is as follows:

Set LISTERCMD=restore
@ifset:$lst:fullHeight
@Set lst:fullHeight
set LISTERPOS=960,411
set LISTERSIZE=960,669
@ifset:else
@Set lst:fullHeight=yes
set LISTERPOS=960,0
set LISTERSIZE=960,1080

Now when I maximize that lister (ALT SPACE X) and use my shortcut , its ALWAYS comes back to full-height.
How to force that lister to come back to the size it was before maximizing?

Hope it's clear what I wrote :slight_smile:
Thanks

EDIT:
there was something missing in my previous post.
From MAXIMIZED STATE it is always comming to opposite state that it was before MAXIMIZED

and how the lister looks like (1st - default. 2nd - full-height)




You should be able to use @ifset:LISTERCMD=Maximize as an extra conditional, to check if the lister is currently maximized. If it is, just run the restore command and nothing else. Otherwise, don't run the restore command, and use the rest of the existing logic.

@ifset:LISTERCMD=Maximize
Set LISTERCMD=restore
@ifset:else
@ifset:$lst:fullHeight
@Set lst:fullHeight
set LISTERPOS=960,411
set LISTERSIZE=960,669
@ifset:else
@Set lst:fullHeight=yes
set LISTERPOS=960,0
set LISTERSIZE=960,1080

like this?
I must be doing something wrong because it ignores the MAXIMIZED condition and behaves like before (that is why I asked in the first place because I was not sure if nested IFs were allowed)

Easier to convert to JScript than try to get nested @if... conditions to work.

This should do the trick.

Set the button's Function drop-down to Script Function.

[code]@script JScript
function OnClick(clickData)
{
var cmd = clickData.func.Command
cmd.deselect = false

if (cmd.IsSet("LISTERCMD=Maximize"))
{
	cmd.RunCommand("Set LISTERCMD=restore");
}
else
{
	var vars = clickData.func.sourcetab.lister.vars;

	if (vars.Exists("fullHeight"))
	{
		vars.Delete("fullHeight");
		cmd.RunCommand("Set LISTERPOS=960,411 LISTERSIZE=960,669");
	}
	else
	{
		vars.Set("fullHeight",true);
		cmd.RunCommand("Set LISTERPOS=960,0 LISTERSIZE=960,1080");
	}
}

}[/code]

That works.
Thank you.