dk0521 发表于 2014-4-15 19:31:28

Do....Until 循环問題

$t = "系统配置实用程序"

Run('msconfig.exe')
WinWaitActive ($t)
ControlCommand ( $t, "", 'SysTabControl321' , "TabRight")
ControlCommand ( $t, "", 'SysTabControl321' , "TabRight")
ControlCommand ( $t, "", 'SysTabControl321' , "TabRight")
ControlCommand ( $t, "", 'SysTabControl321' , "TabRight")
Sleep(500)
ControlListView ( $t, "", 'SysListView321', "SelectClear")
$i = 1
Do
Sleep(1000)
$n = FileReadLine("D:\test.txt", $i)
$G = ControlListView($t, "", "SysListView321", "FindItem", $n, 0)
ControlListView ( $t, "", 'SysListView321',"Select", $G)
$i += 1
Sleep(1000)
Until @error

-------------------------------------------------------------
要在TXT读取完后,结束程序!
请问是哪里写错吗?

afan 发表于 2014-4-15 20:21:38

$t = "系统配置实用程序"

Run('msconfig.exe')
WinWaitActive($t)
ControlCommand($t, "", 'SysTabControl321', "TabRight")
ControlCommand($t, "", 'SysTabControl321', "TabRight")
ControlCommand($t, "", 'SysTabControl321', "TabRight")
ControlCommand($t, "", 'SysTabControl321', "TabRight")
Sleep(500)
ControlListView($t, "", 'SysListView321', "SelectClear")

$file = FileOpen("D:\test.txt")
If $file = -1 Then Exit MsgBox(0, "错误", "不能打开文件.")

Do
        Sleep(1000)
        $n = FileReadLine($file)
        If @error = -1 Then ExitLoop
        $G = ControlListView($t, "", "SysListView321", "FindItem", $n, 0)
        ControlListView($t, "", 'SysListView321', "Select", $G)
        ;Sleep(1000)
Until @error
页: [1]
查看完整版本: Do....Until 循环問題