Quote:
Originally Posted by juliansader
I haven't tested it much, but this might work:
Code:
trackview = reaper.JS_Window_FindChildByID(reaper.GetMainHwnd(), 1000)
infoOK, scrollPos, pageSize, min, max, trackPos = reaper.JS_Window_GetScrollInfo(trackview, "HORZ")
cursorTime = reaper.GetCursorPositionEx(0) -- Always counted from start of project, ignores "Project start time"
zoom = reaper.GetHZoomLevel() -- returns pixels/second
cursorPixels = cursorTime*zoom
newScrollPos = math.floor(cursorPixels - pageSize*0.9)
reaper.JS_Window_SetScrollPos(trackview, "HORZ", newScrollPos)
|
Hooray! This works perfectly. Thank you!
I'd really love to learn how to figure stuff like this out on my own. But I guess I need to learn a bit more about js scripting. Is there a page similar to
the ReaScript API function definitions for the js API? I'm trying to figure out what functions are available, what each of them do, and how to use them in a script.
Thanks again!