本帖隱藏的內(nèi)容
- set fso=CreateObject("Scripting.FileSystemObject")
- const forwriting=2
- const forreading=1
- set myfile=fso.createtextfile("路徑\文件名.txt")
復(fù)制代碼
本帖隱藏的內(nèi)容
- Plugin IsFile = File.IsFileExit("路徑\文件名.txt")
- If IsFile = True
- MessageBox "找到"
- Else
- MessageBox "沒(méi)找到"
- EndIf
復(fù)制代碼
本帖隱藏的內(nèi)容
- Plugin File.DeleteFile("路徑\文件名.txt")
復(fù)制代碼
本帖隱藏的內(nèi)容方法1
- set fso=CreateObject("Scripting.FileSystemObject")
- set myfile=fso.createtextfile("路徑\文件名.txt")
- myfile.writeline("內(nèi)容")
復(fù)制代碼
本帖隱藏的內(nèi)容方法2
- Plugin File.WriteFileEx("路徑\文件名.txt", "內(nèi)容")
復(fù)制代碼
本帖隱藏的內(nèi)容
- Plugin Text = File.ReadFileEx("路徑\文件名.txt")
- txtArray=Split(Text,"|")
- // 顯示第5行,就寫 txtArray(4) 。 顯示第6行。就寫 txtArray(5)
- MessageBox txtArray(0)
復(fù)制代碼
本帖隱藏的內(nèi)容
- I=0
- Plugin Text = File.ReadFileEx("路徑\文件名.txt")
- txtArray=Split(Text,"|")
- While Len(txtArray(I))>=1
- RE=RE & txtArray(I)
- I=I+1
- EndWhile
- MessageBox RE
復(fù)制代碼
本帖隱藏的內(nèi)容
- I=0
- Plugin Text = File.ReadFileEx("路徑\文件名.txt")
- txtArray=Split(Text,"|")
- While Len(txtArray(I))>=1
- I=I+1
- EndWhile
- MessageBox i
復(fù)制代碼
本帖隱藏的內(nèi)容
- // 欲寫入的數(shù)據(jù)
- neirong="感謝您使用由《按鍵用戶》制作的腳本"
- // 寫入第幾行
- jihang=4
- Plugin Text = File.ReadFileEx("路徑\文件名.txt")
- txtArray=Split(Text,"|")
- txt=""
- i=0
- Rem z
- If Len(txtArray(i))>=1
- If i=jihang-1
- // 覆蓋
- txt = txt & neirong & vbCrLf
- Else
- txt = txt & txtArray(i) & Chr(10)
- EndIf
- i=i+1
- Goto z
- Else
- If i<=jihang
- MessageBox "少于"&jihang&"行"
- EndScript
- EndIf
- EndIf
- // 刪除舊文檔
- Plugin File.DeleteFile("路徑\文件名.txt")
- // 儲(chǔ)存新文檔
- Plugin File.WriteFileEx("路徑\文件名.txt", txt)
復(fù)制代碼
本帖隱藏的內(nèi)容
- // 欲寫入的數(shù)據(jù)
- neirong="感謝您使用此腳本"
- // 寫入第幾行
- jihang=5
- Plugin Text = File.ReadFileEx("路徑\文件名.txt")
- txtArray=Split(Text,"|")
- txt=""
- i=0
- // 若舊文檔大于jihang行
- If UBound(txtArray)>=1
- For jihang-1
- txt = txt & txtArray(i) & Chr(10)
- i=i+1
- EndFor
- txt = txt & neirong & vbCrLf
- For UBound(txtArray)-(jihang-1)
- txt = txt & txtArray(i) & Chr(10)
- i=i+1
- EndFor
- Else
- // 若舊文檔小于jihang行
- For UBound(txtArray)
- txt = txt & txtArray(i) & vbCrLf
- i=i+1
- EndFor
- txt = txt & neirong & vbCrLf
- EndIf
- // 刪除舊文檔
- Plugin File.DeleteFile("路徑\文件名.txt")
- // 儲(chǔ)存新文檔
- Plugin File.WriteFileEx("路徑\文件名.txt", txt)
復(fù)制代碼
(10)讀取TXT文件指定某一行的第?到第?個(gè)字 本帖隱藏的內(nèi)容
- UserVar t=2 讀出txt第幾行文本
- UserVar i=5 從第幾個(gè)字開(kāi)始讀取
- UserVar O=8 結(jié)束讀取到第幾個(gè)字
- Plugin Text = File.ReadFileEx("路徑\文件名.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
復(fù)制代碼
|