# Scroll scrollbar to position via script

**URL:** <https://forum.inductiveautomation.com/t/scroll-scrollbar-to-position-via-script/15999>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [November 15, 2017, 6:12am UTC](https://forum.inductiveautomation.com/t/scroll-scrollbar-to-position-via-script/15999 "2017-11-15T06:12:46Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 24, 2017, 4:33am UTC](https://forum.inductiveautomation.com/t/scroll-scrollbar-to-position-via-script/15999/5 "2017-11-24T04:33:47Z")

</div>

Got it!

```auto
RC = system.gui.getParentWindow(event).rootContainer
me = RC.getComponent('Template Repeater')

#Get the scrollPane object which contains the viewPort object by finding it
components = me.getComponents()
for component in components:
	if str(type(component)) == "<type 'com.jidesoft.swing.JideScrollPane'>":
		scrollPane = component

viewport = scrollPane.getViewport()

#Get the 'visible rectangle' which basically defines the current view of the full scroll-able pane
rect = viewport.getVisibleRect()
#Add '400' units to the horizontal scroll position
rect.y = rect.y + 400

#write the new visible rectangle back to the scroll-able object
viewport.scrollRectToVisible(rect)

```

Thanks for your prompt, Sander

Edit: I replaced the static scrollPane component assignment with a loop to find this component instead, so this should work for any component now and not just the template repeater

---

_[View the full topic](https://forum.inductiveautomation.com/t/scroll-scrollbar-to-position-via-script/15999)._
