|
楼主 |
发表于 2016-12-28 11:30:01
|
显示全部楼层
假設我都用ratio的話, RHEL6.5跟sda就寫不進去testconfig.ini檔...是不是我語法錯誤拉...
if BitAnd(GUICtrlRead($Radio1),$GUI_CHECKED)=1 Then
if BitAnd(GUICtrlRead($Checkbox1),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL6.5")
FileWriteLine($testconfig, "sda")
EndIf#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
$Form1 = Guicreate("OS Install", 420, 150, -1, -1)
$Group1 = GUICtrlCreateGroup("OS Version", 10, 10, 120, 120)
$Group2 = GUICtrlCreateGroup("Disk Select", 140, 10, 200, 120)
$Radio1 = GUICtrlCreateRadio("RHEL6.5", 20, 30, 80, 20)
$Radio2 = GUICtrlCreateRadio("RHEL7.1", 20, 55, 80, 20)
$Radio3 = GUICtrlCreateRadio("RHEL7.2", 20, 80, 80, 20)
$Checkbox1 = GUICtrlCreateCheckbox("sda", 155, 30, 60, 20,$BS_AUTORADIOBUTTON)
$Checkbox2 = GUICtrlCreateCheckbox("sdb", 155, 55, 60, 20,$BS_AUTORADIOBUTTON)
$Checkbox3 = GUICtrlCreateCheckbox("sdc", 155, 80, 60, 20,$BS_AUTORADIOBUTTON)
$Checkbox4 = GUICtrlCreateCheckbox("sdd", 155, 105, 60, 20,$BS_AUTORADIOBUTTON)
$Checkbox5 = GUICtrlCreateCheckbox("sde", 215, 30, 60, 20,$BS_AUTORADIOBUTTON)
$Checkbox6 = GUICtrlCreateCheckbox("sdf", 215, 55, 60, 20,$BS_AUTORADIOBUTTON)
$Checkbox7 = GUICtrlCreateCheckbox("sdg", 215, 80, 60, 20,$BS_AUTORADIOBUTTON)
$Checkbox8 = GUICtrlCreateCheckbox("sdh", 215, 105, 60, 20,$BS_AUTORADIOBUTTON)
$Checkbox9 = GUICtrlCreateCheckbox("sdi", 275, 30, 60, 20,$BS_AUTORADIOBUTTON)
$Checkbox10 = GUICtrlCreateCheckbox("sdj", 275, 55, 60, 20,$BS_AUTORADIOBUTTON)
$Checkbox11 = GUICtrlCreateCheckbox("sdk", 275, 80, 60, 20,$BS_AUTORADIOBUTTON)
$Checkbox12 = GUICtrlCreateCheckbox("sdl", 275, 105, 60, 20,$BS_AUTORADIOBUTTON)
$Button1 = GuiCtrlCreateButton("Execute", 350, 100, 50, 30)
$testconfig =FileOpen("testconfig.ini",1) ; 1:繼續往下寫
GuiSetState(@SW_SHOW)
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
MsgBox(0,"Execute Test Case","OSInstallation",0.5)
FileWriteLine($testconfig, "[OSInstallation]")
if BitAnd(GUICtrlRead($Radio1),$GUI_CHECKED)=1 Then
if BitAnd(GUICtrlRead($Checkbox1),$GUI_CHECKED)=1 Then
;GUICtrlSetState($Checkbox2, 1)
FileWriteLine($testconfig, "RHEL6.5")
FileWriteLine($testconfig, "sda")
EndIf
if BitAnd(GUICtrlRead($Checkbox2),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL6.5")
FileWriteLine($testconfig, "sdb")
EndIf
if BitAnd(GUICtrlRead($Checkbox3),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL6.5")
FileWriteLine($testconfig, "sdc")
EndIf
if BitAnd(GUICtrlRead($Checkbox4),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL6.5")
FileWriteLine($testconfig, "sdd")
EndIf
if BitAnd(GUICtrlRead($Checkbox5),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL6.5")
FileWriteLine($testconfig, "sde")
EndIf
if BitAnd(GUICtrlRead($Checkbox6),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL6.5")
FileWriteLine($testconfig, "sdf")
EndIf
if BitAnd(GUICtrlRead($Checkbox7),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL6.5")
FileWriteLine($testconfig, "sdg")
EndIf
if BitAnd(GUICtrlRead($Checkbox8),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL6.5")
FileWriteLine($testconfig, "sdh")
EndIf
if BitAnd(GUICtrlRead($Checkbox9),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL6.5")
FileWriteLine($testconfig, "sdi")
EndIf
if BitAnd(GUICtrlRead($Checkbox10),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL6.5")
FileWriteLine($testconfig, "sdj")
EndIf
if BitAnd(GUICtrlRead($Checkbox11),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL6.5")
FileWriteLine($testconfig, "sdk")
EndIf
if BitAnd(GUICtrlRead($Checkbox12),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL6.5")
FileWriteLine($testconfig, "sdl")
EndIf
EndIf
if BitAnd(GUICtrlRead($Radio2),$GUI_CHECKED)=1 Then
if BitAnd(GUICtrlRead($Checkbox1),$GUI_CHECKED)=1 Then
;GUICtrlSetState($Checkbox2, 1)
FileWriteLine($testconfig, "RHEL7.1")
FileWriteLine($testconfig, "sda")
EndIf
if BitAnd(GUICtrlRead($Checkbox2),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.1")
FileWriteLine($testconfig, "sdb")
EndIf
if BitAnd(GUICtrlRead($Checkbox3),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.1")
FileWriteLine($testconfig, "sdc")
EndIf
if BitAnd(GUICtrlRead($Checkbox4),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.1")
FileWriteLine($testconfig, "sdd")
EndIf
if BitAnd(GUICtrlRead($Checkbox5),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.1")
FileWriteLine($testconfig, "sde")
EndIf
if BitAnd(GUICtrlRead($Checkbox6),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.1")
FileWriteLine($testconfig, "sdf")
EndIf
if BitAnd(GUICtrlRead($Checkbox7),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.1")
FileWriteLine($testconfig, "sdg")
EndIf
if BitAnd(GUICtrlRead($Checkbox8),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.1")
FileWriteLine($testconfig, "sdh")
EndIf
if BitAnd(GUICtrlRead($Checkbox9),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.1")
FileWriteLine($testconfig, "sdi")
EndIf
if BitAnd(GUICtrlRead($Checkbox10),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.1")
FileWriteLine($testconfig, "sdj")
EndIf
if BitAnd(GUICtrlRead($Checkbox11),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.1")
FileWriteLine($testconfig, "sdk")
EndIf
if BitAnd(GUICtrlRead($Checkbox12),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.1")
FileWriteLine($testconfig, "sdl")
EndIf
EndIf
if BitAnd(GUICtrlRead($Radio3),$GUI_CHECKED)=1 Then
if BitAnd(GUICtrlRead($Checkbox1),$GUI_CHECKED)=1 Then
;GUICtrlSetState($Checkbox2, 1)
FileWriteLine($testconfig, "RHEL7.2")
FileWriteLine($testconfig, "sda")
EndIf
if BitAnd(GUICtrlRead($Checkbox2),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.2")
FileWriteLine($testconfig, "sdb")
EndIf
if BitAnd(GUICtrlRead($Checkbox3),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.2")
FileWriteLine($testconfig, "sdc")
EndIf
if BitAnd(GUICtrlRead($Checkbox4),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.2")
FileWriteLine($testconfig, "sdd")
EndIf
if BitAnd(GUICtrlRead($Checkbox5),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.2")
FileWriteLine($testconfig, "sde")
EndIf
if BitAnd(GUICtrlRead($Checkbox6),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.2")
FileWriteLine($testconfig, "sdf")
EndIf
if BitAnd(GUICtrlRead($Checkbox7),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.2")
FileWriteLine($testconfig, "sdg")
EndIf
if BitAnd(GUICtrlRead($Checkbox8),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.2")
FileWriteLine($testconfig, "sdh")
EndIf
if BitAnd(GUICtrlRead($Checkbox9),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.2")
FileWriteLine($testconfig, "sdi")
EndIf
if BitAnd(GUICtrlRead($Checkbox10),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.2")
FileWriteLine($testconfig, "sdj")
EndIf
if BitAnd(GUICtrlRead($Checkbox11),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.2")
FileWriteLine($testconfig, "sdk")
EndIf
if BitAnd(GUICtrlRead($Checkbox12),$GUI_CHECKED)=1 Then
FileWriteLine($testconfig, "RHEL7.2")
FileWriteLine($testconfig, "sdl")
EndIf
EndIf
FileWriteLine($testconfig, "")
sleep(1000)
winclose("OS Install")
EndSwitch
Wend
sleep(2000)
|
|