Jump to content
Sign in to follow this  
AlmarM

_Console UDF

Recommended Posts

AlmarM

Hello,

I made this small cool looking Console Project. You can basicly save the actions that are taking by a user.

Console.au3

#include-once

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

; #INDEX# =============================================================================
; Title .........: Console
; AutoIt Version.: 3.3.++
; Language.......: English
; Description ...: Basicly makes a simple console that can be used for saving actions.
; Author ........: Almar Mulder (AlmarM)
; =====================================================================================

Global $Debug_Text

; #FUNCTION# ==========================================================================
; Name...........: _Console_Startup()
; Description ...: Creates a Console
; Syntax.........: _Console_Startup()
; Parameters ....: -
; Return values .: -
; Author ........: Almar Mulder (AlmarM)
; Modified.......: -
; Remarks .......: -
; Related .......: _Console_Write(), _Console_Log()
; Link ..........: -
; Example .......: Yes
; ====================================================================================
Func _Console_Startup()
    $Console_Base = GUICreate("Console...", 400, 200, 10, 10, $WS_BORDER)
    $Debug_Text = GUICtrlCreateEdit("", 0, 0, 400, 190, $ES_WANTRETURN + $ES_AUTOVSCROLL)
    
    GUICtrlSetBkColor($Debug_Text, 0x000000)
    GUICtrlSetColor($Debug_Text, 0xFFFFFF)
    GUISetState()
EndFunc     ;==> _Console_Startup()

; #FUNCTION# =========================================================================
; Name...........: _Console_Write()
; Description ...: Writes text in the Console
; Syntax.........: _Console_Startup($sText, $sEnter = 0, $sOption = 0)
; Parameters ....: $sText, $sEnter, $sOption
;               | $sText = The text to be written
;               | $sEnter = Set to 1 if an enter should be included
;               | $sOption = Set to 1 if timestamp should be included
; Return values .: -
; Author ........: Almar Mulder (AlmarM)
; Modified.......: -
; Remarks .......: -
; Related .......: _Console_Log(), _Console_Startup()
; Link ..........: -
; Example .......: Yes
; ====================================================================================
Func _Console_Write($sText, $sEnter = 0, $sOption = 0)
    If $sEnter = 1 Then
        $x = @CRLF
    Else
        $x = ""
    EndIf
    
    If $sOption = 1 Then
        $TimeStamp = "[" & @HOUR & ":" & @MIN & ":" & @SEC & "] "
    Else
        $TimeStamp = ""
    EndIf
    
    GUICtrlSetData($Debug_Text, $TimeStamp & $sText & $x, "|")
EndFunc     ;==> _Console_Write()

; #FUNCTION# =========================================================================
; Name...........: _Console_Log()
; Description ...: Reads the console and writes a log file (.txt)
; Syntax.........: _Console_Log($sPath)
; Parameters ....: $sPath
;               | $sPath = The path (and file name)
; Return values .: -
; Author ........: Almar Mulder (AlmarM)
; Modified.......: -
; Remarks .......: -
; Related .......: _Console_Startup(), _Console_Write()
; Link ..........: -
; Example .......: Yes
; ====================================================================================
Func _Console_Log($sPath)
    $Log_Text = GUICtrlRead($Debug_Text)
    
    FileWrite($sPath, $Log_Text)
EndFunc     ;==> _Console_Log()

Tell me what you think :P

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
FireFox

@AlmarM

Nice work ! this could be useful for debuging than the ConsoleWrite :P

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
insignia96

Very Useful! Thanks!

Edit i did make one little mod though,

Func _Console_Log($sPath, $iOverwrite)
    $Log_Text = GUICtrlRead($Debug_Text)

    If $iOverwrite = 1 Then
        FileDelete($sPath)
    EndIf

    FileWrite($sPath, $Log_Text)
EndFunc   ;==>_Console_Log

Just because if you made the log file "test.log" it would need to overwrite, bu instead the UDF appends the new log text onto the end.

Edited by insignia96

Visit my website to see all my finished releases!Releases here:UDFs:GUI ResizingColor List (Web Colors)GUIFade_NearestPower

Share this post


Link to post
Share on other sites
dantay9

Nice. Great for debugging.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites
AlmarM

Well, thank you! I thought this was a piece of crap :)


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

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  

×