Posts: 121
Threads: 33
Joined: Jun 2007
Hi,
Been a while...forgotten some of my qm basics (and where to find them).
What's the best way to write the entire contents of the qm output window - or equivalent - to a text file in a specific directory following the execution of a macro?
The text file can/should be overwritten each time the macro runs. If it makes any difference, the macro will be a compiled exe (eventually).
Thanks in advance!
Steve
Posts: 12,072
Threads: 140
Joined: Dec 2002
Macro
str s
int h=id(2201 _hwndqm)
#if QMVER>=0x02030000
int lens=SendMessage(h SCI.SCI_GETTEXTLENGTH 0 0)
s.fix(SendMessage(h SCI.SCI_GETTEXT lens+1 s.all(lens)))
#else
s.getwintext(h)
#endif
;mes s
s.setfile("$desktop$\test.txt")
Posts: 121
Threads: 33
Joined: Jun 2007
Thanks, but I am having a problem with this code...
When running as a QM macro:
In the case that the QM output window is empty (clear) at the start, there is nothing written to the file. Only on subsequent runs, where there is already text in the QM output window, is there anything in the text file.
When running as an EXE:
Given the above, running as an exe (which starts with a clear output, I gather) also logs nothing to the text file.
Any suggestions?
Macro
str wdir="c:\directory"
str idir="c:\anotherdirectory\"
out "wdir"
out wdir
out "idir"
out idir
str s
int h=id(2201 _hwndqm)
#if QMVER>=0x02030000
int lens=SendMessage(h SCI.SCI_GETTEXTLENGTH 0 0)
s.fix(SendMessage(h SCI.SCI_GETTEXT lens+1 s.all(lens)))
#else
s.getwintext(h)
#endif
;mes s
s.setfile("$desktop$\test.txt")
Posts: 12,072
Threads: 140
Joined: Dec 2002
QM 2.3.0. In exe you cannot get QM output text.
Older versions. str s.getwintext(id(2201 win("" "QM_Editor")))
Posts: 121
Threads: 33
Joined: Jun 2007
I made the EXE in 2.2 and all works just fine - thanks!