1. FileDialog
Document.FileDialog(long type,
LPCTSTR ext)
Type=0: Read File Dialog, Type=1: Save File Dialog,Sample:
ext=File filter
rc=Document.FileDialog(0,"*.txt")2. Text File object
If rc = 0 Then
name=Document.Buffer
End If
Dim fs, f
Set fs=CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("c:\temp\test.txt",2,True)
f.WriteLine "Hi"
f.Close
Sample2£º
type=0, Open file for read, Type=1, Open file for writeb) Close File
name:File name and path
c) Read Data
data=Document.readdata(type)
type=0, Read a char; 1: Read a short ,2=Read a long, 3=Read a float , 4=Read a double
d)Write Data
Document.writedata type, data
type=0, Write a char; 1: Write a short ,2=Write a long, 3=Write a float , 4=Write a double
4) API Communicate with VSI32
a) Read sample data length of VSI32
len=Document.ReadLen()
b)Read sample frequency of VSI32
Fs=Document.ReadFs()
c)Write sample data length of VSI32
Document.WriteLen(len)
d)Write sample frequency of VSI32
Document.WriteFs(Fs)
e)Read CH1 sample data of VSI32
f)Read CH2 sample data of VSI32
Dim data(2048),data1(2048)e)Write CH1 sample data of VSI32
For K = 0 To 2047 //Let data and data1 to double type , only double can be used
data(k)=0.00001
data1(k)=0.00001
Next
Rc=Document.ReadCH1(1024,data)
Rc=Document.ReadCH2(1024,data1)
f)Write CH2 sample data of VSI32
For K = 0 To 2047g) Refresh VSI32
data(k)=5.00*K
data1(k)=-5.00*K
Next
Rc=Document.WriteCH1(1024,data)
Rc=Document.WriteCH2(1024,data1)
Sample:Generate a sine wave by script
REM VB Script For VSI 32[Return]
Dim data(2048),data1(2048)
V=Document.InputBox("Amplitude:(1000-10000)")
Document.WriteLen(2048)
Document.WriteFs(5120)
dt=1.0/5120
For K = 0 To 2047
data(k)=V*Cos(2.0*3.14*50*k*dt)
data1(k)=V*Sin(2.0*3.14*50*k*dt)
Next
Rc=Document.WriteCH1(2048,data)
Rc=Document.WriteCH2(2048,data1)
Rc=Document.DataChanged()