小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

【新提醒】TXT文件用法大全【薦】1

 淳爺們 2013-08-28
(1)覆蓋TXT文件指定某一行內(nèi)容
  1. // 欲寫(xiě)入的數(shù)據(jù)
  2. neirong="感謝您使用由《按鍵用戶》制作的腳本"
  3. // 寫(xiě)入第幾行
  4. jihang=5
  5. Text = Plugin.File.ReadFileEx("路徑\文件名.txt")
  6. txtArray=Split(Text,"|")
  7. txt=""
  8. i=0
  9. Rem z
  10. If Len(txtArray(i))>=1
  11.     If i=jihang-1
  12.         // 覆蓋
  13.         txt = txt & neirong & vbCrLf
  14.     Else 
  15.         txt = txt & txtArray(i) & vbCrLf
  16.     EndIf 
  17.     i=i+1
  18.     Goto z
  19. Else 
  20.     If i<=jihang
  21.         MessageBox "少于"&jihang&"行"
  22.         EndScript 
  23.     EndIf 
  24. EndIf 
  25. // 刪除舊文檔
  26. Call Plugin.File.DeleteFile("路徑\文件名.txt")
  27. // 儲(chǔ)存新文檔
  28. Call Plugin.File.WriteFileEx("路徑\文件名.txt", txt)
復(fù)制代碼

(2)插入內(nèi)容到TXT文件的指定某一行
  1. //欲寫(xiě)入的數(shù)據(jù)
  2. neirong="感謝您使用此腳本"
  3. //寫(xiě)入第幾行
  4. jihang=5
  5. Text = Plugin.File.ReadFileEx("路徑\文件名.txt")
  6. txtArray=Split(Text,"|")
  7. txt=""
  8. i=0
  9. // 若舊文檔大于jihang行
  10. If UBound(txtArray)>=1
  11.     For jihang-1
  12.         txt = txt & txtArray(i) & vbCrLf
  13.         i=i+1
  14.     EndFor 
  15.     txt = txt & neirong & vbCrLf
  16.     For UBound(txtArray)-(jihang-1)
  17.         txt = txt & txtArray(i) & vbCrLf
  18.         i=i+1
  19.     EndFor 
  20. Else 
  21.     // 若舊文檔小于jihang行
  22.     For UBound(txtArray)
  23.         txt = txt & txtArray(i) & vbCrLf
  24.         i=i+1
  25.     EndFor 
  26.     txt = txt & neirong & vbCrLf
  27. EndIf 
  28. // 刪除舊文檔
  29. Call Plugin.File.DeleteFile("路徑\文件名.txt")
  30. // 儲(chǔ)存新文檔
  31. Call Plugin.File.WriteFileEx("路徑\文件名.txt", txt)
復(fù)制代碼

(3)讀取TXT文件指定某一行的第?到第?個(gè)字
  1. UserVar t=2 "讀出txt第幾行文本"
  2. UserVar i=5 "從第幾個(gè)字開(kāi)始讀取"
  3. UserVar O=8 "結(jié)束讀取到第幾個(gè)字"
  4. Text = Plugin.File.ReadFileEx("路徑\文件名.txt")
  5. txtArray=Split(Text,"|")
  6. I=I-1
  7. O=O-I:T=T-1
  8. For O
  9.     str=str & Mid(txtArray(t),1+i,1)
  10.     i=i+1
  11. EndWhile 
  12. MessageBox str
  13. EndScript
復(fù)制代碼

(4)新建一個(gè)TXT文件
  1. set fso=CreateObject("Scripting.FileSystemObject")
  2. const forwriting=2
  3. const forreading=1
  4. set myfile=fso.createtextfile("路徑\文件名.txt")
復(fù)制代碼

(5)判斷一個(gè)文件是否存在
  1. IsFile = Plugin.File.IsFileExit("路徑\文件名.txt")
  2. If IsFile = True
  3.     MessageBox "找到"
  4. Else 
  5.     MessageBox "沒(méi)找到"
  6. EndIf 
復(fù)制代碼

(6)給TXT文件寫(xiě)入內(nèi)容
  1. set fso=CreateObject("Scripting.FileSystemObject")
  2. set myfile=fso.createtextfile("路徑\文件名.txt")
  3. myfile.writeline("內(nèi)容")
  4. Call Plugin.File.WriteFileEx("路徑\文件名.txt", "內(nèi)容")
復(fù)制代碼

(7)讀取TXT文件指定某一行內(nèi)容
  1. Text = Plugin.File.ReadFileEx("路徑\文件名.txt")
  2. txtArray=Split(Text,"|")
  3. // 顯示第5行,就寫(xiě) txtArray(4) 。 顯示第6行。就寫(xiě) txtArray(5)
  4. MessageBox txtArray(0)
復(fù)制代碼

8)讀取TXT文件全部?jī)?nèi)容
  1. I=0
  2. Text = Plugin.File.ReadFileEx("路徑\文件名.txt")
  3. txtArray=Split(Text,"|")
  4. While Len(txtArray(I))>=1
  5.     RE=RE & txtArray(I)
  6.     I=I+1
  7. EndWhile 
  8. MessageBox RE
復(fù)制代碼

(9)讀取txt文件一共多少行
  1. I=0
  2. Text = Plugin.File.ReadFileEx("路徑\文件名.txt")
  3. txtArray=Split(Text,"|")
  4. While Len(txtArray(I))>=1
  5.     I=I+1
  6. EndWhile 
  7. MessageBox i
復(fù)制代碼

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類(lèi)似文章 更多