Jump to content

enaiman

Active Members
  • Posts

    1,906
  • Joined

  • Last visited

About enaiman

  • Birthday 11/18/1968

Profile Information

  • Location
    Hobart, Australia

Recent Profile Visitors

1,161 profile views

enaiman's Achievements

Universalist

Universalist (7/7)

20

Reputation

  1. Wow, that's really nice, simple and effective. Removing the style from button works very well. Thanks a lot.
  2. @tvro This is what you get back from the device you are interogating so you'll need to do something about that. The type of data returned is "04" which is interpreted as text and the "garbled text" is what the data is translated to from Hex to ASCII. The very last OID returned is in this section at the end of the output: 04 06 E839354FC7E6 04 = type of data returned = String 06 = length of data sequence E839354FC7E6 = data returned In this case, the data returned is a MAC address and it should be: E8:39:35:4F:C7:E6 In this case, what you need to do is: get the "garbled" text returned and transform it back in hex code (each character will have a Hex value) then split the string in groups of two by ":" and you have your MAC addresses. @jcpetu The array returned is multi dimensional and you are trying to use an uni-dimensional array. You need to use $result [1][1] or whatever you need - look closely at the _ArrayDisplay result.
  3. Well, I'll have to answer myself to my post - about how many times does that happen to anybody? to get yourself the answer right after asking for help? It looks like the tab order is given indeed by the control handle and the order you put them in the script will be the one followed by the tab key presses. That is good and bad because sometimes I need to group controls in my script in order to improve script's readability ... I guess I can live with that. Extra question - any way to make a control (icon in my case) not selectable by tab keypress? Thanks,
  4. Sorry if I ask an obvious question but the search in the General Help did not return any solution. I am trying to select different controls on my GUI by pressing the TAB key. It does work but the order of selected controls I guess is the order they were created (going to next in line control handle?) I have noticed a "Tab Order" entry field in Koda Form Designer and I did try to change that value to what I wanted - unfortunately it does not have any effect. Is there something I am missing here? Thanks,
  5. @RichE Glad you found it useful
  6. @nobur Thank you for your help I have updated the version number, credits and example files.
  7. I've found why your script was not advancing - it is my fault because I have an $i = 0 instruction left in the example which caused the loop to reset everytime. I did a little bit of cleaning and your script should work properly now. #include <array.au3> #include <date.au3> #include 'SNMP_UDF_v1.7.3.au3' Global $Port = 161 ; UDP 161 = SNMP port Global $SNMP_Version = 2 ; SNMP v2c (1 for SNMP v1) Global $SNMP_Community = "public" ; SNMPString(Community) (change it) Global $SNMP_ReqID = 1 Global $SNMP_Command Global $Start = 1 Global $result Global $Timeout_msec = 2500 If Not @Compiled Then Opt("trayicondebug", 1) $ini = StringTrimRight(@ScriptName, 3) & "ini" $sect = "Drucker" $aDrucker = IniReadSection($ini, $sect) $Ergebnis = "Zählerstände der Xerox Drucker von: " & _NowCalc() & @CRLF UDPStartup() For $i = 1 To $aDrucker[0][0] $IP = $aDrucker[$i][0] $Socket = UDPOpen($aDrucker[$i][0], $Port) ConsoleWrite($IP & @LF) ConsoleWrite($aDrucker[$i][1] & @LF) $Ergebnis &= $aDrucker[$i][1] $OIDsect = $aDrucker[$i][1] $OIDsect = StringTrimLeft($OIDsect, (StringInStr($OIDsect, " ", 0, -1))) $aOID = IniReadSection($ini, $OIDsect) For $x = 1 To $aOID[0][0] $SNMP_ReqID += 1 $SNMP_Command = _SNMPBuildPacket($aOID[$x][1], $SNMP_Community, $SNMP_Version, $SNMP_ReqID, "A0") UDPSend($Socket, $SNMP_Command) _StartListener() Sleep(200) $Ergebnis &= @TAB & $aOID[$x][0] & @TAB & $SNMP_Util[1][1] & @CRLF _ArrayDisplay($SNMP_Util, $aDrucker & ", " & $x) ConsoleWrite($aOID[$x][0] & ", " & $aOID[$x][1] & " = " & $SNMP_Util[1][1] & @LF) Next UDPCloseSocket($Socket) Next UDPShutdown() Sleep(200) ConsoleWrite($Ergebnis & @LF) Func _StartListener() If $Start = 1 Then $Timeout = TimerInit() While (1) $srcv = UDPRecv($Socket, 2048) If ($srcv <> "") Then $result = _ShowSNMPReceived($srcv) ConsoleWrite("received: " & $srcv & @CRLF) ;_ArrayDisplay($result) ExitLoop EndIf Sleep(100) If TimerDiff($Timeout) > $Timeout_msec Then ExitLoop EndIf WEnd EndIf EndFunc ;==>_StartListener Func OnAutoItExit() UDPCloseSocket($Socket) UDPShutdown() EndFunc ;==>OnAutoItExit
  8. I don't have any idea yet but I hope I'll be able to think about it tomorrow. Sorry
  9. @nobur, Thanks again for your contribution. I have updated my first post to include a link to your SNMP Walk function. Sorry about not updating the UDF yet - been quite busy.
  10. Hi Nobur, Thank you very much for your help. That is a damn big number never imagined that would be used for an OID and that will explain why my UDF was working for smaller numbers. I'll definitely do some tests to see that everything works fine then I'll update the UDF. Thanks for providing a solution for this bug
  11. New (minor) version correcting 2 bugs. It looks like the full editor is working again for me (yay). Latest version attached to original post.
  12. Hi Valik, Thank you for fixing this for me. I have no idea what is happening here but I suspect it might be something with my PC or something is blocked/disabled (I'm at work). No matter which post I try to edit the bloody editor won't start. I've tested it from home (via Remote Desktop) and it works perfectly, so it is definitely something at my end (work PC or work environment). Thanks Valik for help.
  13. @pegaze01 I think you are still using an old version (most current is 1.7.2) For some reason my browsers fail when attempting to use the full editor so I can't post the updates on the first post. Try this version and let me know if it works. Regarding the limit of 50 OIDs, the packet will become too big and it is likely to be split; I am not such a good scripter/programmer to be able to handle communication with multiple packets. My advice for you: build a loop and go for 32 entries at the time. I don't like it but I don't have an alternative. You can google for an alternative; somebody else might have a SNMP freeware you could use. I have to say, my UDF is an enthusiast project, I never intended it to be used at any "serious" level and I don't have the required time (and patience) to bring it to that level. SNMP_UDF_v1.7.2.au3 snmp_packetgen_write.au3 snmp_packetgen_1.7.2.au3
  14. @joecolgee If you got something in the clipboard, that means your device has answered your querry but the error number was not an usuaal one. After a quick look at the result you had in the clipboard the error number returned was x11(hex) = 17 and that error means "Not Writtable" Simply put - you were trying to write something to a read-only OID. Your issue made me realise that I need to include more error codes in my UDF; I will update it soon.
  15. Hmmm - I am confused about what you want to do. I have modified your script to write your combo content - it's in a hurry , messy and untested. Have fun #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <String.au3> #Include <Array.au3> #Include 'SNMP_UDF_v1.7.2.au3' ;Needs set of Net-SNMP tools installed to get working #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("IPTV Decoder Channel Select", 776, 602, 759, 257) $Group1 = GUICtrlCreateGroup("London", 16, 56, 225, 505) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Agincourt", 272, 56, 225, 505) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Montreal", 528, 56, 225, 505) GUICtrlCreateGroup("", -99, -99, 1, 1) $Combo1 = GUICtrlCreateCombo("", 32, 88, 161, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $Combo2 = GUICtrlCreateCombo("", 100, 200, 200, 50, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Channel1|Channel2|Channel3|Channel4") GUICtrlSetData($Combo1, "Channel1|Channel2|Channel3|Channel4|Channel5|Channel6|Channel7|Channel8|Channel9|Channel10|Channel11|Channel12") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $dest_IP = "192.168.1.2" ; Destination Address (change it) Global $Port = 161 ; UDP 161 = SNMP port Global $SNMP_Version = 2 ; SNMP v2c (1 for SNMP v1) Global $SNMP_Community = "private" ; SNMPString(Community) - you need the "write" community string to test this. Global $SNMP_ReqID = 1 Global $SNMP_Command Global $Start = 1 Global $result UDPStartUp() $Socket = UDPopen($dest_IP, $Port) Global $SNMP_OID = "1.2 1.3.6.1.2.1.1.6.0" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Combo1 $SNMP_Command = _SNMPBuildPacket($SNMP_OID, $SNMP_Community,$SNMP_Version, $SNMP_ReqID, "A3", "32", "04", GUICtrlRead($Combo1)) UDPSend($Socket, $SNMP_Command) $reply = _StartListener() sleep (200) If $reply = 1 Then MsgBox(0, "", "Decoder 1 @ Eton Dorney has been set to decoder " & GUICtrlRead($Combo1)) Else MsgBox(0, "", "did not complete") EndIf EndSwitch WEnd Func _StartListener() If $Start = 1 Then $i = 0 While (1) $srcv = UDPRecv($Socket, 2048) If ($srcv <> "") Then $result = _ShowSNMPReceived ($srcv) If @error Then Return 0 EndIf ConsoleWrite($srcv [email="&@CRLF"]&@CRLF[/email]) ExitLoop EndIf sleep(100) WEnd Return 1 EndIf EndFunc Func OnAutoItExit() UDPCloseSocket($Socket) UDPShutdown() EndFunc
×
×
  • Create New...