swzoh wrote:

> Assuming the contents in debug window do not contain \r or \n

Thanks Sean!
Here's a script that writes the contents of the debug window to a file
preserving \r and \n. Characters \x01 and \xFF are used internally, so
if they're part of the debug window they'll result in incorrect output. 

; ==============================================
; print contents of debug window to file arg(1)
; when arg(2)==0 sort latest record first
; when arg(2)==1 sort latest record last 
; when arg(3)="a" append to file
@Win2File
local v,i,s,RS=esc(??\n?,??\?)
s=MiscPlugin.Get_WindowText("PowerPro Debug",1,"sep=1")
s=replacechars(s,esc(??\n\r\xFF?,??\?))
s=replacechars(s,esc(??\x01\n?,??\?))
v=vec.CreateFromLines(s)
s="["++vec.length(v)++" records]"
if(arg(2))do
  for (i=vec.length(v)-1; i>=0; i=i-1)
    s=s++RS++"["++i++"]"++replacechars(v[i],esc(??\xFF\n?,??\?))
  endfor
else
  for (i=0; i<vec.length(v); i=i+1)
    s=s++RS++"["++i++"]"++replacechars(v[i],esc(??\xFF\n?,??\?))
  endfor
endif
file.writeall(arg(1),s++esc(??\n?,??\?),arg(3))
quit



Attention: PowerPro's Web site has moved: http://www.ppro.org 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/power-pro/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to