Basically, use the tell app "System Events" statement to send keystrokes and key codes. Theoretically, you can use the following:
keystroke page up key keystroke page down key keystroke home key
But for me it does not work. The good news is that you can use key codes instead. I suggest using the excellent free Full Key Codes reader app, although itโs a bit difficult to make it read two keys pressed simultaneously.
The key codes for fn + arrow keys -combos are as follows:
Page up: fn + up key : key code 116
Page down: fn + down key : key code 121
Main: fn + left key : key code 115
End: fn + right key : key code 119
So, for example, if a long page was opened in Safari and you want to scroll to the end, use
tell application "System Events" tell application "Safari" to activate โ to see the animation, we wait a moment: delay 0.5 key code 119 end tell
Asmus source share