Source: Full-text link
(3) Read the TXT file to specify the first of a line? To the first? A word
- Uservar t=2 "Read txt line text"
- Uservar i=5 "Start reading from the first few words"
- Uservar o=8 "End read to the first few words"
- Text = Plugin.File.ReadFileEx ("path \ filename. txt")
- Txtarray=split (Text, "|")
- I=i-1
- O=o-i:t=t-1
- For O
- Str=str & Mid (Txtarray (t), 1+i,1)
- I=i+1
- Endwhile
- MessageBox Str
- Endscript
Copy Code
(4) Create a new TXT file
- Set Fso=createobject ("Scripting.FileSystemObject")
- Const FORWRITING=2
- Const FORREADING=1
- Set Myfile=fso.createtextfile ("path \ filename. txt")
Copy Code
(5) Determine if a file exists
- Isfile = Plugin.File.IsFileExit ("path \ filename. txt")
- If isfile = True
- MessageBox "Found"
- Else
- MessageBox "Not Found"
- EndIf
Copy Code
(6) Write content to TXT file
- Set Fso=createobject ("Scripting.FileSystemObject")
- Set Myfile=fso.createtextfile ("path \ filename. txt")
- MyFile.WriteLine ("content")
- Call Plugin.File.WriteFileEx ("path \ filename. txt", "content")
Copy Code
(7) Read TXT file to specify a line of content
- Text = Plugin.File.ReadFileEx ("path \ filename. txt")
- Txtarray=split (Text, "|")
- Display line 5th, write Txtarray (4). Displays line 6th. Just write Txtarray (5)
- MessageBox Txtarray (0)
Copy Code
(8) Read all contents of TXT file
- I=0
- Text = Plugin.File.ReadFileEx ("path \ filename. txt")
- Txtarray=split (Text, "|")
- While Len (Txtarray (I)) >=1
- Re=re & Txtarray (I)
- I=i+1
- Endwhile
- MessageBox RE
Copy Code
(9) How many lines to read TXT file
- I=0
- Text = Plugin.File.ReadFileEx ("path \ filename. txt")
- Txtarray=split (Text, "|")
- While Len (Txtarray (I)) >=1
- I=i+1
- Endwhile
- MessageBox I
Copy code TXT file usage Daquan "recommended"
TXT file usage Daquan "recommended"