#include-once #include ; https://github.com/ez2sugul/stopwatch_client/blob/master/JSMN.au3 HotKeySet("{F9}", "_EXIT") OnAutoItExitRegister("BEFORE_EXIT") Global Const $SD = "Scripting.Dictionary" Global $INI = "file.ini" Global $SEND = "local_server_input" Global $iStart = 0, $iFinal = 0 While Sleep(50) read_ini() WEnd Func read_ini() $iStart = TimerInit() Local $aNames = IniReadSection($INI, $SEND) For $ii = 1 To $aNames[0][0] If $aNames[$ii][1] Then eval_cmd($aNames[$ii][0], $aNames[$ii][1]) Next $iFinal = TimerDiff($iStart) If $iFinal > 1 Then ConsoleWrite ( $iFinal & @LF) EndFunc ;==>read_ini Func eval_cmd($user, $sInput = 0) $sInput = BinaryToString($sInput, 4) If @error Then Return SetError(2, 0, 0) Local $json = Jsmn_Decode($sInput) If Not (ObjName($json, 2) == $SD) Then Return SetError(3, 0, 0) IniWrite($INI, $SEND, $user, "") IniWrite($INI, $user, "received", paint($json.Item("key"))) EndFunc ;==>eval_cmd Func paint($iKey = 0) Local $aColor[] = [0x336699, 0x009900, 0x990000, 0x000099, 0x990099, 0x009999, 0x999900, 0x999999] Local $oo = ObjCreate($SD) $oo.Add("time", Random(200, 1000, 1)) $oo.Add("key", $iKey) $oo.Add("color", $aColor[Random(0, UBound($aColor, 1) - 1, 1)]) Local $json = Jsmn_Encode_Compact($oo) Return StringToBinary($json, 4) EndFunc ;==>paint Func BEFORE_EXIT() EndFunc ;==>BEFORE_EXIT Func _EXIT() Exit EndFunc ;==>_EXIT