找回密码
 加入
搜索
查看: 1396|回复: 4

[系统综合] 读取配置文件数值进行比对为什么4都大于300????

[复制链接]
发表于 2011-1-8 21:21:06 | 显示全部楼层 |阅读模式
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Dim $cfg=@ScriptDir&"\1.txt"
$k=IniRead($cfg,"set","数值","")
MsgBox(64,"123",$k)
$Form1 = GUICreate("Form1", 224, 109, 192, 114)
$Input1 = GUICtrlCreateInput("Input1", 16, 16, 193, 21)
$Input2 = GUICtrlCreateInput("Input2", 16, 40, 193, 21)
$Button1 = GUICtrlCreateButton("Button1", 104, 64, 105, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1;;;;;;; 数字4,5,6,7,8,9 等数字 它计算的结果小于$K  怎样才可以正确比对??
                        If GUICtrlRead($Input1)<=$k Then GUICtrlSetData($Input2,GUICtrlRead($Input1))
        EndSwitch
WEnd
1.TXT内容
[set]
数值=300
发表于 2011-1-8 21:39:42 | 显示全部楼层
If GUICtrlRead($Input1) <= Number($k) Then GUICtrlSetData($Input2, GUICtrlRead($Input1))
发表于 2011-1-8 21:40:13 | 显示全部楼层
Dim $cfg = @ScriptDir & "\1.txt"
$k = Number(IniRead($cfg, "set", "数值", ""))
MsgBox(64, "123", $k)
$Form1 = GUICreate("Form1", 220, 110)
$Input1 = GUICtrlCreateInput("Input1", 16, 16, 193, 21)
$Input2 = GUICtrlCreateInput("Input2", 16, 40, 193, 21)
$Button1 = GUICtrlCreateButton("Button1", 104, 64, 105, 41)
GUISetState()

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case - 3
                        Exit
                Case $Button1;;;;;;; 数字4,5,6,7,8,9 等数字 它计算的结果小于$K  怎样才可以正确比对??
                        If GUICtrlRead($Input1) <= $k Then GUICtrlSetData($Input2, GUICtrlRead($Input1))
        EndSwitch
WEnd
 楼主| 发表于 2011-1-8 21:44:00 | 显示全部楼层
谢谢老大们的热情帮助。嘿嘿。。。。。有你们真好。。。。
发表于 2011-1-8 22:57:04 | 显示全部楼层
为什么4都大于300(非数字)
---------------------------------
字串型数据比较:
从前面截取相同长度的字符
然后进行比较
if 4 <= 3 then ;条件非真,这里当然就没有动作了
if 10 <= 30 then ;比较为真,这里就可以搞点小动作
...
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-21 14:26 , Processed in 0.081328 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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