Jump to content

the way to show real-time logging


Recommended Posts

Good morning,
would be great to hear your thoughts in terms of organizing a real-time logging for the script operating with some application that should be always in focus as getting keys
idea is to show some stages/ notes/ errors in real time
there are some commands in help pages, but they are not really match.


1) ConsoleWrite()
the foreground app may be set smaller, and SciTE in a full screen mode with vertical console
thus console text would be visible in real time

image.png.bc41395be076687bc44acca11c1130be.png
2) TrayTip()
not really good idea as not able to flash many messages correctly
3) ToolTip() 
notifications may be placed in any pos of the screen, but require a Sleep() command and display tips one by one

image.png.10c333873f974e32d53b31aafa454c98.png

4) TraySetToolTip()
not really good as require the mouse pointer to display

5) MsgBox()
may be used to flash messages, but take focus from main app

Link to comment
Share on other sites

  • Moderators

Gregor_S,

Take a look at my Notify UDF - the link is in my sig.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

You can print debug info in a second gui window ...

 

Here is an example of adding (limited by deleting the oldest entry) debug text to a listbox:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.5
 Author:         Dan_555

 Script Function:   Displaying important debugging text in a listbox

                    The maximum item numer in this listbox can be limited
                    so that the old items get deleted, when a new entry comes in
#ce ----------------------------------------------------------------------------

#include <GuiListBox.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

; Script Start - Add your code below here
Global $debugComboMaxLines = 8, $debug_on = 1 ;Debug_on: enables-disables the debugging window. $debugCombomaxlines: How many items shall be always present in the list box.


If $debug_on = 1 Then
    Global $debug = GUICreate("DebugLog", 320, 170, Default, Default, BitOR($WS_THICKFRAME, $WS_MINIMIZEBOX))
    Global $debug_label = GUICtrlCreateLabel("Debug Last Active = 00:00:00", 4, 4,312,17)
    Global $idDEBUGListBox = GUICtrlCreateList("", 2, 22, 300, 130)
    GUISetState(@SW_SHOW, $debug)
EndIf


Func DebugLogText($txt)
    If $debug_on = 1 Then
        _GUICtrlListBox_BeginUpdate($idDEBUGListBox)
        If _GUICtrlListBox_GetCount($idDEBUGListBox) >= $debugComboMaxLines Then _GUICtrlListBox_DeleteString($idDEBUGListBox, $debugComboMaxLines)
        _GUICtrlListBox_InsertString($idDEBUGListBox, @HOUR & ":" & @MIN & ":" & @SEC & " - " & $txt, 0)
        _GUICtrlListBox_EndUpdate($idDEBUGListBox)
    EndIf
EndFunc   ;==>DebugLogText


;example code

Local $hTimeI = TimerInit()

While GUIGetMsg() <> $GUI_EVENT_CLOSE

    If $debug_on = 1 Then GUICtrlSetData($debug_label, "Loop Last Active =" & @HOUR & ":" & @MIN & ":" & @SEC) ;Debugging only

    If TimerDiff($hTimeI) > 1000 Then
        DebugLogText("Action #" & Int(Random(0, 100)) & " occured")
        $hTimeI = TimerInit()
    EndIf
WEnd

 

Some of my script sourcecode

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...