VBScript     . - 3GL   - 4GL   DB-

web- VBScript

VBScript

:


( ).

- CreateTextFile. , , :

Dim fso, f1
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.CreateTextFile("c:\testfile.txt", True)
. <3.7. FileSystemObject>.

- OpenTextFile FileSystemObject ForWriting. , , :

Dim fso, ts
Const ForWriting = 2
Set fso = CreateObject("Scripting. FileSystemObject")
Set ts = fso.OpenTextFile("c:\test.txt", ForWriting, True)
- OpenAsTextStream ForWriting. , , :
Dim fso, f1, ts
Const ForWriting = 2
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CreateTextFile ("c:\test1.txt")
Set f1 = fso.GetFile("c:\test1.txt")
Set ts = f1.OpenAsTextStream(ForWriting, True)


, , :

OpenTextFile FileSystemObject OpenAsTextStream File.

Write, WriteLine WriteBlankLines TextStream, , :

Write
WriteLine
WriteBlankLines

Close TextStream. Close FileSystemObject. . <3.7. FileSystemObject>.


( ) ( / ). , .

, , :

Sub CreateFile()
  Dim fso, tf
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set tf = fso.CreateTextFile("c:\testwritefile.txt", True)
  '       .
  tf.WriteLine(" 1, 2, 3.") 
  '      .      
  tf.WriteBlankLines(3) 
  '  
  tf.Write (" ") 
  tf.Close
End Sub


Read, ReadLine ReadAll TextStream. , , :

Read
( , ) ReadLine
ReadAll

. <3.7. FileSystemObject>.

Read ReadLine , Scip ScipLine. , , (, Left, Right Mid), ..

, , , :

Sub ReadFiles
  Dim fso, f1, ts, s
  Const ForReading = 1
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set f1 = fso.CreateTextFile("c:\testreadfile.txt", True)
  '  
  f1.WriteLine "Hello World"
  f1.WriteBlankLines(1)
  f1.Close
  '   
  Set ts = fso.OpenTextFile("c:\testreadfile.txt", ForReading)
  s = ts.ReadLine
  MsgBox "  = '" & s & "'"
  ts.Close
End Sub


,

FSO , . , , :

File.Move FileSystemObject.MoveFile
File.Copy FileSystemObject.CopyFile
File.Delete FileSystemObject.DeleteFile

. <3.7. FileSystemObject>.

, . \tmp, \temp, .

tmp temp.

Sub ManipFiles
  Dim fso, f1, f2, s
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set f1 = fso.CreateTextFile("c:\testfile.txt", True)
  '  
  f1.Write ("This is a test.")
  '    
  f1.Close
  '       C:\.
  Set f2 = fso.GetFile("c:\testfile.txt")
  '     \tmp
  f2.Move ("c:\tmp\testfile.txt")
  '     \temp.
  f2.Copy ("c:\temp\testfile.txt")
  '   
  Set f2 = fso.GetFile("c:\tmp\testfile.txt")
  Set f3 = fso.GetFile("c:\temp\testfile.txt")
  '  
  f2.Delete
  f3.Delete
  MsgBox "  !"
End Sub

  VBScript     . - 3GL   - 4GL   DB-


, , Class - - , , .




 10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _.
10.11.2021 - 12:36: - Conscience -> . ? - _.
10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _.
10.11.2021 - 12:35: - Ecology -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> . - _.
10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _.
10.11.2021 - 09:18: - New Technologies -> , 5G- - _.
10.11.2021 - 09:18: - Ecology -> - _.
10.11.2021 - 09:16: - Ecology -> - _.
10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _.
10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _.
Bourabai Research -  XXI Bourabai Research Institution