Sign in to follow this  
Followers 0
runsnake

how to control NOTEPAD to scroll accurately?

3 posts in this topic

following script doesnot work!

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
Run("Notepad")
Sleep(200)
$hWin = WinGetHandle("[CLASS:Notepad]")
For $i = 1 To 40
ControlSend($hWin, "", "Edit1", $i & @LF)
Next
$hCtrl = ControlGetHandle("[CLASS:Notepad]", "", "Edit1")
$Max = _GUIScrollBars_GetScrollInfoMax($hCtrl, $SB_VERT)
$TrackPos = _GUIScrollBars_GetScrollInfoTrackPos($hCtrl, $SB_VERT)
$PageSize = _GUIScrollBars_GetScrollInfoPage($hCtrl, $SB_VERT)
For $i = $Max To 1 Step -1
_GUIScrollBars_ScrollWindow($hCtrl, 0, 1)
Sleep(100)
Next

Share this post


Link to post
Share on other sites



#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
Run("Notepad")
Sleep(200)
WinWaitActive("Untitled - Notepad") ; <-------------- Added this line
$hWin = WinGetHandle("[CLASS:Notepad]")
For $i = 1 To 40
ControlSend($hWin, "", "Edit1", $i & @LF)
Next
$hCtrl = ControlGetHandle("[CLASS:Notepad]", "", "Edit1")
$Max = _GUIScrollBars_GetScrollInfoMax($hCtrl, $SB_VERT)
$TrackPos = _GUIScrollBars_GetScrollInfoTrackPos($hCtrl, $SB_VERT)
$PageSize = _GUIScrollBars_GetScrollInfoPage($hCtrl, $SB_VERT)
For $i = $Max To 1 Step -1
_GUIScrollBars_ScrollWindow($hCtrl, 0, 1)
Sleep(100)
Next


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

Thx for warm answer. But I pointed to scrolling notepad be wrong!

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
Run("Notepad")
Sleep(200)
$hWin = WinGetHandle("[CLASS:Notepad]")
WinWaitActive("[CLASS:Notepad]")
For $i = 1 To 40
ControlSend($hWin, "", "Edit1", $i & @LF)
Next
$hCtrl = ControlGetHandle("[CLASS:Notepad]", "", "Edit1")
$Max = _GUIScrollBars_GetScrollInfoMax($hCtrl, $SB_VERT)
$TrackPos = _GUIScrollBars_GetScrollInfoTrackPos($hCtrl, $SB_VERT)
$PageSize = _GUIScrollBars_GetScrollInfoPage($hCtrl, $SB_VERT)
For $i = $Max To 1 Step -1
_GUIScrollBars_ScrollWindow($hCtrl, 0, 1)
Sleep(100)
Next

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0