找回密码
 加入
搜索
查看: 1649|回复: 7

[AU3基础] [已解决]FileReadLine在比大小的時候似乎有bug

  [复制链接]
发表于 2017-3-7 15:34:10 | 显示全部楼层 |阅读模式
本帖最后由 ipmitool 于 2017-3-7 17:15 编辑

FileReadLine在比大小的時候似乎有bug
10明明大於9, 但是FileReadLine在比大小的時候結果有問題...

$RecordCycle1 = FileOpen("RecordCycle1.txt")
$ReadCycle1 = FileReadLine($RecordCycle1,1)


$RecordCycle2 = FileOpen("RecordCycle2.txt")
$ReadCycle2 = FileReadLine($RecordCycle2,1)


if $ReadCycle2 >= $ReadCycle1 Then
MsgBox(0,"111",">=")
Else

EndIf

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2017-3-7 15:46:09 | 显示全部楼层
回复 1# ipmitool

把讀取的結果 加上0  在比一次大小呢??
发表于 2017-3-7 15:53:53 | 显示全部楼层
本帖最后由 229989799 于 2017-3-7 15:59 编辑

我也是初学者,研究了一下。大概是先读取文件1和2里面的值,再对比大小。
$ReadCycle1 = FileOpen(FileReadLine("RecordCycle1.txt",1))
$ReadCycle2 = FileOpen(FileReadLine("RecordCycle2.txt",1))

If $ReadCycle2 >= $ReadCycle1 Then
        MsgBox(0,'','>=')
Else
        EndIf

评分

参与人数 1金钱 +40 收起 理由
ipmitool + 40

查看全部评分

 楼主| 发表于 2017-3-7 16:04:35 | 显示全部楼层
回复 2# kk_lee69


    後來在變數前面加 chr() 就解決了...不知道大哥您覺得ok嗎?
if chr($ReadCycle2) >= chr($ReadCycle1) Then
 楼主| 发表于 2017-3-7 16:06:33 | 显示全部楼层
回复 3# 229989799


    水喔! 謝謝大大~
发表于 2017-3-7 16:19:16 | 显示全部楼层
可以了,就改个【已解决】标题吧。
发表于 2017-3-7 18:55:45 | 显示全部楼层
本帖最后由 帆船 于 2017-3-7 18:57 编辑

这个跟FileReadLine没有任何关系!
用Chr也是错误的!

$Read1 = "10"
$Read2 = "9"
$Hex1 = Hex(Binary($Read1))
$Hex2 = Hex(Binary($Read2))
ConsoleWrite($Hex1 & @TAB & $Hex2 & @CRLF)
If Number($Hex1) > Number($Hex2) Then
        ConsoleWrite($Read1 & ">" & $Read2 & @CRLF)
ElseIf Number($Hex1) = Number($Hex2) Then
        ConsoleWrite($Read1 & "=" & $Read2 & @CRLF)
ElseIf Number($Hex1) < Number($Hex2) Then
        ConsoleWrite($Read1 & "<" & $Read2 & @CRLF)
EndIf
发表于 2017-3-7 23:08:35 | 显示全部楼层
FileReadLine
返回的是文本,是字符串
字符串比较用StringCompare
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-20 13:04 , Processed in 0.080914 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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