How to Detect the Top of the Pane When Scrolling

I have an application (Family Tree Maker) that is heavily dependent on mouse gestures and no menu equivalents exist. The application window is divided into panes. I am working on a macro that will scroll up or down to find a specific place in a given pane where further actions can take place. I have tried to do this with partial success with found images.... see screen shot

Screenshot

The macro shown works somewhat IF the image being searched is ABOVE the current cursor position. If the image isn't found (either because it isn't present or is below the starting cursor position) it keeps on going until I force all macros to end. What I want to do is 1) scroll up to the top of the pane and if the image isn't found 2) scroll to the bottom looking for it and if its still not there 3) do something to add the image.

The part I can't work out is how to detect when I've scrolled to the top (or bottom), i.,e "scroll until top is reached". Any thoughts on how to detect that future scrolling up is fruitless ?

1 Like

Unless there is some visual clue, I doubt there is any reasonable way to detect this.

However you could presumably limit the number of loops - presumably there is some reasonable maximum to the scroll area, and thus some reasonable maximum to the number of times you should scroll up. Use a variable to count how many times the loop has executed (set it to zero before the loop, and increment it within the loop, and add a condition to test the variable and stop after an appropriate number of loop).

1 Like

Thanks for the hints Peter. I got it to work. In case its helpful to anyone else... here is the working macro

Find Image by Scrolling up then down.kmmacros (12.5 KB)

Screenshot

1 Like