AppleScript : do a mouse scroll on a Finder window

How can I do a mouse scroll on a Finder window in AppleScript ?

I know there is keystroke for the keyboard, click for a mouse click, but is there something for the mouse wheel ?


Solution 1:

You can set scroll bar position using Apple Script. In Finder without horizontal scroll bar You can do something like:

activate application "Finder"
tell application "System Events"
    tell process "Finder"
        -- range is from 0.0 to 1.0, so to scroll halfway you would use 0.5
        set value of scroll bar 1 of scroll area 2 of splitter group 1 of front window to 0.0
    end tell
end tell

Tip from https://discussions.apple.com/thread/1540280?start=0&tstart=0 User James Nierodzik