# Store/Recall Lister Size

**URL:** <https://resource.dopus.com/t/store-recall-lister-size/34883>\
**Category:** Buttons/Scripts\
**Tags:** script, button, jscript\
**Created:** [March 15, 2020, 12:08am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883 "2020-03-15T00:08:22Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steve](https://resource.dopus.com/user_avatar/resource.dopus.com/steve/32/34171_2.png) [@Steve](https://resource.dopus.com/u/Steve)\
**Post date:** [March 15, 2020, 12:08am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/1 "2020-03-15T00:08:23Z")

</div>

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**

```javascript
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**

```auto
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;
}

```

[Store Lister Size.dcf](https://resource.dopus.com/uploads/short-url/57tXuySGjHCXN9aOAzFmGsCMTV0.dcf) (1.3 KB)  
[Recall Lister Size.dcf](https://resource.dopus.com/uploads/short-url/oBtKMQHak8shu8NRxWOd0TlYpe3.dcf) (1.7 KB)

---

<div class="post-metadata">

**Author:** ![Steve](https://resource.dopus.com/user_avatar/resource.dopus.com/steve/32/34171_2.png) [@Steve](https://resource.dopus.com/u/Steve)\
**Post date:** [March 15, 2020, 12:39am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/2 "2020-03-15T00:39:55Z")

</div>

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.

[Show Lister Size.js.txt](https://resource.dopus.com/uploads/short-url/lWP0Q6cUsFOURZ1R0pMuX3JVcwT.txt) (832 Bytes)

---

<div class="post-metadata">

**Author:** ![Steve](https://resource.dopus.com/user_avatar/resource.dopus.com/steve/32/34171_2.png) [@Steve](https://resource.dopus.com/u/Steve)\
**Post date:** [March 15, 2020, 3:16am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/3 "2020-03-15T03:16:03Z")

</div>

Updated the first post. The **Recall Lister Size** button now does some simple error checking and prompts if you haven't yet stored any Lister sizes.

---

<div class="post-metadata">

**Author:** ![vitor](https://resource.dopus.com/letter_avatar_proxy/v4/letter/v/c89c15/32.png) [@vitor](https://resource.dopus.com/u/vitor)\
**Post date:** [April 2, 2020, 8:47am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/4 "2020-04-02T08:47:44Z")

</div>

Thank you Steve, very useful 👍

Do you know if there is a possibility to also recall the position of the lister on the screen?

Thanks  
Vitor

---

<div class="post-metadata">

**Author:** ![Steve](https://resource.dopus.com/user_avatar/resource.dopus.com/steve/32/34171_2.png) [@Steve](https://resource.dopus.com/u/Steve)\
**Post date:** [April 2, 2020, 8:55am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/5 "2020-04-02T08:55:32Z")

</div>

This button will give you the top, bottom, left and right coordinates of the source lister:

[Edges.dcf](https://resource.dopus.com/uploads/short-url/6QqTnZ0CImYjT1utfXuBbjF9cub.dcf) (1.0 KB)

The results will show in the Script Log.

```auto
<?xml version="1.0"?>
<button backcol="none" display="icon" label_pos="right" textcol="none">
	<label>Edges</label>
	<icon1>#newcommand</icon1>
	<function type="script">
		<instruction>@script JScript</instruction>
		<instruction>function OnClick(clickData)</instruction>
		<instruction>{</instruction>
		<instruction>var top = clickData.func.sourcetab.lister.top;</instruction>
		<instruction>var bottom = clickData.func.sourcetab.lister.bottom</instruction>
		<instruction>var left = clickData.func.sourcetab.lister.left</instruction>
		<instruction>var right = clickData.func.sourcetab.lister.right</instruction>
		<instruction />
		<instruction>DOpus.Output(&quot;Top Edge Coordinate: &quot; + top);</instruction>
		<instruction>DOpus.Output(&quot;Bottom Edge Coordinate: &quot; + bottom);</instruction>
		<instruction>DOpus.Output(&quot;Left Edge Coordinate: &quot; + left);</instruction>
		<instruction>DOpus.Output(&quot;Right Edge Coordinate: &quot; + right);	</instruction>
		<instruction>}</instruction>
	</function>
</button>

```

---

<div class="post-metadata">

**Author:** ![Steve](https://resource.dopus.com/user_avatar/resource.dopus.com/steve/32/34171_2.png) [@Steve](https://resource.dopus.com/u/Steve)\
**Post date:** [April 2, 2020, 9:03am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/6 "2020-04-02T09:03:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Steve](https://resource.dopus.com/user_avatar/resource.dopus.com/steve/32/34171_2.png) [@Steve](https://resource.dopus.com/u/Steve)\
**Post date:** [April 2, 2020, 9:12am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/7 "2020-04-02T09:12:12Z")

</div>

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.

**Store Lister Size/Pos**

```auto
function OnClick(clickData)
{
	lister = DOpus.Listers.lastactive;
	
	width = lister.right - lister.left;
	height = lister.bottom - lister.top;

	DOpus.Vars.Set('width') = width;
	DOpus.Vars.Set('height') = height;
	DOpus.Vars.Set('top') = lister.top;
	DOpus.Vars.Set('left') = lister.left;

	DOpus.Output('Lister Size/Pos Stored.', false, true);
	DOpus.Output(' Width : ' + width, false, true);
	DOpus.Output(' Height: ' + height, false, true);
	DOpus.Output(' Position: ' + lister.left + ',' + lister.top, false, true);
}

```

**Recall Lister Size/Pos**

```auto
function OnClick(clickData)
{
	if (!DOpus.Vars.Exists('width') || !DOpus.Vars.Exists('height') || !DOpus.Vars.Exists('top') || !DOpus.Vars.Exists('left')) {
		mtVar();
		return;
	}
		cmd = clickData.func.command;
		cmd.RunCommand('Set LISTERSIZE=' + DOpus.Vars.Get('width') + ',' + DOpus.Vars.Get('height'));
		cmd.RunCommand('Set LISTERPOS=' + DOpus.Vars.Get('left') + ',' + DOpus.Vars.Get('top'));
}

function mtVar()
{
		listers = DOpus.Listers;
		
		dlg = DOpus.Dlg;
		dlg.window = listers.lastactive;
		dlg.message = "You need to run the Store Lister Size/Pos button first!";
		dlg.title = "No Stored Lister Size";
		dlg.Buttons = "Ok";
		dlg.Show;
}

```

---

<div class="post-metadata">

**Author:** ![vitor](https://resource.dopus.com/letter_avatar_proxy/v4/letter/v/c89c15/32.png) [@vitor](https://resource.dopus.com/u/vitor)\
**Post date:** [April 3, 2020, 7:21am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/8 "2020-04-03T07:21:10Z")

</div>

Hi Steve,  
This is awesome !  
Working perfectly, many many thanks to you 🙏

Vitor

---

<div class="post-metadata">

**Author:** ![vitor](https://resource.dopus.com/letter_avatar_proxy/v4/letter/v/c89c15/32.png) [@vitor](https://resource.dopus.com/u/vitor)\
**Post date:** [April 9, 2020, 9:46am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/9 "2020-04-09T09:46:10Z")

</div>

Hello Steve,

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

---

<div class="post-metadata">

**Author:** ![Steve](https://resource.dopus.com/user_avatar/resource.dopus.com/steve/32/34171_2.png) [@Steve](https://resource.dopus.com/u/Steve)\
**Post date:** [April 9, 2020, 9:48am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/10 "2020-04-09T09:48:03Z")

</div>

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:

**Store Lister Size/Pos**

```auto
function OnClick(clickData)
{
	lister = DOpus.Listers.lastactive;
	
	width = lister.right - lister.left;
	height = lister.bottom - lister.top;

	DOpus.Vars.Set('width') = width;
	DOpus.Vars.Set('height') = height;
	DOpus.Vars.Set('top') = lister.top;
	DOpus.Vars.Set('left') = lister.left;

	DOpus.Vars("width").persist = true;
	DOpus.Vars("height").persist = true;
	DOpus.Vars("top").persist = true;
	DOpus.Vars("left").persist = true;

	DOpus.Output('Lister Size/Pos Stored.', false, true);
	DOpus.Output(' Width : ' + width, false, true);
	DOpus.Output(' Height: ' + height, false, true);
	DOpus.Output(' Position: ' + lister.left + ',' + lister.top, false, true);
}

```

---

<div class="post-metadata">

**Author:** ![vitor](https://resource.dopus.com/letter_avatar_proxy/v4/letter/v/c89c15/32.png) [@vitor](https://resource.dopus.com/u/vitor)\
**Post date:** [April 11, 2020, 7:37am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/11 "2020-04-11T07:37:58Z")

</div>

Hi there Steve,

Well, I've tried recalling a layout but couldn't find a way ... it always opens a new lister and not resizing the active one.

---

<div class="post-metadata">

**Author:** ![Steve](https://resource.dopus.com/user_avatar/resource.dopus.com/steve/32/34171_2.png) [@Steve](https://resource.dopus.com/u/Steve)\
**Post date:** [April 11, 2020, 9:40am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/12 "2020-04-11T09:40:32Z")

</div>

The button in my previous post should solve this for you by saving the variables permanently.

---

<div class="post-metadata">

**Author:** ![vitor](https://resource.dopus.com/letter_avatar_proxy/v4/letter/v/c89c15/32.png) [@vitor](https://resource.dopus.com/u/vitor)\
**Post date:** [April 11, 2020, 11:06am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/13 "2020-04-11T11:06:37Z")

</div>

Thanks Steve,  
Indeed, it solved my problems 👍

---

<div class="post-metadata">

**Author:** ![Alpha](https://resource.dopus.com/user_avatar/resource.dopus.com/alpha/32/37458_2.png) [@Alpha](https://resource.dopus.com/u/Alpha)\
**Post date:** [October 11, 2020, 4:23pm UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/14 "2020-10-11T16:23:46Z")

</div>

Thanks for this @Steve very handy!

---

<div class="post-metadata">

**Author:** ![jinsight](https://resource.dopus.com/user_avatar/resource.dopus.com/jinsight/32/43666_2.png) [@jinsight](https://resource.dopus.com/u/jinsight)\
**Post date:** [May 19, 2025, 2:49am UTC](https://resource.dopus.com/t/store-recall-lister-size/34883/15 "2025-05-19T02:49:00Z")

</div>

@Steve  
These are very useful scripts to discover lister coordinates. I've been looking for this information for some time. Thanks.

This item in the thread simply wraps @Steve's scripts in a three button button for easy usage. It also revives this information.

Position and size a lister just the way you want then use the following button to get the coordinates for use in another button or hotkey to reposition a lister at the same coordinates.

[Save-See-Apply Lister Position and Size Coordinates.dcf](https://resource.dopus.com/uploads/short-url/lohqneXPLAYFmnyW2S9MFvn2I32.dcf) (4.2 KB)

Here is the code for the button:

```auto
<?xml version="1.0"?>
<button 3dborders="no" backcol="none" display="both" dropdown_glyph_slim="yes" icon_size="large" label_pos="right" popout="right" separate="yes" textcol="#ff8000" type="three_button">
	<label>Save|See|Apply Lister Position and Size Coordinates</label>
	<icon1>#DOpus10XP:savesinglelister</icon1>
	<button 3dborders="no" backcol="none" display="label" icon_size="large" label_pos="right" textcol="none">
		<label>Save the Current Lister Position and Size Coordinates</label>
		<icon1>#DOpus10XP:savesinglelister</icon1>
		<function type="script">
			<instruction>@script JScript</instruction>
			<instruction>function OnClick(clickData)</instruction>
			<instruction>{</instruction>
			<instruction>	lister = DOpus.Listers.lastactive;</instruction>
			<instruction>	</instruction>
			<instruction>	width = lister.right - lister.left;</instruction>
			<instruction>	height = lister.bottom - lister.top;</instruction>
			<instruction />
			<instruction>	DOpus.Vars.Set(&apos;width&apos;) = width;</instruction>
			<instruction>	DOpus.Vars.Set(&apos;height&apos;) = height;</instruction>
			<instruction>	DOpus.Vars.Set(&apos;top&apos;) = lister.top;</instruction>
			<instruction>	DOpus.Vars.Set(&apos;left&apos;) = lister.left;</instruction>
			<instruction />
			<instruction>	DOpus.Vars(&quot;width&quot;).persist = true;</instruction>
			<instruction>	DOpus.Vars(&quot;height&quot;).persist = true;</instruction>
			<instruction>	DOpus.Vars(&quot;top&quot;).persist = true;</instruction>
			<instruction>	DOpus.Vars(&quot;left&quot;).persist = true;</instruction>
			<instruction />
			<instruction>	DOpus.Output(&apos;Lister Size/Pos Stored.&apos;, false, true);</instruction>
			<instruction>	DOpus.Output(&apos; Width : &apos; + width, false, true);</instruction>
			<instruction>	DOpus.Output(&apos; Height: &apos; + height, false, true);</instruction>
			<instruction>	DOpus.Output(&apos; Position: &apos; + lister.left + &apos;,&apos; + lister.top, false, true);</instruction>
			<instruction>}</instruction>
		</function>
	</button>
	<button 3dborders="no" backcol="none" display="label" icon_size="large" label_pos="right" textcol="none">
		<label>Open the Script Log to See the Coordinates</label>
		<icon1>#scriptlog</icon1>
		<function type="normal">
			<instruction>Set UTILITY=SciptLog,On</instruction>
		</function>
	</button>
	<button 3dborders="no" backcol="none" display="label" icon_size="large" label_pos="right" textcol="none">
		<label>Apply the Stored Lister Position and Size to the Current Lister</label>
		<icon1>#DOpus10XP:savesinglelister</icon1>
		<function type="script">
			<instruction>@script JScript</instruction>
			<instruction>function OnClick(clickData)</instruction>
			<instruction>{</instruction>
			<instruction>	if (!DOpus.Vars.Exists(&apos;width&apos;) || !DOpus.Vars.Exists(&apos;height&apos;) || !DOpus.Vars.Exists(&apos;top&apos;) || !DOpus.Vars.Exists(&apos;left&apos;)) {</instruction>
			<instruction> mtVar();</instruction>
			<instruction> return;</instruction>
			<instruction>	}</instruction>
			<instruction> cmd = clickData.func.command;</instruction>
			<instruction> cmd.RunCommand(&apos;Set LISTERSIZE=&apos; + DOpus.Vars.Get(&apos;width&apos;) + &apos;,&apos; + DOpus.Vars.Get(&apos;height&apos;));</instruction>
			<instruction> cmd.RunCommand(&apos;Set LISTERPOS=&apos; + DOpus.Vars.Get(&apos;left&apos;) + &apos;,&apos; + DOpus.Vars.Get(&apos;top&apos;));</instruction>
			<instruction>}</instruction>
			<instruction />
			<instruction>function mtVar()</instruction>
			<instruction>{</instruction>
			<instruction> listers = DOpus.Listers;</instruction>
			<instruction> </instruction>
			<instruction> dlg = DOpus.Dlg;</instruction>
			<instruction> dlg.window = listers.lastactive;</instruction>
			<instruction> dlg.message = &quot;Pleaseo run the Current Lister Position and Size Coordinates button first.&quot;;</instruction>
			<instruction> dlg.title = &quot;No Stored Lister Position and Size Coordinates&quot;;</instruction>
			<instruction> dlg.Buttons = &quot;Ok&quot;;</instruction>
			<instruction> dlg.Show;</instruction>
			<instruction>}</instruction>
		</function>
	</button>
</button>

```
