OK, I testet but one problem still having.
script shows like:
$pid = run("calc.exe","","")
$file = FileOpen("test.txt", 2)
While (ProcessExists($pid) <> 0)
If _IsPressed('2A') = 1 Then FileWriteLine($file, "DRUCK");
If _IsPressed('0D') = 1 Then
$file = FileOpen("test.txt", 1)
FileWriteLine($file, "ENTER")
FileClose($file)
ElseIf _IsPressed('09') = 1 Then
$file = FileOpen("test.txt", 1)
FileWriteLine($file, "TAB")
FileClose($file)
EndIf
WEnd
FileWriteLine($file, "Line1")
FileClose($file)
Func _IsPressed($hexKey)
; $hexKey must be the value of one of the keys.
; _IsPressed will return 0 if the key is not pressed, 1 if it is.
Local $aR
$hexKey = '0x' & $hexKey
$aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
If Not @error And BitAND($aR[0],0x8000) = 0x8000 Then Return 1
Return 0
EndFunc;==>_IsPressed
If I press ENTER or TAB the script write nearly 18 times TAB to the file, is that normal, can I fix this problem?