wOxxOm
Joined: 09 Feb 2006 Posts: 319
|
Posted: Sat May 27, 2006 10:45 am Post subject: Enable scrolling in VBA editor window |
|
|
Use most recent version as this code works only in 1.0.43 and above
This code uses winapi messages and works like a charm!!!
Hold Shift to scroll by page
| Code: | #ifwinactive ahk_class wndclass_desked_gsk
~*WheelDown::ScrollVBA(1)
~*WheelUp::ScrollVBA(0)
ScrollVBA(scrollCode) ;; 0=up, 1=down
{ ControlGetFocus,vbaCtl
ControlGet,hwndVBActl,HWND,,%vbaCtl%
winGetTitle,vbaTitle,ahk_id %hwndVBActl%
if (inStr(vbaTitle,"(Code)"))
{ ControlGet,hwndScroll,HWND,,ScrollBar2
goto Scroll
}
ControlGetPos,cx,cy,cw,,%vbaCtl%
loop,15
{ ControlGetPos,sx,sy,,,ScrollBar%A_Index%
if (abs(sx-cx-cw)<30) and (abs(sy-cy)<30)
{ ControlGet,hwndScroll,HWND,,ScrollBar%A_Index%
break
}
}
ifEqual,hwndScroll,,return
Scroll:
if (GetKeyState("Shift"))
sendmessage,277,% 2+ScrollCode,%hwndScroll%,%vbaCtl%
else
loop,4
sendmessage,277,%ScrollCode%,%hwndScroll%,%vbaCtl%
}
#ifWinActive
|
updated: doesn't use index to determine current control but vbaWindow's title instead
updated2: enumeration of scrollbars>2 for more robust catching of correct scrollbar
Last edited by wOxxOm on Sat May 27, 2006 5:08 pm; edited 2 times in total |
|
Winkie
Joined: 11 Apr 2006 Posts: 8 Location: The Netherlands
|
Posted: Sat May 27, 2006 10:04 pm Post subject: |
|
|
Thanx for this script, I can pull a task of my todo-list now!
And thanks to your second update I don't have to localize the script...
I didn't to find out yet when the title contains "Watches", so I could translate it properly. I was planning to ask that now
Bye _________________ Winkie |
|