How to change scrollbar position in AppleScript? I have an AppleScript .scpt file that is assigned to a keyboard shortcut via the third-party application, FastScripts.

The script opens a specific, fixed, pre-determined URL in a new Google Chrome tab. This new tab is inserted immediately after the currently open Google Chrome tab (if Google Chrome is currently open).

Here is this code:

activate application "Google Chrome"

set myURL to "https://weather.com/weather/hourbyhour/l/12345"

tell application "Google Chrome"
    activate
    tell front window to make new tab at after (get active tab) with properties {URL:myURL}
end tell


An additional operation that I would like to implement in this script is to have the scrollbar of the opened webpage in Chrome automatically move downwards a bit. Just like the URL variable, the scroll amount is specific, fixed, and pre-determined.



I don't know the proper way to articulate a scroll amount to you in writing (and it of course varies based on one's screen resolution, monitor size, window size, and the zoom setting set in Chrome for that given page), but I can say that, for my unique environment, it is around 15% down the page. To clarify the meaning of this description, "100% down the page" would be at the lowest scrollbar position (the scrollbar can be set to this position by pressing ⌘ command  + ↓).

The exact scroll amount that I desire is probably not particularly relevant in the context of my question (considering the many aforementioned variables that may affect the scroll amount). It is simply important to note that the scroll amount is a custom figure, as opposed to being at the very top or very bottom of the page (since one can use the respective keyboard shortcut via key code in AppleScript to easily accomplish scrolling to these two locations).

I am hoping that whatever solution is suggested offers me the ability to fine-tune and adjust the desired scrollbar location, so that I can get it as close as possible to where I would scroll manually.
Based on the additional information you provided in the comments, let me offer the following example code of how I'd do it. (At least until I learned a better way.)

set myURL to "https://weather.com/weather/hourbyhour/l/12345"

tell application "Google Chrome"
    set bounds of front window to {0, 23, 1440, 850}
    tell front window to make new tab at after (get active tab) with properties {URL:myURL}
    repeat while (loading of active tab of front window is true)
        delay 1
    end repeat
    activate
    tell application "System Events"
        repeat 9 times
            key code 125 -- # Down Arrow
            delay 0.1
        end repeat
    end tell
end tell




Notes:


The value of the delay command in the repeat while ... loop can be adjusted to something more or less as you see fit based on how fast that page actually loads, you'd want to minimize the number of times the event triggers just so you don't unnecessarily over trigger the event. It's necessary for the page to finish loading, otherwise the next repeat loop will not scroll the appropriate amount. (I'm obviously using the term scroll figuratively.) 
In the tell application "System Events" statement/block, you might need to adjust the number of time the repeat loop triggers. The delay command in this repeat loop is necessary otherwise the key code event, in this use case, does not register on the page properly.