Jump to content

Search the Community

Showing results for tags 'Console and logging'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. A simple UDF to write to the console and or to log files. Updated the UDF, no you can set the logile with _CwlSetLogFile() #include <date.au3> $LogFile = @ScriptDir & "\logfile.log" MsgBox(0,"Example 1", 'Write "test" to Console') _cw("test") MsgBox(0,"Example 2", 'Write "test" "test" with CR to Console') _cw("test") _cw("test") MsgBox(0,"Example 3", 'Write "test" "test" without CR to Console') _cw("test") _cw("test",0) MsgBox(0,"Example 4", 'Write "Start Script" to Console and Logfile, including date and time (logfile only)') _cwl("Start Script",1,"s") MsgBox(0,"Example 5", 'Write "dots" to console and logfile and adding 10 rows with "."') _cwl("dots") For $i = 1 to 10 _cwl(".") Next MsgBox(0,"Example 6", 'Write "dots" to console and logfile and adding 10 "." after dots') _cwl("dots") For $i = 1 to 10 _cwl(".",0) Next MsgBox(0,"Example 7", 'Write "numbers" to console and logfile and 123456789 with CR') _cwl("numbers") For $i = 1 to 10 _cwl($i) Next MsgBox(0,"Example 8", 'Write "numbers" to console and logfile and 123456789 without CR') _cwl("numbers") For $i = 1 to 10 _cwl(" ",0) _cwl($i,0) Next MsgBox(0,"Example 9", 'Write "End Script" to Console and Logfile, including date and time (logfile only)') _cwl("End Script",1,"e") ; Func Console Write and Write to Logfile Func _CW($CWtext, $CWlf = 1); _CW("text"[, flag]) If $CWlf = 1 Then ConsoleWrite(@CR & $CWtext) Else ConsoleWrite($CWtext) EndIf EndFunc ; Func Console Write and Write to Logfile Func _CWL($CWLtext, $CWLlf = 1, $CWLtype = "n"); _CW("text"[, flag][, type]) If $CWLlf = 1 Then ConsoleWrite(@CR & $CWLtext) Else ConsoleWrite($CWLtext) EndIf $CWLfile = FileOpen($LogFile, 1) If $CWLtype = "s" Then FileWrite($CWLfile, "--- " & $CWLtext & " - " & _NowCalc()) If $CWLtype = "e" Then FileWrite($CWLfile, @CRLF & "--- " & $CWLtext & " - " & _NowCalc() & @CRLF & "----------------------------------------" & @CRLF & @CRLF ) If $CWLtype = "n" And $CWLlf = 1 Then $CWLtext = @CR & "- " & $CWLtext $CWLtext=StringReplace($CWLtext,@CRLF,@CR) $CWLtext=StringReplace($CWLtext,@CR,@CRLF) FileWrite($CWLfile, $CWLtext) EndIf If $CWLtype = "n" And $CWLlf = 0 Then FileWrite($CWLfile, $CWLtext) FileClose($CWLfile) EndFunc EndFunc_ConsoleWriteLog.au3
×
×
  • Create New...