1

I am using BASIC for the first time to automate a LeCroy Oscilloscope. Following examples provided by them I am attempting to create a program which uses the oscilloscope features and prints measured values to file.

The oscilloscope specific features appear to function correctly but the file creation code does not create the file at the specified path.

Private Sub MakeFile()

    fso = CreateObject("Scripting.FileSystemObject")
    MyFile = fso.CreateTextFile("E:\test.txt")

End Sub

When run the script produces nothing. As I haven't used BASIC before this and it naively seems like this should, as a bare minimum, create the file at the path specified. Certainly it seems to compared to the examples provided by LeCroy.

I use this method as the examples provided make use of:

On Error Resume Next

Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.OpenTextFile("D:\Hardcopy\logfile.txt", 8, True)

Also the basis of the Oscilloscope is a Windows 7 PC and they claim that both BASIC and their additional methods work within the system.

I don't know if this is just me being completely unable to BASIC or if there is a nuance I am missing. Alternatively there may be a way to implement this within the LeCroy system that is different to this.

If anyone can verify if this would work if it was straight up BASIC OR if you know programming for a LeCroy 'scope, how would I go about file creation on one, since this isn't working.

Thanks!

radiskull
  • 23
  • 2

1 Answers1

0

Why aren't you using StreamReader and StreamWriter?

Dim writer As New StreamWriter("E:\test.txt")
writer.Write("")

And for StreamReader:

Dim reader As New StreamReader("D:\Hardcopy\logfile.txt")
Dim text As String = reader.ReadToEnd

You may need to import System.IO

VisualGhost
  • 49
  • 1
  • 1
  • 7
  • I hadn't used this before now as the examples supplied, which worked when run, used the methods above. Simply it didn't enter in my thoughts that I was doing anything more than messing it up. Sadly trying this didn't work within the script needed though. I think I need to go to the company who makes the devices and ask as I must be missing something more simplistic. – radiskull Oct 23 '14 at 08:39