Writingi LW info to file using .SelectDevice - not working?

To all,

1st steps into writing the text in the listing Window, see http://nxjournaling.com/content/write-text-file, to a file and failed miserably. Good news is that the file (test.log) is created, bad news is that nothing is written to it!

The only change I have made to the kindly provided script (thanks NXJournaling) is the following;

Dim workPart As CAE.SimPart = theSession.Parts.BaseWork
instead of of
Dim workPart As Part = theSession.Parts.Work

the problem seems to be around the line
lw.SelectDevice(ListingWindow.DeviceType.FileAndWindow, outputFile)
because if I exclude it, the data is Written to the LW " as normal". if the line is in the script then nothing is written to the LW

I did a quick test by inserting the line: lw.WriteLine("my doc path is " & mydocs)
just after "mydocs=" and the info is displayed as normal

Any suggestions?

Thanks

Regards

JXB

Did you flush the buffer by changing the output device when you were done writing to the file (as explained in the article you linked to)?

I left the code as provided to start with except the change to work from a. sim part I mentioned on the 1st post

Thanks
Regards

I looks like I also moved the line lw.Open() BEFORE lw.SelectDevice() (I guess I was playing with something!). Putting back after does the job

Thanks
Regards