Below is an example of mouse click manipulation of the scrollbars in Notepad. The Notepad window settings are important to make this work properly, so if you try this make sure your Notepad is configured like mine. I know there are other things I could do, for example, a search for the "X" to produce a similar result in Notepad but I'm not really trying to manipulate Notepad, just using it to demonstrate.
The crux of this method is that when you right click on a scrollbar in many applications you get a menu where one of the menu options is "Scroll Here". So using MouseMoveRel> one can select a position on the scrollbar and scroll fairly precisely. If it works properly for you, it should scroll to the location of the only alpha character in the text file and center it in the window.
Does anyone know a better way? Precise scrolling is important.
Code: Select all
//Notepad font is set to Consolas, Regular, 11
//Notepad Status bar is on
//Delete File before creating it JIC
DeleteFile>%temp_dir%JRLTextFile.txt
//Create a file with an X in the middle
Let>vDoc=
Let>kk=0
Repeat>kk
Add>kk,1
Let>vLine=%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%crlf%
If>kk=658
Let>vLine=%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%X%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%crlf%
EndIF
Let>vDoc=%vDoc%%vline%
Until>kk=6000
WriteLn>%temp_dir%JRLTextFile.txt,wres,vDoc
////////////////////////////////////////
//Open File in Notepad
RunProgram>notepad.exe %temp_dir%JRLTextFile.txt
WaitWindowOpen>JRLTextFile*
Wait>1
//////////////////////
//Position and size window as needed
GetWindowHandle>JRLTextFile*,hWndParent
Let>Win_Usehandle=1
MoveWindow>hWndParent,100,50
ResizeWindow>hWndParent,500,400
SetFocus>hWndParent
Let>Win_Usehandle=0
////////////////////////////////////
//Everything to this point is simply setting up
//a window with which to work.
//Mouse moves and clicks to manipulate the scroll bars
//Wait> functions are in place if you need them
MouseMoveRel>485,103
rClick
Wait>0
Send>s
Wait>0
Press Enter
MouseMoveRel>197,360
rClick
Wait>0
Send>s
Wait>0
Press Enter
MouseMoveRel>485,343
Let>LC=0
Repeat>LC
Add>LC,1
lClick
Until>LC=4
///////////////////////////////////////////////////////