按键精灵txt判断
1 2 3 4 5 6 7 8 | 句子 = "度阿斯达娘阿婶是大的百度知道" 词 = "百度知道" MyPos = Instr(句子, 词) If MyPos > 0 Then TracePrint "找到" Else TracePrint "没找到" End If |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | (3)读取TXT文件指定某一行的第?到第?个字 UserVar t=2 "读出txt第几行文本" UserVar i=5 "从第几个字开始读取" UserVar O=8 "结束读取到第几个字" Text = Plugin.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 复制代码 (4)新建一个TXT文件 set fso=CreateObject("Scripting.FileSystemObject") const forwriting=2 const forreading=1 set myfile=fso.createtextfile("路径\文件名.txt") 复制代码 (5)判断一个文件是否存在 IsFile = Plugin.File.IsFileExit("路径\文件名.txt") If IsFile = True MessageBox "找到" Else MessageBox "没找到" EndIf 复制代码 (6)给TXT文件写入内容 set fso=CreateObject("Scripting.FileSystemObject") set myfile=fso.createtextfile("路径\文件名.txt") myfile.writeline("内容") Call Plugin.File.WriteFileEx("路径\文件名.txt", "内容") 复制代码 (7)读取TXT文件指定某一行内容 Text = Plugin.File.ReadFileEx("路径\文件名.txt") txtArray=Split(Text,"|") // 显示第5行,就写 txtArray(4) 。 显示第6行。就写 txtArray(5) MessageBox txtArray(0) 复制代码 (8)读取TXT文件全部内容 I=0 Text = Plugin.File.ReadFileEx("路径\文件名.txt") txtArray=Split(Text,"|") While Len(txtArray(I))>=1 RE=RE & txtArray(I) I=I+1 EndWhile MessageBox RE 复制代码 (9)读取txt文件一共多少行 I=0 Text = Plugin.File.ReadFileEx("路径\文件名.txt") txtArray=Split(Text,"|") While Len(txtArray(I))>=1 I=I+1 EndWhile MessageBox i |
博客园:冷色008
百度:冷色008
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步