Hier mal ein Beispiel (copy & paste aus Hilfe und ber. vorhandenem eigenen Beispielskript):
C
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$pidNP = Run('notepad')
; Wait max 10 seconds for the Notepad window to appear.
$hNP = WinWait("[CLASS:Notepad]", "", 10)
; Moving Notepadwindow and resize it
WinMove($hNP, '', 0, 0, 480, 480)
$gui = GUICreate("KLeines 1 X 1", 400, 120, 500, 100)
$Start = GUICtrlCreateButton("&Start", 10, 10)
$PauseResume = GUICtrlCreateButton("&Pause", 10, 40)
$Anzeige = GUICtrlCreateLabel("Anzeige", 10, 90, 380)
GUISetState()
While 1
_EventHandler()
WEnd
Func _EventHandler()
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
; Close the Notepad window using the handle returned by WinWait.
WinClose($hNP)
; Now a screen will pop up and ask to save the changes, the classname of the window is called
; "#32770" and simulating the "TAB" key to move to the second button in which the "ENTER" is simulated to not "save the file"
WinWaitActive("[CLASS:#32770]")
Sleep(500)
Send("{TAB}{ENTER}")
Exit
Case $Start
GUICtrlSetState($Start, $GUI_DISABLE)
WinActivate($hNP)
WinWaitActive($hNP, '', 10)
For $i = 1 To 10
For $j = 1 To 10
$sToSend = $j & " * " & $i & " = " & $i * $j
;GUICtrlSetData($Anzeige, $sToSend)
Send($sToSend & @CRLF)
_MySleep(200)
Next
Next
GUICtrlSetState($Start, $GUI_ENABLE)
WinActivate($hNP)
Case $PauseResume
If GUICtrlRead($PauseResume) = "&Pause" Then
GUICtrlSetData($PauseResume, "&Weiter")
While GUICtrlRead($PauseResume) <> "&Pause"
_MySleep(50)
WEnd
Else
GUICtrlSetData($PauseResume, "&Pause")
EndIf
WinActivate($hNP)
EndSwitch
EndFunc ;==>_EventHandler
Func _MySleep($iMSec)
Local $iStart = TimerInit()
Do
_EventHandler()
Until TimerDiff($iStart) >= $iMSec
EndFunc ;==>_MySleep
Alles anzeigen
Mit ControlSend wäre es sicher schöner zu lösen.
mfg (auto)Bert