If anyone is interested, here is the finished program.
#include <GUIConstants.au3>
Global $var1
Opt("GUIOnEventMode", 1) ; Change to
OnEvent mode
$mainwindow = GUICreate("Page Down", 100, 100,) ; create the
main window
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ; handle the
close event
$StopButton = GUICtrlCreateButton("Stop", 10, 20, 80) ; create Stop
Button
GUICtrlSetOnEvent($StopButton, "StopButton") ; Handle Stop
Button Event
GUICtrlSetState($StopButton,$GUI_DISABLE) ; Initially
disable stop button
$okbutton = GUICtrlCreateButton("Start", 10, 50, 80) ; Create the
start button
GUICtrlSetOnEvent($okbutton, "OKButton") ; Handle Start
Button event
GUICtrlSetState($OKButton,$GUI_FOCUS) ; put focus on
start button
GUISetState(@SW_SHOW) ; show the main window
WinSetOnTop("Page Down", "", 1) ; set the main
window to always on top
While 1
Sleep(1) ; Idle around
If $var1 > 0 Then ; if in Send Keystroke mode
sleep(20000) ; pause for 20 seconds
Send("{PGDN}") ; then send PGDN keystrokes to active window
EndIf
WEnd
Func StopButton()
;Note: at this point @GUI_CTRLID would equal $okbutton,and
@GUI_WINHANDLE would equal $mainwindow
$var1 = 0
GUICtrlSetState($StopButton,$GUI_DISABLE) ; disable stop button
GUICtrlSetState($OKButton,$GUI_ENABLE) ; enable start button
EndFunc
Func OKButton()
;Note: at this point @GUI_CTRLID would equal $okbutton,and
@GUI_WINHANDLE would equal $mainwindow
$Var1 = 1
GUICtrlSetState($StopButton,$GUI_ENABLE) ; enable the stop button
GUICtrlSetState($OKButton,$GUI_DISABLE) ; disable the start
button
EndFunc
Func CLOSEClicked()
;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,and
@GUI_WINHANDLE would equal $mainwindow
Exit
EndFunc
I gotta say it feels like old times
dos-man