Scripting functions on portal rows has a tendency to reset the scroll position
I can describe two ways to avoid that side effect for a number of scripted operations:
1) Research "magicKey" here or over the web. This is a trick that allows you to create and edit data multiple records in a related table--such as those shown in a portal without doing anything to change the layout focus.
2) Open a new window "off the monitor edge" and process your data there, closing the window when you are done. This also leaves the focus details such as how the portal is scrolled unchanged. (this is not an ideal solution on iOS devices).