Page 1 of 1
[Implemented] Save debug output text
Posted: Tue Sep 17, 2002 11:50 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
Fred, I think it would handy to have a "Save" button next to the
"Show Debug Window" checkbox, so that we can save the debug output
data to a text file if we need to. Hopefully you'll agree.
PB - Registered PureBasic Coder
Posted: Wed Sep 18, 2002 6:18 am
by BackupUser
Restored from previous forum. Originally posted by fweil.
Hello,
I agree, it would be nice to have this feature.
Right now, I suppose it is possible to make it using some API for Windows coders. The Debug output is a listbox child of the "PureBasic - Debug Output" window.
I do not have time to look at this now but soon I will do.
Rgrds
Francois Weil
14, rue Douer
F64100 Bayonne
Posted: Wed Sep 18, 2002 7:55 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.
> I do not have time to look at this now but soon I will do.
Maybe this is a start:
Code: Select all
Procedure SaveDebugTextCallback(hWnd,Value)
ClassName$ = Space(100)
GetClassName_(hWnd,@ClassName$,100)
If ClassName$ = "ListBox"
Count = SendMessage_(hWnd,#LB_GETCOUNT,0,0)
If Count = 0
MessageRequester("DEBUG SAVE","No Data in Debug Output",#MB_ICONINFORMATION)
Else
If OpenFile(1,PeekS(Value))
FileSeek(Lof())
WriteStringN(";---[ New Entry ]-------")
GetLocalTime_(time.SYSTEMTIME)
WriteStringN("; - Date: "+StrU(time\wDay,1)+"."+StrU(time\wMonth,1)+"."+StrU(time\wYear,1))
WriteStringN("; - Time: "+StrU(time\wHour,1)+":"+StrU(time\wMinute,1))
For a = 0 To Count - 1
Length = SendMessage_(hWnd,#LB_GETTEXTLEN,a,0)
Text$ = Space(Length)
SendMessage_(hWnd,#LB_GETTEXT,a,@Text$)
WriteStringN(" | "+Text$)
Next a
WriteStringN(";---[ End Entry ]-------")
WriteStringN("")
CloseFile(1)
MessageRequester("DEBUG SAVE","Saved Debugger Output to:"+Chr(13)+PeekS(Value),#MB_ICONINFORMATION)
Else
MessageRequester("DEBUG SAVE","Couldnt save Debug Output",#MB_ICONERROR)
EndIf
EndIf
EndIf
ProcedureReturn 1
EndProcedure
Procedure SaveDebugOutput(File$)
hDebug = FindWindow_(0,"PureBasic - Debug Output")
If hDebug
EnumChildWindows_(hDebug,@SaveDebugTextCallback(),@File$)
Else
MessageRequester("DEBUG SAVE","Debugger Disabled!",#MB_ICONERROR)
EndIf
EndProcedure
; Code Start
SaveDebugOutput("c:\PB_DEBUG.TXT")
Debug "TEST"
Debug Str(12)+" PureBasic Debug"
Debug "testing..."
Debug 123456
SaveDebugOutput("c:\PB_DEBUG.TXT")
Should be easy to use... simply ´SaveDebugOutput("c:\PB_DEBUG.TXT")´
Modify it to fit your needs...
HTH,
...Danilo
(registered PureBasic user)
Posted: Wed Sep 18, 2002 10:54 am
by BackupUser
Restored from previous forum. Originally posted by fred.
Impressive
Fred - AlphaSND
Posted: Wed Sep 18, 2002 12:16 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> Should be easy to use... simply ´SaveDebugOutput("c:\PB_DEBUG.TXT")´
Thanks Danilo! Mind if I put a cut-down version of that in PBToolBox?
I will naturally give you credit in PBToolBox's documentation.
PB - Registered PureBasic Coder
Posted: Wed Sep 18, 2002 7:43 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.
> Mind if I put a cut-down version of that in PBToolBox?
Do whatever you want with it... no credits needed.
cya,
...Danilo
(registered PureBasic user)
Posted: Thu Sep 19, 2002 12:41 am
by BackupUser
Restored from previous forum. Originally posted by PB.
> > Mind if I put a cut-down version of that in PBToolBox?
>
> Do whatever you want with it... no credits needed.
Okay, thanks Danilo!
PB - Registered PureBasic Coder