# Command: ScrollSelectionIntoView

**URL:** <https://resource.dopus.com/t/command-scrollselectionintoview/18619>\
**Category:** Buttons/Scripts\
**Tags:** script, commands, jscript\
**Created:** [June 25, 2014, 2:49am UTC](https://resource.dopus.com/t/command-scrollselectionintoview/18619 "2014-06-25T02:49:00Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![tbone](https://resource.dopus.com/user_avatar/resource.dopus.com/tbone/32/25726_2.png) [@tbone](https://resource.dopus.com/u/tbone)\
**Post date:** [June 25, 2014, 2:49am UTC](https://resource.dopus.com/t/command-scrollselectionintoview/18619/1 "2014-06-25T02:49:00Z")

</div>

ScrollSelectionIntoView - A small script command to automatically scroll the file display to the current selection.  
I use it when toggling between details and thumbnails mode to keep the selected items visible. It won't do anything if nothing is selected.

_(n.b. Opus 12 does this automatically. This was written for Opus 11. --Leo)_

You may add it to your view-toggle button as I did or put it in a new button to have this separately available. It is nice for buttons where you set a show- or quickfilter as well, I somehow can't do without it anymore. o)

My view toggle button using this command looks like this:

```nohighlight
@ifset:VIEW=Details
Set VIEW=Thumbnails
ScrollSelectionIntoView
@ifset:else
Set VIEW=Details
ScrollSelectionIntoView

```

Installation:  
To install the command, download the \*.js.txt file below and drag it to Preferences / Toolbars / Scripts.  
After that create a separate button calling "ScrollSelectionIntoView" or edit existing view changing buttons and menues, to call it directly after any "Set VIEW.." command.

Download:

- Latest: v1.2.1 - supports automatic updates/scriptwizard:  
[Command.GUI\_ScrollSelectionIntoView.js.txt](https://resource.dopus.com/uploads/default/original/3X/e/e/ee01a7155db1e20c14c09f5948752d73d311100d.txt) (4.47 KB)

- v1.2 - using tab.stats to detect regular selection without extra checkbox toggle, commandline param PRIOCHECKBOXSELECTION added:  
[Command.GUI\_ScrollSelectionIntoView.js.txt](https://resource.dopus.com/uploads/default/original/3X/4/7/47dc3e008e5bbceaf768a138f16a15977dc4d20c.txt) (3.35 KB)

- v1.1 - supports selection in checkbox mode now as well, and parameter to priorize checkboxmode (defaults to false):  
[Command.GUI\_ScrollSelectionIntoView.js.txt](https://resource.dopus.com/uploads/default/original/3X/d/5/d5c326ed453fdcc50daa434a19b3447861c33f7b.txt) (3.54 KB)[/li][/ul]

cya! o)  
tbone

---

_[View the full topic](https://resource.dopus.com/t/command-scrollselectionintoview/18619)._
