Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to increase "out" buffer size
#1
I have a macro which outputs lots of characters using the "out" command.

Unfortunately it fills up the buffer quickly.

Is it possible for me to increase the buffer size so that very large amounts of text can be displayed using the "out" command?

At the moment qm just overwrites the early characters with "..." when the buffer fills up.

Note I do not want to write the characters to a file as this would slow the macro down (due to read/ write to the hard drive) as the macro needs to run extremely fast.

I would like to just view all of the characters sent using "out" in the main qm window and then maybe copy and paste them from there.

Thank you
#2
Max QM output text length is 4 MB, and cannot be changed.

Function LogFileFast
Code:
Copy      Help
;/
function $text

;Writes text to file "$my qm$\LogFileFast.txt". Appends newline.
;This function is fast, faster than out. Writes to file asynchronously, every 1 s and when QM exits.
;Deletes old file when called first time in current QM session.
;To change file, edit this function. Or execute this when QM starts, before calling this function first time: str+ g_LFF_File="C:\...\your file\txt"


lock _LogFileFast
str+ g_LFF_File __LFF_Buffer
int+ __LFF_Thread
__Handle+ __LFF_Event

if !__LFF_Thread
,if(!g_LFF_File.len) g_LFF_File="$my qm$\LogFileFast.txt"
,if(FileExists(g_LFF_File)) del- g_LFF_File; err out "Error in LogFileFast: failed to delete old file."
,__LFF_Buffer.flags=3
,__LFF_Event=CreateEvent(0 0 0 0)
,__LFF_Thread=1
,mac "sub.Thread"

__LFF_Buffer.addline(text)

lock- _LogFileFast
if(__LFF_Buffer.len>4000000) SetEvent __LFF_Event; 0.001


#sub Thread
atend sub.Atend
rep
,wait 1 H __LFF_Event; err
,if(__LFF_Buffer.len) sub.WriteToFile


#sub WriteToFile
lock _LogFileFast
__LFF_Buffer.swap(_s)
lock- _LogFileFast
_s.setfile(g_LFF_File -1); err out "Error in LogFileFast: failed to write to file."


#sub Atend
if(__LFF_Buffer.len) sub.WriteToFile
#3
This is brilliant thank you.

Is it possible to use the function to output variables and numbers as well as text?
#4
Use F"string":
int v=5
LogFileFast F"variable={v}"

Or replace
function $text
to
function str'text

Then can pass numbers directly:
int v=5
LogFileFast v
#5
Very clever thank you!


Forum Jump:


Users browsing this thread: 1 Guest(s)