程序没有按要求被调用
本帖最后由 dnvplj 于 2015-4-10 14:00 编辑各位朋友,下面代码中没有按配置文件被调用,面是直接调用目录里的程序,整了2天也没有整明白,所以到论坛求各位朋友给予指教。#include <Constants.au3 >
#include <WinAPI.au3>
#include <WinAPIEx.au3>
#include <Misc.au3>
#include <ProgressConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region
$Form1_SoftInstall = GUICreate("Soft_Name", 552, 393, 193, 131)
$Group1 = GUICtrlCreateGroup("选择软件:", 8, 96, 537, 245)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Button1 = GUICtrlCreateButton("安装", 352, 360, 75, 25)
Global $Button2 = GUICtrlCreateButton("退 出", 440, 360, 75, 25)
Global $Radio1 = GUICtrlCreateRadio("全选", 216, 364, 57, 17)
Global $Radio2 = GUICtrlCreateRadio("全不选", 280, 364, 65, 17)
$Pic1 = GUICtrlCreatePic("", 0, 0, 609, 105)
GUISetState(@SW_SHOW)
#EndRegion
If Not FileExists(@ScriptDir & "\test.ini") Then
MsgBox(0, "配置文件不存在", "找不到:" & @ScriptDir & "\test.ini")
Exit
EndIf
Global $secNamesArray = IniReadSectionNames(@ScriptDir & "\test.ini")
If @error Then
MsgBox(0, "配置文件为空", "请检查:" & @ScriptDir & "\test.ini")
Exit
EndIf
Global $secCnt = $secNamesArray
Global $Checkbox1[$secCnt]
For $i = 0 To $secCnt - 1
$Checkbox1[$i] = $secNamesArray[$i + 1]
$Checkbox1[$i] = GUICtrlCreateCheckbox($Checkbox1[$i], _Iif($i < 5, 60, 330), 120 + Mod($i, 5) * 35, 193, 33)
$Checkbox1[$i] = IniRead(@ScriptDir & "\test.ini", $Checkbox1[$i], "文件名", "没有读到")
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Radio1
SetAllCheckBox(True)
Case $Radio2
SetAllCheckBox(False)
Case $Button1
Setup1()
Case $Button2
Exit
EndSwitch
WEnd
Func Setup1()
ProgressOn("安装进度", "")
For $i = 0 To UBound($Checkbox1) - 1
$name=stringsplit($Checkbox1[$i],"\")
ProgressSet(100 / UBound($Checkbox1) * $i, "已完成" & 100 / UBound($Checkbox1) * $i & " % ", "正在安装:" & $name)
RunWait($Checkbox1[$i])
Next
ProgressSet(100, "完成", "完成")
Sleep(500)
ProgressOff()
EndFunc ;==>Setup1
页:
[1]