找回密码
 加入
搜索
查看: 1540|回复: 3

如何提取 这个txt的文本信息

[复制链接]
发表于 2008-12-21 15:23:14 | 显示全部楼层 |阅读模式
Drive   No.     Active  VolumeLabe      Total (Mb)     Free (Mb)
C:        1:1         A                                45841          39919  
D:        1:2                                          30474          22399  
下面 可能还会有新的盘符

我要的是 C:=1:1 D:=1:2
如果有新的 如 E:=1;3 等 信息
 楼主| 发表于 2008-12-21 15:29:18 | 显示全部楼层
现在用的是这个方法 请问 还能否简单一点????

[au3]#include <file.au3>
Dim $aRecords
If Not _FileReadToArray("partinfo.txt",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
For $x = 2 to $aRecords[0]
       
        if $aRecords[$x]="Drive   No.     Active  VolumeLabe      Total (Mb)     Free (Mb)" Then
       
Else
       
$test=StringSplit($aRecords[$x],"        ")

MsgBox(0,0,$test[1]&"   "&$test[2])

        EndIf
       
Next

[/au3]
发表于 2008-12-21 16:46:04 | 显示全部楼层
$a=FileRead("d:\a.txt")
;MsgBox(0,0,$a)
$b=StringRegExp($a,'[A-Z]:\s+\d:\d',3)

For $i=0 to UBound($b)
        ;MsgBox(0,'test',$b[$i])
        MsgBox(0,'test',StringRegExpReplace($b[$i],'\s+','='))
Next
发表于 2008-12-21 16:49:52 | 显示全部楼层
简洁明了~~~~~~~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-23 09:26 , Processed in 0.084235 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表