Using 2 LWs - Is this possible?

To all

A stupid question. I have a small programme creating results and extracting the required data. I am using the listing window (LW) to display messages to the user on what is happening, things like
-Reading input file
-Creating results...
-Result created

etc

at the end, the programme extracts results and one possibility/idea is to "print" the result to a text file (csv format) using the DeviceType.File option on the LW.
http://www.nxjournaling.com/content/writingi-lw-info-file-using-selectde...

The issue is that I only want the "csv data" in the output file not the whole content of the LW. So the (stupid)) questions is:
Can one work with more than one LW?

Mind you I may review the "work flow" and output the extracted data directly to an xls.

Thanks
Regards
JXB

To the best of my knowledge, it is NOT possible to use two different listing windows simultaneously. Also note that the listing window has a limit of ~132 characters per line. If your data exceeds this limit, the listing window will "wrap" the data to the next line or truncate it; neither option is desirable for .CSV output.

I would recommend writing out the data to a text file (.CSV is a text file) directly. The .NET framework makes writing to a text file pretty easy (almost as easy as using the listing window). See the .NET streamwriter section in the article:
http://nxjournaling.com/content/write-text-file

Thanks. I kinda reach that conclusion as creating a 2nd 'Dim theLW2' does nothing. I am also re-reading the use of the streamwriter in the link provided as it does indeed seem easier to do/use. Not sure yet if one needs to write to the csv file at the end of each loop or "accumulate" the data in a string and then write that string to the csv file

the loops are

For each line in input file
create result
For Each iteration As CAE.BaseIteration In lastLoadCase.GetIterations For eachbaseResultType
For Each baseResultType
For Each FEElm as CAE.FEElement In thearrFEElm
get the result
write a string ElmID,Xforce,YForce,ZForce
Next FEElm
Next baseResultType
Next iteration

I still need to review the use of XLS as "direct" output as I wrote a "macro" a while a go which I might be able to re-use

Thanks
Regards

"Not sure yet if one needs to write to the csv file at the end of each loop or "accumulate" the data in a string and then write that string to the csv file"

That will probably depend on how much formatting of the data you need to do.

I am formatting the data within the program. I am testing writing the data after the For Each iteration ...Next loop. (Still haven't decided about writing to csv file vs. writing to xls). See (partial) code below. It seems to work as I am getting all the data to the test.log file

in the for Each FEElm ... Loop

Dim sep As String = ","
sLineOutputData = "" & theFEElmID.ToString & sep _
& XForceValue.ToString & sep _
& YForceValue.ToString & sep _
& ZForceValue.ToString & sep _
& theRespSimName & sep _
& theEventName & sep _
&lastLoadCase.Name

'Append data for future writing to the .csv file
sFinalOutputData = sFinalOutputData & vbCrLf & sLineOutputData

once the program has looped through everything

Dim outputFile As String ="H:\test.log" 'for testing only
TheLW.WriteLine("--Writing data to .csv file: " & outputFile)

Using myWriter As New IO.StreamWriter(outputFile, False)
Dim createdTime As DateTime = DateTime.Now

myWriter.WriteLine("File created: " & createdTime.ToString)
myWriter.WriteLine("Sim. File used: " & IO.Path.GetFileName(theSimPart.FullPath))
myWriter.WriteLine("Sim. full path: " & IO.Path.GetDirectoryName(theSimPart.FullPath))
myWriter.WriteLine(New String("-", ("full path: " & theSimPart.FullPath).Length))
myWriter.WriteLine("" & sFinalOutputData)
End Using

EXAMPLE OF DATA IN test.log

File created: 16/04/2015 09:34:25
Sim. File used: test_sim.sim
Sim. full path: D:\test\
--------------------------------------------------------------------------------------------

15,-2368.98999023438,17895.126953125,-242457.671875,RespSim1Check,ShockX20g,Peak Results 2
157,-2368.98999023438,17895.126953125,-9828.4609375,RespSim1Check,ShockX20g,Peak Results 2
21,-2368.98999023438,17895.126953125,34848.09765625,RespSim1Check,ShockX20g,Peak Results 2
105,-2368.98999023438,17895.126953125,-16556.650390625,RespSim1Check,ShockX20g,Peak Results 2
180,-2368.98999023438,17895.126953125,3712.50708007813,RespSim1Check,ShockX20g,Peak Results 2
95,-2368.98999023438,17895.126953125,12083.888671875,RespSim1Check,ShockX20g,Peak Results 2
178,-2368.98999023438,17895.126953125,88824.5078125,RespSim1Check,ShockX20g,Peak Results 2
18,-2368.98999023438,17895.126953125,-21136.17578125,RespSim1Check,ShockX20g,Peak Results 2
121,-2368.98999023438,17895.126953125,-532488.625,RespSim1Check,ShockX20g,Peak Results 2

Thanks
Regards