Sign in to follow this  
Followers 0
3ggerhappy

Creating a console in the interface

7 posts in this topic

Hi Guys

I need some ideas how to create my own console in my gui. where in i can print messages like a visual log. Im thinking of using a list view for the logging but i dont know how to append messages in itso that it reatins prevoiusly written message. hope you got what i mean thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

3ggerhappy, take this as a start:

#include <GuiEdit.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinApi.au3>
Global $hGUI = GUICreate("GUI Log", 320, 320)
WinSetTrans($hGUI,"",200)
Global $Edit = GUICtrlCreateEdit("", 10, 10, 300, 300, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL), 0)
;set the initial data
GUICtrlSetData(-1, "########################################" & @CRLF & _
                   "#" & @TAB & @TAB & "    Operation so far:" & @TAB & @TAB & "           #" & _
                   @CRLF & "########################################" & @CRLF)
GUICtrlSetColor(-1, 0x00FF00)
GUICtrlSetBkColor(-1, 0x000000)
GUISetState(@SW_SHOW)

;put your variable (optional) e.g. _Logging($var)
For $i = 1 To 30
    _Logging(@TAB & "#> " & "This is line no." & $i)
Next
;set the finish message (optional)
_Logging( @CRLF & @CRLF & "########################################" & @CRLF & _
                   "#" & @TAB & @TAB & "    No errors found!" & @TAB & @TAB & "           #" & _
                   @CRLF & "########################################" & @CRLF)
_Logging("Bye!")
Sleep(3000)
Exit

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _Logging($text)
    _GUICtrlEdit_AppendText($Edit,$text & @CRLF)
    Sleep(150)
EndFunc
Edited by taietel

Share this post


Link to post
Share on other sites

Wow thank you very for this i tried the code in my script and it wotked. ill just need a little tweaking thanks much taitel

Share this post


Link to post
Share on other sites

Hi Im getting an error in the _Logging Function

_GUICtrlEdit_AppendText($Edit,$text & @CRLF) undefined function

Share this post


Link to post
Share on other sites

Did you remember to #include<GuiEdit.au3> at the top of the script?


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

uh forgot about that.

thanks taitel and geosoft

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