Thanks anyway. Got it finally working. Used RawInput.au3 and input filtration "all but keyboard". Inside of _OnInput() i do some filtering for unacepted chars and proper string (accepted only those with letters A and K ald later certain stirng lenght is filtered out). Func _OnInput($hwnd, $iMsg, $iwParam, $ilParam)
Local $tRI_KD, $pRI_KD, $iRI_KB
Local $tRIDI_HID, $pRIDI_HID, $iRIDI_HID
Local $iSize
$tRI_KD = DllStructCreate($tagRAWINPUT_KEYBOARD)
$pRI_KD = DllStructGetPtr($tRI_KD)
$iRI_KB = DllStructGetSize($tRI_KD)
$tRIDI_HID = DllStructCreate($tagRIDDEVICEINFO_HID)
$pRIDI_HID = DllStructGetPtr($tRIDI_HID)
$iRIDI_HID = DllStructGetSize($tRIDI_HID)
DllStructSetData($tRIDI_HID, 'cbSize', $iRIDI_HID)
_GetRawInputData($ilParam, $RID_INPUT, $pRI_KD, $iRI_KB, $iRIH)
If Not @error Then
$hdevice = DllStructGetData($tri_kd, "hDevice")
$vkey = DllStructGetData($tri_kd, "VKey")
If $KEYBOARD_ID = "" Then
$KEYBOARD_ID = 0x000B003F ; default keyboard ID on my PC
EndIf
EndIf
_GetRawInputDeviceInfo($hDevice, $RIDI_DEVICEINFO, $pRIDI_HID, $iRIDI_HID)
If Not @error Then
$hDevice2 = DllStructGetData($tRI_KD, 'hDevice')
$dwVendorId = DllStructGetData($tRIDI_HID, 'dwVendorId')
$dwProductId = DllStructGetData($tRIDI_HID, 'dwProductId')
$dwType = DllStructGetData($tRI_KD, 'dwType')
EndIf
If DllStructGetData($tRI_KD, 'hDevice') <> $KEYBOARD_ID Then
;~ $vKey = DllStructGetData($tRI_KD, 'VKey');F3 = 114
;~ ConsoleWrite(Chr($vKey))
If $on Then
$t=$t& Chr($vKey)
;~ ConsoleWrite($t&@CR)
$on=0
Else
$on=1
EndIf
EndIf
$tRI_KD = 0
$t = StringRegExpReplace ( $t, "(?i)[^0-9AK\.]", "" )
; K number
If StringLen($t) = 10 Then
If StringInStr($t, "K") Then
_insert_barcode()
EndIf
; ; A number
ElseIf StringLen($t) = 8 Then
If StringInStr($t, "A") Then
_insert_barcode()
EndIf
EndIf
Return $GUI_RUNDEFMSG
EndFuncI still do not know how to prevent dublication of strings, i use some loop in function _insert_barcode()... Code dirty... but it works... Func _insert_barcode()
Local $state_GUI6 = WinGetState($hGUI6)
$state = WinGetState($hGUI7)
$iLoop_Count += 1
If $iLoop_Count = 1 Then
GUICtrlSetData($input_barcode, $t)
$state_GUI6 = WinGetState($hGUI6)
ConsoleWrite("$state GUI6..." & $state_GUI6 & @CRLF)
If BitOR($state_GUI6 = 7, $state_GUI6 = 15) Then
;~ _listview_gui_close_to_barcode()
GUICtrlSetData($input_barcode, $t)
EndIf
GUICtrlSetState($input_barcode, $GUI_FOCUS)
$state = WinGetState($hGUI7)
ConsoleWrite("$state GUI7..." & $state & @CRLF)
If BitOR($state = 7, $state = 23) Then ; background (7) or minimized (23)
If StringLen($t) <> 0 Then
ConsoleWrite("StringLen($t): " & StringLen($t) & @CRLF)
ConsoleWrite("$iLoop_Count: " & $iLoop_Count & @CRLF)
ConsoleWrite("$t: " & $t & @CRLF)
ControlClick($name7, "", "[CLASS:Button; TEXT:OK]")
EndIf
; should check for state to send click
If $state_GUI6 = 5 And BitOR($state = 7, $state = 23) Then
ControlClick($name7, "", "[CLASS:Button; TEXT:OK]")
EndIf
ElseIf $state = 15 Then ; foreground, focused
GUICtrlSetData($input_barcode, $t)
; no need for click, accepted by scanner
Else
ConsoleWrite("$t empty. No Click here..." & @CRLF)
EndIf
EndIf
$iLoop_Count = 0
$t = ""
EndFunc