First, you need to pick the instance of the TextBox. With the getElement() method, you can get its DOM element. At this point, you can access the scrollTop property.
const textInputInstance = runtime.objects.TextInput.getFirstInstance();
const textInputDOM = textInputInstance.getElement();
runtime.globalVars.BoxTop = textInputDOM.scrollTop;