找回密码
 加入
搜索
查看: 2084|回复: 5

[AU3基础] 运行到最后提示,数组超出界限或数组错误

  [复制链接]
发表于 2011-11-21 17:50:01 | 显示全部楼层 |阅读模式
#NoTrayIcon
#region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Icon=3DMark2001 SE.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=没有注释啊!!!!
#AutoIt3Wrapper_Res_Fileversion=1.1.0.8
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=
#endregion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstantsEx.au3>
HotKeySet("{ESC}", "Terminate")


WinMinimizeAll()
FileInstall("3DMark2001 SE.exe", "d:\3DMark2001 SE.exe", 0)
FileInstall("logo.jpg", "d:\logo.jpg", 0)
FileCreateShortcut("D:\迅捷科技主板测试软件.exe", @DesktopCommonDir & "\迅捷科技主板测试软件.lnk")
GUICreate("迅捷电脑主板测试软件", 350, 290, "-1", "-1")
$pic = GUICtrlCreatePic("d:\logo.jpg", 0, 0, 350, 50)
Global $Checkbox[4]
$Checkbox[1] = GUICtrlCreateCheckbox("是否开机运行", 65, 75, 250, -1)
GUICtrlSetFont($Checkbox[1], 15)
$Checkbox[2] = GUICtrlCreateCheckbox("是否循环", 65, 115, 250, -1)
GUICtrlSetFont($Checkbox[2], 15)
$Checkbox[3] = GUICtrlCreateCheckbox("检测完成是否关机", 65, 155, 250, -1)
GUICtrlSetFont($Checkbox[3], 15)
$Label = GUICtrlCreateLabel("制作", 280, 270, -1, -1)
$Button = GUICtrlCreateButton("开始测试", 65, 195, 250, 50)
ControlCommand("迅捷电脑主板测试软件","开始测试","$Button","IsChecked", "1")
GUISetState(@SW_SHOW)


While 1
        Local $i
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button
                        $l = FileExists("D:\MadOnion.com\3DMark2001 SE\3DMark2001SE.exe")
                        If $l = 0 Then
                                Local $c = MsgBox(4, "未检测到3DMark2001 SE安装3DMark2001 SE", "是否安装3DMark2001 SE")
                                Select
                                        Case $c = 6
                                                FileExists("D:\MadOnion.com\3DMark2001 SE\3DMark2001SE.exe")
                                                Run("D:\3DMark2001 SE.exe")
                                                WinWait("3DMark2001 SE - InstallShield Wizard", "Click Next to install...")
                                                WinActivate("3DMark2001 SE - InstallShield Wizard", "Click Next to install...")
                                                ControlClick("3DMark2001 SE - InstallShield Wizard", "Click Next to install...", "Button2")
                                                WinWait("InstallShield Wizard", "License Agreement")
                                                WinActivate("InstallShield Wizard", "License Agreement")
                                                ControlClick("InstallShield Wizard", "License Agreement", "Button2")
                                                WinWait("InstallShield Wizard", "Choose Destination Location")
                                                WinActivate("InstallShield Wizard", "Choose Destination Location")
                                                ControlClick("InstallShield Wizard", "", "Button3")
                                                Sleep(1000)
                                                WinActivate("Choose Folder", "Please choose the installation folder.")
                                                ControlSetText("Choose Folder", "Please choose the installation folder.", "Edit1", "d:\MadOnion.com\3DMark2001 SE")
                                                ControlClick("Choose Folder", "Please choose the installation folder.", "Button1")
                                                WinActivate("InstallShield Wizard", "Choose Destination Location")
                                                ControlClick("InstallShield Wizard", "Choose Destination Location", "Button1")
                                                WinWait("InstallShield Wizard", "Start Copying Files")
                                                WinActivate("InstallShield Wizard", "Start Copying Files")
                                                ControlClick("InstallShield Wizard", "Start Copying Files", "Button1")
                                                WinWait("InstallShield Wizard", "MadOnion.com Registration")
                                                WinActivate("InstallShield Wizard", "MadOnion.com Registration")
                                                ControlClick("InstallShield Wizard", "MadOnion.com Registration", "Button3")
                                                WinWait("InstallShield Wizard", "InstallShield Wizard Complete")
                                                WinActivate("InstallShield Wizard", "InstallShield Wizard Complete")
                                                ControlClick("InstallShield Wizard", "InstallShield Wizard Complete", "Button1")
                                                ControlClick("InstallShield Wizard", "InstallShield Wizard Complete", "Button4")
                                        Case $c = 7
                                                Exit
                                EndSelect

                        EndIf
                        For $i = 1 To 4
                                If GUICtrlRead($Checkbox[$i]) = $GUI_CHECKED Then
                                        If $i = 1 Then
                                                RegWrite("HKLM\Software\Microsoft\windows\currentversion\run", "yunxing", "REG_SZ", "D:\迅捷科技主板测试软件.exe")
                                        ElseIf $i = 2 Then
                                                Run("D:\MadOnion.com\3DMark2001 SE\3DMark2001SE.exe")
                                                WinWait("无标题 - 3DMark2001 SE", "")
                                                WinActivate("无标题 - 3DMark2001 SE", "")
                                                ControlClick("无标题 - 3DMark2001 SE", "Ch&ange...", "Button3")
                                                WinWait("Options", "Loo&ping")
                                                WinActivate("Options", "Loo&ping")
                                                ControlClick("Options", "&Looping", "Button2")
                                                WinActivate("Options", "Loo&ping")
                                                ControlClick("Options", "OK", "Button7")
                                                ControlClick("无标题 - 3DMark2001 SE", "&Benchmark", "Button9")
                                                WinWait("3DMark2001 SE Overall Score", "")
                                                WinActivate("3DMark2001 SE Overall Score", "")
                                                ControlClick("3DMark2001 SE Overall Score", "C&lose", "Button6")
                                        ElseIf $i = 3 Then
                                                Shutdown(5)
                                        EndIf
                                ElseIf GUICtrlRead($Checkbox[$i]) = $GUI_UNCHECKED Then
                                        If $i = 1 Then
                                                RegDelete("HKLM\Software\Microsoft\windows\currentversion\run", "yunxing")
                                        ElseIf $i = 2 Then
                                                Run("D:\MadOnion.com\3DMark2001 SE\3DMark2001SE.exe")
                                                WinWait("无标题 - 3DMark2001 SE", "")
                                                WinActivate("无标题 - 3DMark2001 SE", "")
                                                ControlClick("无标题 - 3DMark2001 SE", "&Benchmark", "Button9")
                                                WinWait("3DMark2001 SE Overall Score", "")
                                                WinActivate("3DMark2001 SE Overall Score", "")
                                                ControlClick("3DMark2001 SE Overall Score", "C&lose", "Button6")
                                        EndIf
                                EndIf
                        Next
        EndSwitch
WEnd
Func Terminate()
        Exit
EndFunc   ;==>Terminate


实在找不出来,高手帮忙看看是什么原因!
发表于 2011-11-21 19:22:39 | 显示全部楼层
为什么找不出来呢?在编辑器里运行,运行到出错行代码会有信息提示的。
自己看是哪个数组不对,这问题要在自己的运行环境里检查。
发表于 2011-11-21 19:26:43 | 显示全部楼层
为什么找不出来呢?在编辑器里运行,运行到出错行代码会有信息提示的。

Global $Checkbox[4]
其值下标是 0 到 3
而你 却
For $i = 1 To 4
               If GUICtrlRead($Checkbox[$i]) = $GUI_CHECKED Then
。。。
能没有问题吗?
发表于 2011-11-21 21:20:37 | 显示全部楼层
回复 3# user3000
对啊,这个就有问题了,还是user3000,看得仔细,其实这个是很基本的错误,不应该的
发表于 2011-11-29 01:32:25 | 显示全部楼层
3楼正解

低级错误,打PP
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-20 22:57 , Processed in 0.086234 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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