Jump to content

How come Scite displays consoletexts colorized?


Recommended Posts

I am trying to use @crlf as it does in consolewrites bellow but no colors, yet Scite shows everything colorized in console from this script and in different colors

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

; Set a HotKey
HotKeySet("x", "_Interrupt_HotKey")

; Declare a flag
$fInterrupt = 0

Opt("GUIOnEventMode", 1)

$hGUI = GUICreate("Test", 500, 500)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

$hButton_1 = GUICtrlCreateButton("Func One", 10, 10, 80, 30)
GUICtrlSetOnEvent($hButton_1, "_Func_1")
$hButton_2 = GUICtrlCreateButton("Func Two", 10, 50, 80, 30)
GUICtrlSetOnEvent($hButton_2, "_Func_2")

; Create a dummy control for the Accelerator to action
$hAccelInterupt = GUICtrlCreateDummy()
GUICtrlSetOnEvent($hAccelInterupt, "_Interrupt_Accel")
; Set an Accelerator key to action the dummy control
Dim $AccelKeys[1][2]=[ ["z", $hAccelInterupt] ]
GUISetAccelerators($AccelKeys)

GUISetState()

; Intercept Windows command messages with out own handler
GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

While 1
    Sleep(10)
WEnd

Func _Func_1()
    ; Make sure the flag is cleared
    $fInterrupt = 0
    For $i = 1 To 20
        ConsoleWrite("-Func 1 Running" & @CRLF)
        ; Look for the flag
        If $fInterrupt <> 0 Then
            ; The flag was set
            Switch $fInterrupt
                Case 1
                    ConsoleWrite("!Func 1 interrrupted by Func 2" & @CRLF)
                Case 2
                    ConsoleWrite("!Func 1 interrrupted by HotKey" & @CRLF)
                Case 3
                    ConsoleWrite("!Func 1 interrrupted by Accelerator" & @CRLF)
            EndSwitch
            Return
        EndIf
        Sleep(100)
    Next
    ConsoleWrite(">Func 1 Ended" & @CRLF)
EndFunc

Func _Func_2()
    For $i = 1 To 3
        ConsoleWrite("+Func 2 Running" & @CRLF)
        Sleep(100)
    Next
    ConsoleWrite(">Func 2 Ended" & @CRLF)
EndFunc

Func _Exit()
    Exit
EndFunc

Func _Interrupt_HotKey()
    ; The HotKey was pressed so set the flag
    $fInterrupt = 2
EndFunc

Func _Interrupt_Accel()
    ; This is an empty function for the dummy control linked to the Accelerator key
EndFunc

Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    ; The Func 2 button was pressed so set the flag
    If BitAND($wParam, 0x0000FFFF) =  $hButton_2 Then $fInterrupt = 1
    ; The dummy control was actioned by the Accelerator key so set the flag
    If BitAND($wParam, 0x0000FFFF) =  $hAccelInterupt Then $fInterrupt = 3
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND
Link to comment
Share on other sites

copy and past into you output pane, and experiment a little.

********************************************************* ***************
!******************************************************** red,bold
-******************************************************** orange,bold
<******************************************************** orange,bold
+******************************************************** green,bold
--- ***************************************************** dark brown,?link
+++ ***************************************************** dark brown,?link
Error *************************************************** light brown,?link
>******************************************************** blue
*******x    2**************************************** purple,link
***********************************************x    3 purple,link
*******x(4,)********************************************* red,light,+link (no leading TAB)
*******x(5,0)******************************************** red,light,+link (no leading TAB)
*******File "SPEC", line 6******************************* red,light,+link
********************************************************* ***************
(note: those 2 big spaces are of course TAB's)+(also same coloring if dropped into a <Filename>.err file)

Edited by iEvKI3gv9Wrkd41u

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

If you're using SciTE4AutoIt then refer to the SciTEConfig 2000 link in my signature. SciTEConfig 2000 will allow you to change the colors of the console.

Edited by LaCastiglione
Link to comment
Share on other sites

If you are interested in replicating this colouring system outside of SciTe, you can use Sci Lexer UDF by Kip. A quick forum search will reveal all.

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

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...