找回密码
 加入
搜索
查看: 4341|回复: 8

[网络通信] 求优化【以解决】

  [复制链接]
发表于 2013-1-24 12:30:59 | 显示全部楼层 |阅读模式
本帖最后由 qq82015930 于 2013-1-25 19:49 编辑
$hmdpaht = IniRead(@ScriptDir & "\config.sec","ph","path","")
$okhmdpaht = FileExists($hmdpaht) ;查看文件是否存在
If $okhmdpaht = 0 Then
        MsgBox(262208,"","hmd哭不存在,检测配置")
Else
        
;MsgBox(262208,$hmdpaht,"")
$hmd11 = IniRead($hmdpaht,"hmd","hmd11","") 
$hmd12 = IniRead($hmdpaht,"hmd","hmd12","") 
$hmd13 = IniRead($hmdpaht,"hmd","hmd13","") 

$hmd21 = IniRead($hmdpaht,"hmd","hmd21","") 
$hmd22 = IniRead($hmdpaht,"hmd","hmd22","") 
$hmd23 = IniRead($hmdpaht,"hmd","hmd23","") 

$hmd31 = IniRead($hmdpaht,"hmd","hmd31","") 
$hmd32 = IniRead($hmdpaht,"hmd","hmd32","") 
$hmd33 = IniRead($hmdpaht,"hmd","hmd33","") 

$hmd41 = IniRead($hmdpaht,"hmd","hmd41","") 
$hmd42 = IniRead($hmdpaht,"hmd","hmd42","") 
$hmd43 = IniRead($hmdpaht,"hmd","hmd43","") 

$hmd51 = IniRead($hmdpaht,"hmd","hmd51","") 
$hmd52 = IniRead($hmdpaht,"hmd","hmd52","") 
$hmd53 = IniRead($hmdpaht,"hmd","hmd53","") 

$hmd61 = IniRead($hmdpaht,"hmd","hmd61","") 
$hmd62 = IniRead($hmdpaht,"hmd","hmd62","") 
$hmd63 = IniRead($hmdpaht,"hmd","hmd63","") 

$Gethmd = "hmd123456" 

If $Gethmd = $hmd11 Then
        _xt()
ElseIf $Gethmd = $hmd12 Then
        _xt()
ElseIf $Gethmd = $hmd13 Then
        _xt()
ElseIf $Gethmd = $hmd21 Then
        _xt()
ElseIf $Gethmd = $hmd22 Then
        _xt()
ElseIf $Gethmd = $hmd23 Then
        _xt()
ElseIf $Gethmd = $hmd31 Then
        _xt()
ElseIf $Gethmd = $hmd32 Then
        _xt()
ElseIf $Gethmd = $hmd33 Then
        _xt()
ElseIf $Gethmd = $hmd41 Then
        _xt()
ElseIf $Gethmd = $hmd42 Then
        _xt()
ElseIf $Gethmd = $hmd43 Then
        _xt()
ElseIf $Gethmd = $hmd51 Then
        _xt()
ElseIf $Gethmd = $hmd52 Then
        _xt()
ElseIf $Gethmd = $hmd53 Then
        _xt()
ElseIf $Gethmd = $hmd61 Then
        _xt()
ElseIf $Gethmd = $hmd62 Then
        _xt()
ElseIf $Gethmd = $hmd63 Then
        _xt()
Else
        MsgBox(262208,"","没找到")
EndIf

EndIf

Func _xt()
        MsgBox(262208,"提示","有相同hmd")
EndFunc
谢谢,两位大侠的指点.
发表于 2013-1-24 12:37:23 | 显示全部楼层
本帖最后由 netegg 于 2013-1-24 12:39 编辑
$dqhmd = "hmd123456" 
local $Gethmd
        Switch $Gethmd
                Case $hmd11 To $hmd63
                        _xt()
                Case Else
                        MsgBox(262208, "", "没找到")
        EndSwitch

EndIf

Func _xt()
        MsgBox(262208, "提示", "有相同hmd")
EndFunc   ;==>_xt
不过没看明白,这个$Gethmd到底是什么,从什么地方冒出来的
 楼主| 发表于 2013-1-24 12:58:53 | 显示全部楼层
回复 2# netegg


    $Gethmd   $dqhmd   写错啦
发表于 2013-1-24 13:29:51 | 显示全部楼层
本帖最后由 netegg 于 2013-1-24 13:37 编辑
        Switch "hmd123456" 
                Case $hmd11, $hmd12, $hmd13, $hmd21,$hmd22, $hmd23,  $hmd31, $hmd32, $hmd33, $hmd41,$hmd42, $hmd43,  $hmd51, $hmd52, $hmd53, $hmd61,$hmd62, $hmd63
                        _xt()
                Case Else
                        MsgBox(262208, "", "没找到")
        EndSwitch

EndIf

Func _xt()
        MsgBox(262208, "提示", "有相同hmd")
EndFunc   ;==>_xt
发表于 2013-1-24 13:33:33 | 显示全部楼层
本帖最后由 haijie1223 于 2013-1-24 14:11 编辑

还是用数组吧
Dim $hmd[19]
$hmdpaht = IniRead(@ScriptDir & "\config.sec", "ph", "path", "")
$Gethmd = "hmd123456"

If FileExists($hmdpaht) Then
        For $i = 1 To 18
                $hmd[$i] = IniRead($hmdpaht, "hmd", "hmd" & $i, "")
                If $Gethmd = $hmd[$i] Then MsgBox(262208, "提示", "有相同hmd")
        Next
Else
        MsgBox(262208, "", "hmd哭不存在,检测配置")
EndIf
发表于 2013-1-24 13:38:29 | 显示全部楼层
本帖最后由 netegg 于 2013-1-24 13:39 编辑

回复 5# haijie1223
这么写我试了试,好像不行,不过问题应该好找,可能是没赋值的关系
发表于 2013-1-24 14:20:18 | 显示全部楼层
回复 6# netegg


    我改了一下,还是用数组比较方便
发表于 2013-1-24 14:36:58 | 显示全部楼层
回复 7# haijie1223
那么写的话,一样要用索引切换条件,不用循环,要不有一堆是废的
发表于 2013-1-24 14:46:24 | 显示全部楼层
本帖最后由 netegg 于 2013-1-24 14:51 编辑

算了,整个大概可以的完整的吧
$hmdpaht = IniRead(@ScriptDir & "\config.sec", "ph", "path", "")
If FileExists($hmdpaht) Then
    For $i = 1 To 6
        For $j = 1 To 3
            If StringInStr("hmd123456", IniRead($hmdpaht, "hmd", "hmd" & $i & $j, "") Then
                xt()
            Else
                MsgBox(262208, "", "没找到")
            EndIf
        Next
    Next
Else
    MsgBox(262208, "", "没找到")
EndIf

Func _xt()
        MsgBox(262208, "提示", "有相同hmd")
EndFunc   ;==>_xt
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-18 03:35 , Processed in 0.082227 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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