Sign in to follow this  
Followers 0
mattw112

Log file reader with GUI

19 posts in this topic

First of all, I'm kind of a hack at this so be gentle... :)

I would like to have a script that is constantly reading the latest line of a certain logfile and based on what that line says then it would present different things in a GUI.

So for example it see that a certain file name is appearing in the log file as running, it would then find that item on the GUI and make it bold. Once it reads in the logfile that the program finished it would put a strikethrough or something for the Label on a GUI...

I've started piecing together a script for this, but like I said I'm not really that great at everything. The main thing I'm having an issue with tonight is just getting the script to constantly read the last line of a log file. In fact I'm not really sure where to begin with that. Do I have to read the whole thing til the end of file and work my way backwards? Is there a simple command or function to get this info? The next part I need help with is reading an ini file to populate the labels on a GUI to begin with. These will be the labels that get manipulated later on.

Really even just next steps would be appreciated or if anyone knows if this already exists that would be great. I searched through the forums but didn't really see anything.

I've pulled some of this code form various other posts on the forums, most of the GUI stuff is from Volly.

Thanks,

Terry

; ----------------------------------------------------------------------------
; Author:       Terry Matthews
; Date:         05/02/07
;
; Version:      1.0
; Description:  This script monitors the execution manager log file in real time
;               and displays a GUI to show progress of app installs.
;
; Background:   SMS is used to push out a lot of applications silently.  Operators
;               would like to be able to walk up to a server that is being built 
;               and know what apps it is installing, where it is at, and how many
;               are left.  This information can be read from the execmgr log file
;               but we also dont want them opening files as many of the installs
;               and configurations are done using autoit scripts.  Plus a GUI is 
;               easier to see.
;
; Updates:      
;
; ----------------------------------------------------------------------------

;=====================================
; OPTIONS
;=====================================
AutoItSetOption("TrayIconDebug", 1)
Opt("WinTitleMatchMode", 2)
Opt("WinDetectHiddenText",1)
Opt("ExpandEnvStrings", 1)

; ========================
; INCLUDE HELPER FUNCTIONS
; ========================
#include <constants.au3>
#include <GUIConstants.au3>
#include <String.au3>
#include <Array.au3>
#include <file.au3>
#include <Date.au3>

; ===========================
; VARIABLES AND DECLARATIONS
; ===========================
$Pause_Time = "10"
$LOG = @SystemDir & "\CCM\Logs\execmgr.log"
$LASTTIME = ""
$i = "1"

; ================
; MAIN
; ================
; Create To Do list from ini file found in systemdir named ServerBuild.ini, I'll create an INI file with sections related to
; what apps to expect and then put it down each time, overlapping the previous one.
_ReadToDoIni(@SystemDir & '\ServerBuild.ini')

; Create GUI, showing to do list
_CreateGUI()

; Monitor File and update GUI as needed
While $i = "1"
    Sleep($Pause_Time)
    
    ; Get last modified time of log file
    $t =  FileGetTime($LOG)
    
    ; Construct the time
    If Not @error Then
        $TIME = $t[0] & "/" & $t[1] & "/" & $t[2] & " " & $t[3] & ":" & $t[4] & ":" & $t[5]
        ; If this just started set last time to current time
        If $LASTTIME = "" Then
            $LASTTIME = $TIME
        EndIf
    EndIf
    
    ; Compare the times to find the difference
    $DIF = _DateDiff('s',$TIME,$LASTTIME)
    
    ; If there's a difference then changes have been made, check to see if the last line of the log contains one of the following and do some action.
    If $DIF <> "0" Then

        ; If the last log line contains "Execution Request for program ", parse everything between end of that and the 
        ; next " state change from WaitingContent to NotifyExecution", find it on the to do list make it bold.
        
        
        
        ; If the last log line begins with "Raised Program Started Event for Ad:" and contains ", Program: ", then parse out everything after this 
        ; find it on to do list and make it bold with underline.
        
        
        
        ; If the last log line begins with "Execution is complete for program " and contains ". The exit code is ", parse the stuff in between and 
        ; find on to do list and strikethrough, unbold.  Write Exit code returned next to label?
        
        
        
        
    EndIf
    
    $LASTTIME = $TIME
    
WEnd

GUIDelete()

Exit


; ================
; FUNCTIONS
; ================
Func _CreateGUI()
    Dim $tSize

    ; Figuring out size for GUI, $SelectedSections would be gotten through the ini file
    If UBound ($SelectedSections) - 1 < 30 Then
        $tSize = 20 * (UBound($SelectedSections) - 1)
    Else
        $tSize = 270
    EndIf
    
    ; Create GUI
    GUICreate( "Applications to Install",300, $tSize + 250, 20, 25, -1)
    GUISetFont ( 14 , -1 , -1, "Arial")
    GUISetBkColor(0xFFFBF0)
          
    ; Labels on GUI
    $LabelContext = GUICtrlCreateLabel( "Installing Applications", 10, 10, 260 , 20 )
    GUICtrlSetFont (-1, 11, 646, "", "Arial")
      
    $PLabel1  = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel2  = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel3  = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel4  = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel5  = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel6  = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel7  = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel8  = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel9  = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel10 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel11 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel12 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel13 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel14 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel15 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel16 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel17 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel18 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel19 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel20 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel21 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel22 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel23 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel24 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel25 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel26 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel27 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel28 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel29 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel30 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )   
      
    ; Logos at Bottom
    $Pic1 = GUICtrlCreatePic("C:\temp\WAMULOGO.bmp", 30, $tSize + 150, 226, 69)
  
    ; Declare Array
    Dim $ProgressArray [31]
        $ProgressArray [1]  = $PLabel1
        $ProgressArray [2]  = $PLabel2
        $ProgressArray [3]  = $PLabel3 
        $ProgressArray [4]  = $PLabel4 
        $ProgressArray [5]  = $PLabel5 
        $ProgressArray [6]  = $PLabel6 
        $ProgressArray [7]  = $PLabel7 
        $ProgressArray [8]  = $PLabel8 
        $ProgressArray [9]  = $PLabel9 
        $ProgressArray [10] = $PLabel10
        $ProgressArray [11] = $PLabel11
        $ProgressArray [12] = $PLabel12
        $ProgressArray [13] = $PLabel13
        $ProgressArray [14] = $PLabel14
        $ProgressArray [15] = $PLabel15
        $ProgressArray [16] = $PLabel16
        $ProgressArray [17] = $PLabel17
        $ProgressArray [18] = $PLabel18
        $ProgressArray [19] = $PLabel19
        $ProgressArray [20] = $PLabel20
        $ProgressArray [21] = $PLabel21
        $ProgressArray [22] = $PLabel22
        $ProgressArray [23] = $PLabel23
        $ProgressArray [24] = $PLabel24
        $ProgressArray [25] = $PLabel25
        $ProgressArray [26] = $PLabel26
        $ProgressArray [27] = $PLabel27
        $ProgressArray [28] = $PLabel28
        $ProgressArray [29] = $PLabel29
        $ProgressArray [30] = $PLabel30      
    
    GUISetState ()
    
EndFunc

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Func _ReadToDoIni($INIFILE)
    ; Reads ini file that shows all the names of the programs that will be installed that match up with the names that will be shown in
    ; the execmgr.log.  Use this list to populate the labels on the GUI.
    
    
    
EndFunc

Share this post


Link to post
Share on other sites



Ok let's see:

The main thing I'm having an issue with tonight is just getting the script to constantly read the last line of a log file.

You may consider using the File.au3 located into your AutoIt directory\include - you can find there some useful functions.

Anyway this is a function to read the last line: - where $log is your logfile

Func read_last ($log)
    $aSplit = StringSplit(StringStripCR(FileRead($log)), @LF)
    $lastline_content = $aSplit[$aSplit[0]]
EndFuncoÝ÷ Ú«¨µäázw±¶«´ÞyØ^"¶¬­æx)â~)^¶h¦éZµëazVz[(¡"Úz§Â+aN¬{¥·­éZmél¶­ëfjx©ºV­yÙZµêèú®¢×n­¶¬¥ªíÊ°Ygyçm¢­jYmè§~§¶¢'âéh¢F­ªê-"xy§jº¢iÖ§v)è­×«¶©u«^¶¥i·¥²ë"ayÊ'µéí¡ø§*.q©î±æ®¶­sdwV7G&Å6WDFFb33c·÷W%öÆ&VÅöW&RÂæ&VBb33c¶æöfÆUöW&RÂgV÷C·6V7FöâgV÷C²ÂgV÷C¶¶WgV÷C²ÂgV÷C¶FVfVÇBgV÷C²

this will update your label with the value found on ini file under section "section" and key "key")

This should give you an idea about what to do ...


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Search for a tail-udf. I read that this should be faster (compared to other methods).

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Search for a tail-udf. I read that this should be faster (compared to other methods).

And that would be this

If you need other UDF's have a look in my signature

Another guy had the same issue have a look here - http://www.autoitscript.com/forum/index.php?showtopic=42993

Edited by Shevilie

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

Ok, so I've made many changes and tried the tail-udf

here's what I got so far:

; ----------------------------------------------------------------------------
; Author:       Terry Matthews
; Date:         05/02/07
;
; Version:      1.0
; Description:  This script monitors the execution manager log file in real time
;               and displays a GUI to show progress of app installs.
;
; Background:   SMS is used to push out a lot of applications silently.  Operators
;               would like to be able to walk up to a server that is being built 
;               and know what apps it is installing, where it is at, and how many
;               are left.  This information can be read from the execmgr log file
;               but we also dont want them opening files as many of the installs
;               and configurations are done using autoit scripts.  Plus a GUI is 
;               easier to see.
;
; Updates:      
;
; ----------------------------------------------------------------------------

;=====================================
; OPTIONS
;=====================================
Opt("TrayIconDebug", 1)
Opt("WinTitleMatchMode", 2)
Opt("WinDetectHiddenText",1)
Opt("ExpandEnvStrings", 1)

; ========================
; INCLUDE HELPER FUNCTIONS
; ========================
#include <constants.au3>
#include <GUIConstants.au3>
#include <String.au3>
#include <Array.au3>
#include <file.au3>
#include <Date.au3>
#include <TailRW.au3>

; ===========================
; VARIABLES AND DECLARATIONS
; ===========================
Dim $AvailableArray [1]
Dim $ProgramsToInstall
Dim $PLabel1
Dim $ItemStart
Dim $PLabel

$ProgressArray = ""
$INIFILE = @SystemDir & "\ServerBuild.ini"
$LOG = @SystemDir & "\CCM\Logs\execmgr.log"
$Pause_Time = "10"
$LASTTIME = ""
$x = "1"

; ================
; OTHER
; ================
; Install ServerBuild.ini for this specific install
; Change this to match your location.
; Remember the "PROGRAM=" in the ini must equal the exact name that will be shown in the execmgr.log

FileInstall("c:\temp\CORITP\ServerBuild.ini", @SystemDir & "\ServerBuild.ini", 1)

; ================
; MAIN
; ================
; Create To Do list from ini file found in systemdir named ServerBuild.ini, I'll create an INI file with sections related to
; what apps to expect and then put it down each time, overlapping the previous one.
_FileToArray ($AvailableArray, $INIFILE)
;_ArrayDisplay( $AvailableArray, "Test $AvailableArray" )

; Install Check
 If $ProgramsToInstall = 0 Then
      msgbox(0, "Error", "No Programs Found, Config file may be missing")
      RunWait('eventcreate /t ERROR /SO WATCH /L Application /id 140 /d "No Programs Found, Config File may be missing or incorrectly formatted"', "", @SW_HIDE)
      Exit
EndIf

; Create GUI
_CreateGUI()

; Set Labels on GUI
$Item = $ProgramsToInstall - 1
_SetLabels($PLabel1, $PLabel & $Item, $AvailableArray, 0)

; Monitor File and update GUI as needed
While $x = "1"
    Sleep($Pause_Time)
    
    ; Get last modified time of log file
    $t =  FileGetTime($LOG)
    
    ; Construct the time
    If Not @error Then
        $TIME = $t[0] & "/" & $t[1] & "/" & $t[2] & " " & $t[3] & ":" & $t[4] & ":" & $t[5]
        ; If this just started set last time to current time
        If $LASTTIME = "" Then
            $LASTTIME = $TIME
        EndIf
    EndIf
    
    ; Compare the times to find the difference
    $DIF = _DateDiff('s',$TIME,$LASTTIME)
    
    ; If there's a difference then changes have been made, check to see if the last line of the log contains one of the following and do some action.
    If $DIF <> "0" Then

        ; If the last log line contains "Execution Request for program ", parse everything between end of that and the 
        ; next " state change from WaitingContent to NotifyExecution", find it on the to do list make it bold.
        _Read_last($log)
        
        
        
        
        ; If the last log line begins with "Raised Program Started Event for Ad:" and contains ", Program: ", then parse out everything after this 
        ; find it on to do list and make it bold with underline.
        _Read_last ($log)
        
        
        
        
        ; If the last log line begins with "Execution is complete for program " and contains ". The exit code is ", parse the stuff in between and 
        ; find on to do list and strikethrough, unbold.  Write Exit code returned next to label?  And if this is equal to the last program to install
        ; then exit altogether.
        _Read_last ($log)
        
        
        
        
    EndIf
    
    $LASTTIME = $TIME
    
WEnd

; Close GUI
GUIDelete()

Exit


; ================
; FUNCTIONS
; ================

; Creates GUI
Func _CreateGUI()
    Dim $tSize

    ; Figuring out size for GUI
    If UBound ($ProgramsToInstall) - 1 < 30 Then
        $tSize = 20 * (UBound($ProgramsToInstall) - 1)
    Else
        $tSize = 270
    EndIf
    
    ; Create GUI
    GUICreate( "Applications to Install", 300, $tSize + 250, 20, 25, -1)
    GUISetFont ( 14 , -1 , -1, "Arial")
    GUISetBkColor(0xFFFBF0)
          
    ; Labels on GUI
    $LabelContext = GUICtrlCreateLabel( "Installing Applications", 10, 10, 260 , 20 )
    GUICtrlSetFont (-1, 11, 646, "", "Arial")
      
    $PLabel0 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel1 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel2 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel3 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel4 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel5 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel6 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel7 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel8 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel9 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel10 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel11 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel12 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel13 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel14 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel15 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel16 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel17 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel18 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel19 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel20 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel21 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel22 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel23 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel24 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel25 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel26 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel27 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel28 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel29 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )   
      
    ; Logo at Bottom
    $Pic1 = GUICtrlCreatePic("C:\temp\WAMULOGO.bmp", 30, $tSize + 150, 226, 69)
  
    GUISetState ()
    
EndFunc

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

; Reads last line of logfile
Func _Read_last ($log)
    $LineNumber = -1
    $s_ReadLine = __FileReadLine ($Log, $LineNumber, 1)
EndFunc

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

; Converts INI file to array
Func _FileToArray (ByRef $tArray, $INIFILE) 
   $i = 0
   $tOpenFile = FileOpen ($INIFILE, 0 )
   $ProgramsToInstall = "0"
    
    While 1
        $tLine = FileReadLine ($tOpenFile)
      
        If @error = -1 Then ExitLoop
      
        ; Removes white space from begining and end
        $tLine = StringStripWS ($tLine, 3 )
        
        ; Check if the line contains "PROGRAM" if it does add it to the array and remove '=' sign.
        If StringLeft ( $tLine, 7)  = "PROGRAM" Then
            ReDim $tArray [$i+1]
            $tPos  = StringInStr ($tLine, "=")
            $tLine = StringTrimLeft ($tLine, $tPos)
            $tLine = StringStripWS ($tLine, 3)
            $tArray [$i] = $tLine
            $i = $i + 1
            ;Count programs to install
            $ProgramsToInstall = $ProgramsToInstall + 1
        EndIf
    Wend
  
   FileClose ($INIFILE)
   
EndFunc

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

; Sets the labels in GUI equal to the contents of the ini file
Func _SetLabels($tItemStart, $tItemEnd, $tArray, $tArrayItem)

    $j = 1
    $k = 0
    
    For $m = $ItemStart To $tItemEnd
        GUICtrlSetPos  ( '$PLabel' & $m,  30, 35 + ($j)*15  ,  260 , 15 )
        GUICtrlSetFont ( '$PLabel' & $m,  9, 400, "", "Arial" )
        GUICtrlSetData ( '$PLabel' & $m, $tArray[$tArrayItem + $k])

        $k = $k + 1
        $j = $j + 1
        
    Next

EndFunc

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

It seems to be working, I can see it is getting what I want it to from the ini file, building the array correctly, etc... but it is not populating the labels on the GUI with the information.

Can someone help me with this next step...

Thanks,

Terry

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I didn't have time to analize your whole script but what it looks strange to me is that you created all the labels (0 to 29) at the same coordinates (all of them are one on top of other).

See for yourself:

$PLabel0 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
$PLabel1 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
$PLabel2 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
$PLabel3 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )

This way you can't see any label being updated because you have another 28 on top of it. Maybe you can change the coordinates :)

Also you can shorten the label creation part:

$j = 1000
For $k=0 to 29
   $Plabel&$k = GUICtrlCreateLabel ( "" , 30, $j , 260 , 60 )
   $j+=20    ;or whatever the space between may be
Next
Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I didn't have time to analize your whole script but what it looks strange to me is that you created all the labels (0 to 29) at the same coordinates (all of them are one on top of other).

See for yourself:

$PLabel0 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
$PLabel1 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
$PLabel2 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
$PLabel3 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )

This way you can't see any label being updated because you have another 28 on top of it. Maybe you can change the coordinates :)

Thanks,

I borrowed this from a script volly wrote and this was how he did his. Of course his was a ton more complex then I could do so there's probably something I missed?

I will try breaking them out though manually.

Terry

Edited by mattw112

Share this post


Link to post
Share on other sites

I've been just editing my post when yours came through :)

Look at the edited part about a solution to Label creation.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

I've been just editing my post when yours came through :)

Look at the edited part about a solution to Label creation.

Cool, I'll try that. In the meantime I just updated all of them to be this:

$PLabel0 = GUICtrlCreateLabel ( "" , 30, 1000 , 260 , 60 )
    $PLabel1 = GUICtrlCreateLabel ( "" , 30, 1070 , 260 , 60 )
    $PLabel2 = GUICtrlCreateLabel ( "" , 30, 1140 , 260 , 60 )
    $PLabel3 = GUICtrlCreateLabel ( "" , 30, 1210 , 260 , 60 )
    $PLabel4 = GUICtrlCreateLabel ( "" , 30, 1280 , 260 , 60 )
    $PLabel5 = GUICtrlCreateLabel ( "" , 30, 1350 , 260 , 60 )
    $PLabel6 = GUICtrlCreateLabel ( "" , 30, 1420 , 260 , 60 )
    $PLabel7 = GUICtrlCreateLabel ( "" , 30, 1490 , 260 , 60 )
    $PLabel8 = GUICtrlCreateLabel ( "" , 30, 1560 , 260 , 60 )
    $PLabel9 = GUICtrlCreateLabel ( "" , 30, 1630 , 260 , 60 )
    $PLabel10 = GUICtrlCreateLabel ( "" , 30, 1700 , 260 , 60 )
    $PLabel11 = GUICtrlCreateLabel ( "" , 30, 1770 , 260 , 60 )
    $PLabel12 = GUICtrlCreateLabel ( "" , 30, 1840 , 260 , 60 )
    $PLabel13 = GUICtrlCreateLabel ( "" , 30, 1910 , 260 , 60 )
    $PLabel14 = GUICtrlCreateLabel ( "" , 30, 1980 , 260 , 60 )
    $PLabel15 = GUICtrlCreateLabel ( "" , 30, 2050 , 260 , 60 )
    $PLabel16 = GUICtrlCreateLabel ( "" , 30, 2120 , 260 , 60 )
    $PLabel17 = GUICtrlCreateLabel ( "" , 30, 2190 , 260 , 60 )
    $PLabel18 = GUICtrlCreateLabel ( "" , 30, 2260 , 260 , 60 )
    $PLabel19 = GUICtrlCreateLabel ( "" , 30, 2330 , 260 , 60 )
    $PLabel20 = GUICtrlCreateLabel ( "" , 30, 2400 , 260 , 60 )
    $PLabel21 = GUICtrlCreateLabel ( "" , 30, 2470 , 260 , 60 )
    $PLabel22 = GUICtrlCreateLabel ( "" , 30, 2540 , 260 , 60 )
    $PLabel23 = GUICtrlCreateLabel ( "" , 30, 2610 , 260 , 60 )
    $PLabel24 = GUICtrlCreateLabel ( "" , 30, 2680 , 260 , 60 )
    $PLabel25 = GUICtrlCreateLabel ( "" , 30, 2750 , 260 , 60 )
    $PLabel26 = GUICtrlCreateLabel ( "" , 30, 2820 , 260 , 60 )
    $PLabel27 = GUICtrlCreateLabel ( "" , 30, 2890 , 260 , 60 )
    $PLabel28 = GUICtrlCreateLabel ( "" , 30, 2960 , 260 , 60 )
    $PLabel29 = GUICtrlCreateLabel ( "" , 30, 3030 , 260 , 60 )

but the label fill in still didn't work? I'll try yours.

Terry

Share this post


Link to post
Share on other sites

#10 ·  Posted

I tried yours, I changed it to:

$j = 1000
    For $k=0 to 29
        $PLabelNew = $PLabel & $k 
        $PLabelNew = GUICtrlCreateLabel ( "" , 30, $j , 260 , 60 )
        $j+=70
    Next

I changed the:

$Plabel&$k = GUICtrl...

to:

$PlabelNew = $Plabel & $K

$PlabelNew = GUICtrl...

because I was getting an error about it.

I compiled but still dont see any labels??

T

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Also there are some errors:

_SetLabels($PLabel1, $PLabel & $Item, $AvailableArray, 0)oÝ÷ ÚØb²+-çîËb¢wV§wMú

My previous post was only for shortening your script. THIS one is attempting to fix it. :)

Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

#12 ·  Posted

Also there are some errors:

_SetLabels($PLabel1, $PLabel & $Item, $AvailableArray, 0)oÝ÷ ÚØb²+-çîËb¢wV§wMú

Share this post


Link to post
Share on other sites

#13 ·  Posted

It looks good ... but I have another idea - could you attach to your post (or send them to me) your au3 file and the ini file you're using?

I guess it will be easier for me to debug your script.

I will check this thread again in 10 minutes.

Until then - can you replace the function call with the one I've showed you in the last post and give it a try?


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

It looks good ... but I have another idea - could you attach to your post (or send them to me) your au3 file and the ini file you're using?

I guess it will be easier for me to debug your script.

I will check this thread again in 10 minutes.

Until then - can you replace the function call with the one I've showed you in the last post and give it a try?

I've actually rewritten the function again... trying it everyway I can... still doesn't work even though all the elements are there??

Attached is the au3 and ini

Thanks,

Terry

PS - rename the .txt to .ini for some reasont he forum doesn't let you upload .ini files?

Watch_Execmgr2.au3

ServerBuild.txt

Edited by mattw112

Share this post


Link to post
Share on other sites

#15 ·  Posted

LOL - here it comes the error :)

the value of $j (1000) placed all your labels waaaay over the visible area of the GUI

Just change $j = 30 and the step $j+=20 and everything will look OK


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

#17 ·  Posted

LOL - here it comes the error :)

the value of $j (1000) placed all your labels waaaay over the visible area of the GUI

Just change $j = 30 and the step $j+=20 and everything will look OK

awesome thanks...

Now on to actually making this thing work...

Terry

Share this post


Link to post
Share on other sites

#18 ·  Posted

hi

to run, does this need the .log file as well?

Randall

yep, it will eventually I haven't gotten to that part yet though...

I was just trying to get the GUI to show up right first.

Thanks,

Terry

Share this post


Link to post
Share on other sites

#19 ·  Posted

Glad to be of assistance :)

Good luck


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0