找回密码
 加入
搜索
楼主: mexiaoyuoo

高手解决下,如何随机取.txt某行值

[复制链接]
发表于 2009-10-15 18:09:44 | 显示全部楼层
15# sxd


我怎么听着这么别扭,难道我的代码和主题差的太远???
发表于 2009-10-15 18:10:58 | 显示全部楼层
揍下热闹#Include
$_Paht=@SystemDir & "\eula.txt"
Dim $aRecords
If _FileReadToArray($_Paht,$aRecords) Then
        $Random=Random(1,$aRecords[0],1)
        MsgBox(0, $Random & " 行",$aRecords[$Random])
Else
...
bing614 发表于 2009-10-15 13:34


晕,凑打成揍了........
发表于 2009-10-15 18:56:09 | 显示全部楼层
哈哈 眼神还是不错的
发表于 2009-10-16 01:52:26 | 显示全部楼层
我怎么看到都要调用_XXXX的外部函数?AU3里的函数不能直接用吗?
$vfile = "新建 文本文档.txt"
$nRandomLine = Random(1,nReadLine($vfile),1)
MsgBox(0,"第"&$nRandomLine&"的内容是",FileReadLine($vfile,$nRandomLine))

Func nReadLine($Val)
   $file = FileOpen($Val, 0)
   $xTemVal=0
   While 1
      $line = FileReadLine($file)
      $xTemVal = $xTemVal + 1
      If @error = -1 Then ExitLoop
   Wend
   FileClose($Val)
   return $xTemVal
EndFunc
发表于 2009-10-18 12:23:38 | 显示全部楼层
这个很好用啊,谢谢高手们了~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-22 18:20 , Processed in 0.069553 second(s), 14 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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