I have edited the format, so it looks like the other error messages (testet with SciTE4Autohotkey Version 3.0.04).
You can use this Script for debug.
Many thanks to Lexikos for this great function!
Code: Select all
; ============================================================================================
; | StdErr_Write(A_LineNumber,ErrorMessage[,Specifically])
; |
; | Date : 2013 / 12 / 12
; |
; | Autor : "Lexikos" (edited by Holle: "Use the same format like the other error messages" ...testet with SciTE4AutoHotkey Version 3.0.04)
; | Original thread: http://www.autohotkey.com/board/topic/50306-can-a-script-write-to-stderr/?hl=errorstdout#entry314658
; |
; | Examples: StdErr_Write(A_LineNumber,"This function needs pairs of parameter.","odd number")
; | month<1||month>12?StdErr_Write(A_LineNumber,"The variable month must have a value between 1 and 12.","month := " month)
; |
; ============================================================================================
StdErr_Write(LineNumber, text, spec = "") {
text := A_ScriptFullPath " (" LineNumber ") : ==> " . text
text .= spec?"`n Specifically: " spec "`n":
if A_IsUnicode
return StdErr_Write_("astr", text, StrLen(text))
return StdErr_Write_("uint", &text, StrLen(text))
}
StdErr_Write_(type, data, size) {
static STD_ERROR_HANDLE := -12
if (hstderr := DllCall("GetStdHandle", "uint", STD_ERROR_HANDLE)) = -1
return false
return DllCall("WriteFile", "uint", hstderr, type, data, "uint", size, "uint", 0, "uint", 0)
}